From 316bda2c023d6cb099a88be59dbf0c2441cf095f Mon Sep 17 00:00:00 2001 From: thewilkybarkid <chriswilkinson84@gmail.com> Date: Thu, 26 Sep 2013 13:36:20 +0100 Subject: [PATCH] Add make script --- .gitignore | 6 +- README.md | 58 ++++-- composer.json | 7 + composer.lock | 185 ++++++++++++++++++ drush_windows_git_apply.patch | 17 ++ make.php | 75 +++++++ .../cambridge/cambridge.info | 0 .../cambridge/cambridge.install | 0 .../cambridge/cambridge.make | 2 +- .../cambridge/cambridge.profile | 0 cambridge_base.inc => src/cambridge_base.inc | 0 .../cambridge_lite/cambridge_lite.info | 0 .../cambridge_lite/cambridge_lite.install | 0 .../cambridge_lite/cambridge_lite.make | 0 .../cambridge_lite/cambridge_lite.profile | 0 15 files changed, 329 insertions(+), 21 deletions(-) create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 drush_windows_git_apply.patch create mode 100644 make.php rename cambridge.info => src/cambridge/cambridge.info (100%) rename cambridge.install => src/cambridge/cambridge.install (100%) rename cambridge.make => src/cambridge/cambridge.make (95%) rename cambridge.profile => src/cambridge/cambridge.profile (100%) rename cambridge_base.inc => src/cambridge_base.inc (100%) rename cambridge_lite.info => src/cambridge_lite/cambridge_lite.info (100%) rename cambridge_lite.install => src/cambridge_lite/cambridge_lite.install (100%) rename cambridge_lite.make => src/cambridge_lite/cambridge_lite.make (100%) rename cambridge_lite.profile => src/cambridge_lite/cambridge_lite.profile (100%) diff --git a/.gitignore b/.gitignore index c581f0b..dec8f20 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -libraries -modules -themes +build +composer.phar +vendor diff --git a/README.md b/README.md index 26f23a7..a4585ad 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,57 @@ University of Cambridge Drupal 7 install profiles ================================================= -There are two different install profiles provided: +There are two different install profiles available: -- University of Cambridge -- University of Cambridge (lite) +- **cambridge_lite** -Lite profile ------------- + In the lite profile the University of Cambridge theme is enabled and a few standard pieces are set up (eg images styles, front-page carousel). -In the lite profile the University of Cambridge theme is enabled and a few standard pieces are set up (eg images styles, front-page carousel). + This profile is useful if you would like full control over how your Drupal site is put together. -This profile is useful if you would like full control over how your Drupal site is put together. +- **cambridge** -To build the lite profile execute: + The full profile contains all the features of the lite profile, plus additions that helps you to quickly get going: various common modules are enabled and pre-configured to sensible defaults, while other common-but-not-always-used modules are bundled but not enabled. - drush make --no-core --contrib-destination=. cambridge_lite.make . + This profile is useful if you don't mind following established patterns when putting your Drupal site together. -And remove the `cambridge.info`, `cambridge.install`, `cambridge.make` and `cambridge.profile` files. +Build process +------------- -Full profile ------------- +### Installing dependencies -The full profile contains all the features of the lite profile, plus additions that helps you to quickly get going: various common modules are enabled and pre-configured to sensible defaults, while other common-but-not-always-used modules are bundled but not enabled. +#### *nix -This profile is useful if you don't mind following established patterns when putting your Drupal site together. +The build process requires [Composer](http://getcomposer.org/). You can install this by executing: -To build the full profile execute: + curl -sS https://getcomposer.org/installer | php - drush make --no-core --contrib-destination=. cambridge.make . +Then install the dependencies. -And remove the `cambridge_lite.info` and `cambridge_lite.profile` files. + php composer.phar install + +#### Windows + +Use the [Windows installer](http://getcomposer.org/doc/00-intro.md#installation-windows) to make Composer globally available. + +Then install the dependencies: + + composer install + +Finally, you'll also need to execute: + + git apply drush_windows_git_apply.patch + +This fixes a long-term bug in Drush that stops patches from being applied. + +### Building the profiles + +To build the profiles simply execute: + + php make.php + +The `build` folder will now contain distributable ZIP/TAR files for each profile, as well as source directories. + +To build a single profile you can just pass the profile's name: + + php make.php cambridge_lite \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..c43c386 --- /dev/null +++ b/composer.json @@ -0,0 +1,7 @@ +{ + "require": { + "drush/drush": "~6.0", + "symfony/filesystem": "~2.3", + "symfony/process": "~2.3" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..e9ea645 --- /dev/null +++ b/composer.lock @@ -0,0 +1,185 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + ], + "hash": "4b5db3082f76ca70ac604aaa5cc5e7c3", + "packages": [ + { + "name": "drush/drush", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/drush-ops/drush.git", + "reference": "6ff849b5d0807c4c4a39afeed28b9aa2dbc6de5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/drush-ops/drush/zipball/6ff849b5d0807c4c4a39afeed28b9aa2dbc6de5e", + "reference": "6ff849b5d0807c4c4a39afeed28b9aa2dbc6de5e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": ">=3.5" + }, + "bin": [ + "drush", + "drush.php", + "drush.bat", + "drush.complete.sh" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPLv2" + ], + "authors": [ + { + "name": "Moshe Weitzman", + "email": "weitzman@tejasa.com" + }, + { + "name": "Owen Barton", + "email": "drupal@owenbarton.com" + }, + { + "name": "Mark Sonnabaum", + "email": "marksonnabaum@gmail.com" + }, + { + "name": "Antoine Beaupré", + "email": "anarcat@koumbit.org" + }, + { + "name": "Greg Anderson", + "email": "greg.1.anderson@greenknowe.org" + }, + { + "name": "Jonathan Araña Cruz", + "email": "jonhattan@faita.net" + }, + { + "name": "Jonathan Hedstrom", + "email": "jhedstrom@gmail.com", + "homepage": "http://professorbikeybike.com" + } + ], + "description": "Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.", + "homepage": "http://www.drush.org", + "time": "2013-08-16 02:47:29" + }, + { + "name": "symfony/filesystem", + "version": "v2.3.4", + "target-dir": "Symfony/Component/Filesystem", + "source": { + "type": "git", + "url": "https://github.com/symfony/Filesystem.git", + "reference": "87acbbef6d35ba649f96f09cc572c45119b360c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/87acbbef6d35ba649f96f09cc572c45119b360c3", + "reference": "87acbbef6d35ba649f96f09cc572c45119b360c3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Filesystem\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "http://symfony.com", + "time": "2013-07-21 12:12:18" + }, + { + "name": "symfony/process", + "version": "v2.3.4", + "target-dir": "Symfony/Component/Process", + "source": { + "type": "git", + "url": "https://github.com/symfony/Process.git", + "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Process/zipball/1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", + "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Process\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "http://symfony.com", + "time": "2013-08-22 06:42:25" + } + ], + "packages-dev": [ + + ], + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": [ + + ], + "platform": [ + + ], + "platform-dev": [ + + ] +} diff --git a/drush_windows_git_apply.patch b/drush_windows_git_apply.patch new file mode 100644 index 0000000..176d07e --- /dev/null +++ b/drush_windows_git_apply.patch @@ -0,0 +1,17 @@ +diff --git a/vendor/drush/drush/commands/make/make.project.inc b/vendor/drush/drush/commands/make/make.project.inc +index 4f77e27..6d2fdc8 100644 +--- a/vendor/drush/drush/commands/make/make.project.inc ++++ b/vendor/drush/drush/commands/make/make.project.inc +@@ -258,10 +258,10 @@ class DrushMakeProject { + // http://drupal.org/node/1054616 + $patch_levels = array('-p1', '-p0'); + foreach ($patch_levels as $patch_level) { +- $checked = drush_shell_exec('cd %s && GIT_DIR=. git apply --check %s %s --verbose', $project_directory, $patch_level, $filename); ++ $checked = drush_shell_exec('cd %s && git --bare apply --check %s %s --verbose', $project_directory, $patch_level, $filename); + if ($checked) { + // Apply the first successful style. +- $patched = drush_shell_exec('cd %s && GIT_DIR=. git apply %s %s --verbose', $project_directory, $patch_level, $filename); ++ $patched = drush_shell_exec('cd %s && git --bare apply %s %s --verbose', $project_directory, $patch_level, $filename); + break; + } + } diff --git a/make.php b/make.php new file mode 100644 index 0000000..2add061 --- /dev/null +++ b/make.php @@ -0,0 +1,75 @@ +<?php + +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Process\Process; + +require_once __DIR__ . '/vendor/autoload.php'; + +umask(0002); + +$fs = new Filesystem(); + +$src = __DIR__ . '/src'; +$build = __DIR__ . '/build'; +$drush = __DIR__ . '/vendor/drush/drush/drush.php'; +$tmp = sys_get_temp_dir() . '/cambridge-drupal-' . uniqid(); + +$fs->remove($build); + +$arguments = array_slice($argv, 1); + +$profiles = array( + 'cambridge', + 'cambridge_lite', +); + +if (count($arguments) > 0) { + foreach ($arguments as $argument) { + if (FALSE === in_array($argument, $profiles)) { + throw new Exception('Unknown profile \'' . $argument . '\''); + } + } + + $profiles = $arguments; +} + +foreach ($profiles as $profile) { + $profileSrc = $src . '/' . $profile; + + $info = parse_ini_file($profileSrc . '/' . $profile . '.info'); + + $make = new Process('php ' . $drush . ' make --no-core --contrib-destination=. ' . $profileSrc . '/' . $profile . '.make ' . $tmp . '/' . $profile); + + $make->setTimeout(NULL); + + if ($make->run() > 0) { + throw new Exception('Failed to run command: ' . $make->getCommandLine()); + } + + $filesets = array( + $profileSrc => array( + $profile . '.info', + $profile . '.install', + $profile . '.profile' + ), + $src => array('cambridge_base.inc'), + ); + + foreach ($filesets as $fileDir => $files) { + foreach ($files as $file) { + $fs->copy($fileDir . '/' . $file, $build . '/src/' . $profile . '/' . $file); + } + } + + $fs->mirror($tmp . '/' . $profile, $build . '/src/' . $profile); + + $tar = new PharData($tmp . '/' . $profile . '.tar'); + $tar->buildFromDirectory($build . '/src/' . $profile); + $tar->compress(Phar::GZ); + + $zip = new PharData($tmp . '/' . $profile . '.zip'); + $zip->buildFromDirectory($build . '/src/' . $profile); + + $fs->copy($tmp . '/' . $profile . '.tar.gz', $build . '/dist/' . $profile . '-' . $info['version'] . '.tar.gz'); + $fs->copy($tmp . '/' . $profile . '.zip', $build . '/dist/' . $profile . '-' . $info['version'] . '.zip'); +} diff --git a/cambridge.info b/src/cambridge/cambridge.info similarity index 100% rename from cambridge.info rename to src/cambridge/cambridge.info diff --git a/cambridge.install b/src/cambridge/cambridge.install similarity index 100% rename from cambridge.install rename to src/cambridge/cambridge.install diff --git a/cambridge.make b/src/cambridge/cambridge.make similarity index 95% rename from cambridge.make rename to src/cambridge/cambridge.make index a668889..da7055a 100644 --- a/cambridge.make +++ b/src/cambridge/cambridge.make @@ -1,7 +1,7 @@ api = 2 core = 7.x -includes[cambridge_lite] = "cambridge_lite.make" +includes[cambridge_lite] = "../cambridge_lite/cambridge_lite.make" ; contrib diff --git a/cambridge.profile b/src/cambridge/cambridge.profile similarity index 100% rename from cambridge.profile rename to src/cambridge/cambridge.profile diff --git a/cambridge_base.inc b/src/cambridge_base.inc similarity index 100% rename from cambridge_base.inc rename to src/cambridge_base.inc diff --git a/cambridge_lite.info b/src/cambridge_lite/cambridge_lite.info similarity index 100% rename from cambridge_lite.info rename to src/cambridge_lite/cambridge_lite.info diff --git a/cambridge_lite.install b/src/cambridge_lite/cambridge_lite.install similarity index 100% rename from cambridge_lite.install rename to src/cambridge_lite/cambridge_lite.install diff --git a/cambridge_lite.make b/src/cambridge_lite/cambridge_lite.make similarity index 100% rename from cambridge_lite.make rename to src/cambridge_lite/cambridge_lite.make diff --git a/cambridge_lite.profile b/src/cambridge_lite/cambridge_lite.profile similarity index 100% rename from cambridge_lite.profile rename to src/cambridge_lite/cambridge_lite.profile -- GitLab