overview.html #4

  • //
  • guest/
  • tjuricek/
  • initializer/
  • docs/
  • site/
  • overview.html
  • View
  • Commits
  • Open Download .zip Download (6 KB)
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <title>Initializer for Perforce Servers</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="keywords" content="">
    <meta name="generator" content"JBake">

    <!-- Le styles -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/asciidoctor.css" rel="stylesheet">
    <link href="css/base.css" rel="stylesheet">
    <link href="css/bootstrap-responsive.min.css" rel="stylesheet">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
    <![endif]-->

    <!-- Fav and touch icons -->
    <!--<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">-->
    <link rel="shortcut icon" href="favicon.ico">
  </head>
  <body>
    <div id="wrap">

<nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <ul class="nav navbar-nav">
                <li><a href="index.html">Initializer</a></li>
                <li><a href="overview.html">Overview</a></li>
                <li><a href="data.html">Data</a></li>
                <li><a href="../javadoc/index.html">Javadoc</a></li>
            </ul>
        </div>
    </div>
</nav>

<div class="container">

<h1>Initializer Overview</h1><p>When developing applications on top of the Perforce server, you often want to start with a server with real data in a sensible configuration. When these apps need to run against <em>multiple versions</em> of Perforce, you're faced with figuring out how to set up each instance in the same way. This is the job of the initializer: take a bunch of files and metadata, and set up your Perforce instance. Now, you can, say, run the same system tests in different configurations of Perforce.</p><p>The initializer uses a directory of .json files that describe changes to be made, along with versions of data to "seed" into the system. See the <a href="data.html">Data</a> page for details of how to set this up. This directory is intended to be checked in with your system tests.</p><p>When you have the data set up, you'll then execute the initializer either using the command line, or, via gradle plugins. Both of these options are described below.</p><h2>Requirements</h2>
<ol>
  <li><p>Java 8</p></li>
  <li><p>A running Perforce instance, this tool does not actually download the p4d executable, and generally assumes you've just set it up without a lot of configuration</p></li>
</ol><h2>Notable Restrictions</h2><p>This system always sets security to level 2 at the moment.</p><h2>Executing using the Command Line</h2><p>The first part of executing via the command line is downloading the "complete" jar distribution.</p><p><a href="http://dl.bintray.com/tristanjuricek/generic/initializer/0.1.2/#initializer-complete.jar">Version 0.1.2</a></p><h3>Create A Configuration File</h3><p>From here, you'll need to create a configuration file. Here's an example:</p>
<pre><code>options:
    dataRootDir:    src/test/perforce
    triggersDir:    build/perforce/work/triggers
    clientRootDir:  build/perforce/clients
</code></pre><p>This is a <a href="http://yaml.org">YAML</a> file, so save this content in a file like <code>config.yml</code>.</p><p>The main directory you need is <code>dataRootDir</code>. This is the <a href="data.html">data directory tree</a> contains all your JSON files and data to be seeded.</p><p>The <code>triggersDir</code> is used only if you're creating triggers; this is the directory we write out the trigger file for use by the Perforce instance.</p><p>The <code>clientRootDir</code> is used by all temporary clients as a working area.</p><p>Note that this assumes a Perforce instance is running on localhost:1666. If this is not the case, you'll need an additional section in the config file:</p>
<pre><code>connectionSettings:
    hostname:   localhost
    port:       1666
</code></pre><h3>Execution</h3><p>Execute downloaded jar file with your configuration:</p>
<pre><code>% java -jar initializer-complete.jar config.yml
</code></pre><h2>Executing using Gradle</h2><p>First, set up your <code>buildscript</code> repository configuration for both the <code>initializer-gradle-plugin</code> and the <code>perforce-gradle-plugin</code>:</p>
<pre><code>buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath(&quot;com.perforce.workshop.tjuricek:perforce-gradle-plugin:0.1.2&quot;)
        classpath(&quot;com.perforce.workshop.tjuricek:initializer-gradle-plugin:0.1.1&quot;)
    }
}
</code></pre><p>Then, just apply the plugins:</p>
<pre><code>apply plugin: &#39;perforce&#39;
apply plugin: &#39;perforce-initializer&#39;
</code></pre><p>You'll only need to then run the <code>initPerforce</code> task once:</p>
<pre><code>% ./gradlew initPerforce
</code></pre><p>From there, you can start and stop the test server using <code>stopPerforce</code> and <code>startPerforce</code> tasks.</p><p>This assumes that by default you've stored all your data under the <code>src/test/perforce</code>. You can reconfigure this:</p>
<pre><code>initializer {
    sources = project.file(&#39;another/directory&#39;)
}
</code></pre>

</div>

    </div><!-- #wrap -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/run_prettify.js"></script>

  </body>
</html>
# Change User Description Committed
#4 9174 tjuricek Fix header
#3 9173 tjuricek Added gradle instructions and removed hideous footer in site documentation.
#2 9172 tjuricek 0.1.2 Added command line execution options and documentation to run the initializer locally.
#1 9165 tjuricek Some documentation framework and a fatjar style distribution for the initializer to run outside of a gradle plugin.

Upped the version to 0.1.2, but this may need some testing before it's really guaranteed to work in standalone mode