Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Docs Setup BuildSystem

Frank Kleine edited this page Apr 7, 2012 · 1 revision

Table of Contents

The Stubbles build system

Preconditions

To ease the development with Stubbles, we provide a build-system, that takes care of commonly needed tasks. To make use of this build system, you will have to install Phing. If you need help installing this requirement, please take a look at installing Phing.

Other required PEAR packages are:

  • From the default PEAR channel:
    • PHP_CodeSniffer
    • PHPDocumentor
  • From pear.bovigo.org:
    • StubblesCodingStandard
    • star
    • vfsStream
  • From pear.pdepend.org
    • PHP_Depend
  • From pear.phpmd.org
    • PHP_PMD
  • From pear.phpunit.de Please note that you should add components.ez.no and pear.symfony-project.com as channels as well, as PHPUnit uses PEAR packages from these channels as mandatory dependencies.
    • PHPUnit

Please note that these PEAR packages are required for the Stubbles build process (and we recommend using them in build processes for Stubbles based applications as well) but not for running Stubbles applications itself.

Setting up your installation

After you downloaded the Stubbles release and extracted the archive, you are ready to setup your installation:

  • nix systems:
$ cd /path/to/stubbles
$ ./stubbles

Windows:

$ cd /path/to/stubbles
$ stubbles.bat

After running this command, you will be asked several questions:

 installation name::
  The build process will ask you for the name of your installation. This is only needed for the Phing build file, it can easily be changed afterwards. If your project name contains ampersands please make sure that you mask them as <tt>&amp;</tt> by yourself instead of just typing <tt>&</tt>. Not masking the ampersand results in a broken generated build file.
 permissions for cache folder::
  The build process will automatically set the permissions for all folders, that will contain cache files. Please make sure, that the cache permissions allow the webserver to write in these folders.

Create a new project

Note: it is not required to do this separately when you setup your installation initially, it is included in the initial setup process.

$ cd /path/to/stubbles
$ phing setup-project

First you will be asked for the name of the new project. This will be the name of the project's directory within the projects folder.

Second you will be asked for the project you want to copy the config files from. By default it will use the dist project.

 Enabling JSON-RPC functionality::
  If you want to build an AJAX powered site, please answer this questions with <tt>Y</tt> to copy all required files.
 enable variant manager::
  If you want to use [[Docs/MVC/Variant| variants]] in your website, answer this question with <tt>Y</tt> to copy the required configuration files.

All available commands

The stubbles build script provides various commands that help you with common tasks. To run a command, just execute the following line in your shell:

$ phing [commandname]

Besides setup-project the build script provides the following commands:

 <tt>setup-examples</tt>::
  This command will make sure that the included examples work on your server or provides information, why the examples are not working.
 <tt>clean-dist</tt>::
  This command will remove <tt>dist</tt> project from your installation. You should only run this after you created your first project, else you will have to set up your project manually.
 <tt>clean-examples</tt>::
  This command will remove the example project and all related files in the <tt>src</tt> directory.
 <tt>clear-cache</tt>::
  This will remove all cache files from your installation. Make sure, that the user who runs this command has the permissions to delete files written by the webserver.

Starting the build

After you finished the project setup and adjusted all configuration options, you are ready to start the build. All, that is needed for this is running Phing:

$ phing
Buildfile: path/to/stubbles/build.xml

MyProject > main:

...

BUILD FINISHED

Total time: 1.2271 second

The output of the build process depends on the selections you made during project setup and the Stubbles version and components you are using.

Adjusting the build process

The build process is completely managed by Phing and can easily be adjusted. After the project setup has been finished, the root folder of your project will contain to build files:

  • build.xml
  • build-stubbles.xml
  • build-project.xml

Feel free to modify the build.xml file to make additions to the build process. All tasks provided by Stubbles are defined in the build-stubbles.xml and build-project.xml file, which must not be changed manually, as new versions will provide improved build scripts.

Clone this wiki locally