/** * Downloads source code in the build workspace directory, optionally checking out the given branch/tag */ function run_init($task = null, $args = array(), $cliOpts = array()) { // download the current version into the workspace $targetDir = Builder::workspaceDir(); // check if workspace exists and is not already set to the correct repo if (is_dir($targetDir) && pakeGit::isRepository($targetDir)) { $repo = new pakeGit($targetDir); $remotes = $repo->remotes(); if (trim($remotes['origin']['fetch']) != Builder::option('repo')) { throw new Exception("Directory '{$targetDir}' exists and is not linked to correct git repo"); } /// @todo should we not just fetch instead? $repo->pull(); } else { pake_mkdirs(dirname($targetDir)); $repo = pakeGit::clone_repository(Builder::option('repo'), Builder::workspaceDir()); } $repo->checkout(Builder::option('branch')); }
public static function pull_repo($repository_path) { $repo = new pakeGit($repository_path); $repo->pull(); return $repo; }
// this is unfortunately a necessary hack: ideally we would always check for // proper pake version, but version 0.1 of this extension was // shipped with a faulty pake_version, so we cannot check for required version // when using the bundled pake. // To aggravate things, version 0.1 did not upgrade the bundled pake when // upgrading to a new script, so we can not be sure that, even if the end user // updates to a newer pakefile, the bundled pake will be upgraded // (it will only be when the user does two consecutive updates) // Last but not least, when using a pake version installed via composer, that // also does not come with proper version tag... if (!(isset($GLOBALS['internal_pake']) && $GLOBALS['internal_pake'])) { pake_require_version(eZPCPBuilder\Builder::MIN_PAKE_VERSION); } // this should not be strictly needed, but it does not hurt if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { pakeGit::$needs_work_tree_workaround = true; } // *** declaration of the pake tasks *** // NB: up to pake 1.99.1 this will not work //pake_task( 'eZExtBuilder\GenericTasks::default' ); function run_default($task = null, $args = array(), $cliopts = array()) { eZPCPBuilder\Tasks::run_default($task, $args, $cliopts); } pake_task('default'); pake_task('eZPCPBuilder\\Tasks::show-properties'); pake_task('eZPCPBuilder\\Tasks::init'); pake_task('eZPCPBuilder\\Tasks::init-ci-repo'); pake_task('eZPCPBuilder\\Tasks::build', 'init', 'init-ci-repo', 'generate-upgrade-instructions', 'generate-changelog', 'wait-for-changelog', 'update-ci-repo', 'wait-for-continue', 'run-jenkins-build4', 'run-jenkins-build5'); pake_task('eZPCPBuilder\\Tasks::update-source'); pake_task('eZPCPBuilder\\Tasks::display-source-revision');