baskit - PHP Build Environment
Using baskit you can create a build environment separate from your system, that uses your system installed PHP, but with it's own dependencies (e.g. specific versions of PEAR installable packages), and run automated build tasks against this environment with Phing.
The requirements for baskit are:
- PHP v5.0+
- PEAR (not PEAR2, but maybe in the future)
- A Unix shell like bash or zsh (in the future it should be easy to support others, like CMD or PowerShell on Windows)
Using Git submodules
git submodule add https://github.com/isotoma/baskit.git baskit git commit -m 'Added baskit' # You probably want a specific version cd baskit git checkout 1.0.3 cd .. git add baskit git commit -m 'Switched to baskit 1.0.3'
When you come to bootstrap your environment you would reference the
baskit script as being in
e.g. in your project base you would run
Using Subversion externals
svn propget svn:externals . > /tmp/baskit_svn_externals echo "baskit https://svn.github.com/isotoma/baskit.git" >> /tmp/baskit_svn_externals svn propset svn:externals -F /tmp/baskit_svn_externals svn ci -m 'Added baskit' svn up
Caveat emptor: Because this is a checkout from Github's SVN mirroring service, there is no support for pinning to
branches or tags, so using this you'd be stuck with whatever is at
You can pin the external to a specific comit in the Github virtual SVN repo, e.g.:
baskit -r 100 https://svn.github.com/isotoma/baskit.git
However you'll have to work out which commit to pin to yourself as it would be very difficult to update this document every release with the correct revision reported by svn.github.com.
To install using system installed PEAR:
sudo pear channel-discover baskit.h.isotoma.com sudo pear install baskit/baskit
To install locally only, drop
pear channel-discover baskit.h.isotoma.com pear install baskit/baskit
Then you should be able to run from anywhere as a system command:
If this doesn't work you may need to run from PHP:
Using the Debian/Ubuntu package
curl -C - -O https://github.com/isotoma/baskit/downloads/baskit-1.0.3-1_all.deb sudo dpkg -i baskit-1.0.3-1_all.deb
Using the Fedora/Redhat/CentOS package
curl -C - -O https://github.com/isotoma/baskit/downloads/baskit-1.0.3.noarch.rpm sudo yum install baskit-1.0.0.noarch.rpm
To create a new environment run the
baskit script in your project base dir, e.g.
if installed via PEAR, Deb or RPM:
Or if you've copied in via Git or SVN:
Which will give you a
./bin directory with scripts for PEAR, Phing and PHP:
bin/pear version bin/phing -version bin/php -v # This will install PEAR's Net_URL2 into the local build environment bin/pear install Net_URL2
./parts directory containing PEAR itself:
To make building your project and installing dependencies easier and more maintainable, baskit includes some Phing tasks and targets:
- PearInstallTask - A Phing task to install a depenedency into the local PEAR sandbox, also supports installing custom PEAR channels.
- PhpMigrateTask - A version of the core Phing DbDeployTask that allows running migrations written in PHP rather than SQL, you can use this yourself or use the pre-written
migrations.xmltarget (see Phing Targets).
- install_requirements.xml - Installs a list of non-PEAR dependencies from web URLs, with version checking, caching and support for zips and gzipped tars.
- migrations.xml - Target for deploying all undeployed SQL and PHP database migrations (currently missing "undo" target for reverting to previous migration)..
- wordpress.xml - Target for installing a Wordpress blog from scratch, and any Wordpress plugins, with version checking and caching.
- apache.xml - Convenience target for generating an Apache2 virtualhost conf file in
For a more information on using the baskit Phing build components take a look at the example project in
Building baskit yourself
baskit can be installed via a number of different packaging forms, as well as used directly from the PHP/XML source, to generate these packages yourself (such as the PEAR package or RPM) you can use baskit to bootstrap and build itself from a checkout:
git checkout https://github.com/isotoma/baskit.git cd baskit ./baskit bin/phing # You can also build a specific package by naming one of the following targets # build_pear # build_deb # build_rpm # e.g. bin/phing build_rpm
The Debian and RPM targets require some system packages to be present, e.g. on a Debian/Ubuntu system we would install:
sudo apt-get install dpkg-dev dh-make rpm