-
Notifications
You must be signed in to change notification settings - Fork 10
Home
This build environment makes use of Phing to provide management in a few key areas
- Required module management
- Module version management
- Module dependency management
- Patch management for externally maintained packages
- Various packaging options - Full developer environment, deployment packages for new site installations, update packages containing module + mysite updates, individual module packaging
- Server deployment over SSH (See the Deployment page for more information about setting this up)
- Tweaked testing structure to allow for better integration with Hudson (and other CI tools)
Some of the important phing targets that can be executed
- build - Retrieves all dependent modules (or updates them if they already exist), applies any relevant patches, and runs dev/build
- test - Executes all unit tests. You can run tests just for a single module by passing a module name, ie phing test -Dmodule=mysite. You can also optionally pass a single test case to run, eg phing test -Dmodule=mysite -Dtestcase=MyTest
- phing-package - Creates a complete copy of this development environment repository that can be passed to another person, retaining all SVN and Git information
- update-package - Creates a package that excludes several diretories that can be used for extracting over the top of existing installs
- backup - Takes a database dump of the site before packaging
- pak - creates a mysite/build/site.sspak file of the current site state
- unpak - restores the site to that of the mysite/build/site.sspak file
You can create a new project by using composer as follows
composer create-project -s dev symbiote/silverstripe-base {your_project_name}
This will create the project ready for development.
Alternatively, git clone the repository and delete the .git folder
- Edit the build.xml file and change the project name from rename-me to something more accurate
- Edit the composer.json and add in any additional modules you may need
- Run phing, which will fetch all needed modules and run a dev/build for the first time
- Note that depending on your environment setup, you may need to update the database details in .env
In some cases you will want to provide custom patches to dependent modules. As these can't be committed back to this project's repository, a mechanism exists to include just the .patch diffs. Create a diff from the root directory of your project. Drop any diffs into build/patches, and these will be applied during the build target.
For example
svn diff sapphire/ > build/patches/sapphire.patch
Git creates patches slightly differently - in this case, you need to create the patch from the module folder, and you'll need to explicitly tell it the module name when creating
git diff --src-prefix=modulename/ --dst-prefix=modulename/ > ../build/patches/modulename.patch
which will prefix things appropriately for when the patch is created.
An example test config that allows for executing tests a little faster
Create test-assist/testing.conf.php with something like
<?php
global $TESTING_CONFIG;
$TESTING_CONFIG = array(
"database" => "ss_tmpdb_silverstripe_testing",
"reporter" => "CliTestReporter",
"logfile" => "test-assist/logs/testsuite.xml",
'type' => 'SQLite3Database',
'path' => ASSETS_PATH . '/.sqlitedb/',
'key' => 'SQLite3DatabaseKey',
'memory' => false
);
To run completely in memory, change the 'memory' option to 'true'.
Instead of running in memory, you can also pass build=0 as a URL parameter (or on the command line) to skip rebuilding the database.