function canPiston() { $errors = array(); if (!SVN::available()) { $errors[] = "Subversion is not available."; } if (!Piston::available()) { $errors[] = "Piston is not available."; } if (!SVN::isSVNRepo() && !GIT::isGITRepo()) { $errors[] = "Piston only works on svn working copies and git repositories."; } return $errors; }
} // Check we're not being re-called before we do anything $alreadyexists = false; foreach ($template as $dest => $source) { if (file_exists($dest)) { echo "ERROR: Module $dest already exists. This script can not be called multiple times, or upgrade existing modules.\n"; $alreadyexists = true; } } if ($alreadyexists) die; if ($mode == 'piston') { echo "Now running piston to add modules. Piston is quite noisy, and can sometimes list errors as fatal that can be ignored.\n"; echo "If errors are shown, please check result before assuming failure\n\n"; } foreach ($template as $dest => $source) { if ($mode == 'contribute') { GIT::ignore($dest); $source->checkout($dest); } else if ($mode == 'piston') $source->piston($dest); else $source->export($dest); } if ($mode == 'piston' && GIT::isGITRepo()) { echo "\n\nNow commit the changes with something like \"git commit -m 'Import core SilverStripe modules'\"\n"; }