Requirements
============

- the php cli
- command line tools: svn and/or git, doxygen, tar, zip
- the Composer php tool
- all other php libraries and tools will be automatically downloaded during the installation process outlined below.
  NB: you will need at least 150MB of free space for them, plus enough space for the build

How to install and use eZ Extension Builder
===========================================

This is a 4 steps tutorial. The fifth step is optional ;-)


1. Install ezextensionbuilder and its dependencies via composer (once)
----------------------------------------------------------------------

You can declare the script as a dependency in the composer.json file of your extension:

    {
        "name": "<me>/<myextension>",
        "type": "ezpublish-legacy-extension",
        "minimum-stability": "dev",
        "require": {
            "ezsystems/ezpublish-legacy-installer": "*"
        },
        "require-dev": {
            "gggeek/ezextensionbuilder": "*"
        }
    }

Usually you would run the build script in the root directory of your extension,
but that is not a strict requisite (you could run the build process in some other dir).

    cd <myextension_directory>
    composer install

If you do not have composer, see here how to install it: https://getcomposer.org/doc/00-intro.md

To test that installation worked fine, try getting a list of available tasks.
To get a list of all available tasks run:

    ./vendor/bin/ezextbuilder --tasks

2. Create the configuration file (once)
---------------------------------------

A configuration file is needed to drive the build. The extension can generate a sample one for you:

    ./vendor/bin/ezextbuilder generate-extension-config <myextension>

This will create a directory ./pake/ and save into it the file options-<myextension>.yaml

If your extension already has such file in its source repository but not on local disk, you can instead just download it:

    ./vendor/bin/ezextbuilder download-extension-config myextension https://raw.github.com/<me>/<myextension>/master/pake/options-<myextension>.yaml


3. Edit the configuration file (for every build)
------------------------------------------------

You should edit ./pake/options-<myextension>.yaml to suit your needs.

Note that steps 1 and 2 have to be executed only once.

Note also that you can pass any configuration option on the command line as well.
This makes it easy to keep the same configuration file and run different builds. Ex:

    ./vendor/bin/ezextbuilder show-properties --option.version.major=99

4. Launch the final build (for every build)
-------------------------------------------

To build your extension run::

    ./vendor/bin/ezextbuilder build <myextension>

NB: every time the extension is built, a fresh version is retrieved from its svn/git repository. The local copy is not
used at all.

You can also execute the different steps of the build process one by one, as well as execute optional tasks, such as
generating QA reports of your code.

To get a list of all available tasks run::

    ./vendor/bin/ezextbuilder --tasks

5. Creating a packaged version of the extension (optional)
----------------------------------------------------------

An ezpackage is a file with the .ezpkg extension, that can contain different
types of eZ Publish contents and structures, and even complete extensions.
Packages can be used to easily share those things between different eZ Publish
installations, or for eg. backup purposes.

To create a packaged version of an extension, you only need to
1. produce an xml 'manifest' file describing your extension
2. tell to the ezextensionbuilder script to create the package

Step 1:
The xml manifest file must be named 'package.xml' and be avaialble in the root
directory of the extension.
NB: some of the tags in this file will be automatically updated during the 'build'
task, such as version number and licensing, so you do not need to worry about them.
The easiest way to create a package.xml file is to run the 'generate-sample-package-xml'
task, which will produce a sample file package.xml in the current directory, then
copy it to the appropriate directory and edit with the appropriate values.

Step 2:
It is sufficient to add the following settings to the yaml configuration file to
have the complete package built as part of the 'dist' task:
create:
    ezpackage: yes


More information
================

Read the README file and anything in the ./docs/ folder for more details
