// Include the core bootstrap, this will get the system functional. require_once(ROOT_PDIR . 'core/bootstrap.php'); if(!DEVELOPMENT_MODE){ die('Installation cannot proceed while site is NOT in Development mode.'); } // I need a few variables first about the user... $packagername = ''; $packageremail = ''; \Core\CLI\CLI::LoadSettingsFile('packager'); if(!$packagername){ $packagername = \Core\CLI\CLI::PromptUser('Please provide your name you wish to use for packaging', 'text-required'); } if(!$packageremail){ $packageremail = \Core\CLI\CLI::Promptuser('Please provide your email you wish to use for packaging.', 'text-required'); } \Core\CLI\CLI::SaveSettingsFile('packager', array('packagername', 'packageremail')); if(!is_dir(ROOT_PDIR . '_gen/')) mkdir(ROOT_PDIR . '_gen/'); $backend = Core::DB(); foreach($backend->_getTables() as $name){ if(strpos($name, '_') === false){
* Supplemental developer-only documentation * Random files useful for developers only * SASS/SCSS source files _You get the idea here._ ## SASS Assets One special use of this directory is for SASS/SCSS assets. Any `*.scss` or `*.sass` file located in `dev/assets/scss/*` will get compiled and minified to `assets/css/*`. EOF; if(\Core\CLI\CLI::PromptUser('Create standard directory structure?', 'bool', true)){ // Start making the directories and writing everything. foreach($directories as $d){ $dir = new \Core\Filestore\Backends\DirectoryLocal($dirname . $d); $dir->mkdir(); } file_put_contents($dirname . 'dev/README.md', $devreadme); } // I need to create a basic xml file for the component to use initially. $implementation = new DOMImplementation(); $dtd = $implementation->createDocumentType('component', 'SYSTEM', 'http://corepl.us/api/2_4/component.dtd');
file_put_contents($destdir . '/' . $desttgz . '/packages.html', $changelog); CLI::PrintHeader('Finalizing Bundling for ' . $b['name'] . ' ' . $version); // create the tarballs! CLI::PrintActionStart("Creating tarball"); //exec('tar -czf "' . $destdir . '/' . $desttgz . '.tgz" -C "' . $destdir . '" --exclude-vcs --exclude=*~ --exclude=._* ' . $desttgz); exec('tar -czf "' . $destdir . '/' . $desttgz . '.tgz" -C "' . $destdir . '/' . $desttgz . '" --exclude-vcs --exclude=*~ --exclude=._* .'); CLI::PrintActionStatus('ok'); CLI::PrintActionStart("Creating zip"); //exec('cd "' . $destdir . '/"; zip -rq "' . $desttgz . '.zip" "' . $desttgz . '"; cd -'); exec('cd "' . $destdir . '/' . $desttgz . '/"; zip -rq "../' . $desttgz . '.zip" .; cd -'); CLI::PrintActionStatus('ok'); CLI::PrintActionStart("Creating hashes"); exec('md5sum "' . $destdir . '/' . $desttgz . '.tgz" > "' . $destdir . '/' . $desttgz . '.tgz.md5"'); exec('md5sum "' . $destdir . '/' . $desttgz . '.zip" > "' . $destdir . '/' . $desttgz . '.zip.md5"'); CLI::PrintActionStatus('ok'); CLI::PrintActionStart("Cleaning up"); exec('rm -fr "' . $destdir . '/' . $desttgz . '"'); CLI::PrintActionStatus('ok'); } // Give the option to automatically commit and tag all changes for the component. if(CLI::PromptUser('Bundles created, GIT tag the release for ' . $version . '?', 'boolean', true)){ exec('git tag -m "Release Version ' . $version . '" -f ' . 'v' . str_replace('~', '-', $version)); exec('git push --tags'); }
/** * Set the 'EDITOR' variable to be set. * This is a linux-specific thing that svn shares also. * * The user will usually set their preferred EDITOR, be it vi/vim, emacs or nano. * If they didn't, ask the user for their choice. */ public static function RequireEditor() { global $previous_editor; // First, check the editor in the "session" file. \Core\CLI\CLI::LoadSettingsFile('editor'); if (isset($previous_editor)) $_SERVER['EDITOR'] = $previous_editor; if (!isset($_SERVER['EDITOR']) || $_SERVER['EDITOR'] == '') { // I need to assemble a list of editors currently on the system. $opts = array(); $default = false; if (($loc = trim(`which vi`))) $opts[$loc] = $loc; if (($loc = trim(`which vim`))) $opts[$loc] = $loc; if (($loc = trim(`which emacs`))) $opts[$loc] = $loc; if (($loc = trim(`which nano`))) { $opts[$loc] = $loc; $default = $loc; } $_SERVER['EDITOR'] = \Core\CLI\CLI::PromptUser( 'Which editor do you want to use for editing text files? If you are unsure, simply press enter if there is a default option.', $opts, $default ); // And remember this option. $previous_editor = $_SERVER['EDITOR']; \Core\CLI\CLI::SaveSettingsFile('editor', array('previous_editor')); } }
if(file_exists($destdir . 'repo.xml')){ // w00t, load it up and import the info! $repo = new RepoXML($destdir . 'repo.xml'); // Don't forget to remove any previous components! $repo->clearPackages(); } else{ // Just a new one works... $repo = new RepoXML(); } // Prompt the user if there's not information already set on the necessary ones. if(!$repo->getDescription()){ $desc = \Core\CLI\CLI::PromptUser('Please enter a short description for this repo.', 'textarea'); $repo->setDescription($desc); } // Load in the keys if not set. if(!sizeof($repo->getKeys())){ // Find and use the package maintainer's key. $out = array(); exec('gpg --homedir "' . GPG_HOMEDIR . '" --no-permission-warning --list-secret-keys', $out); $key = null; $currentkey = null; foreach($out as $line){ if(strpos($line, 'sec') === 0){ // Remember this ID for the next line, it may be the email. $currentkey = preg_replace('#^.*/([A-F0-9]*).*$#', '$1', $line); }
CLI::PrintActionStart('Saving ' . $packager->getLabel()); $packager->save(); CLI::PrintActionStatus('ok'); $saved = true; $saveopts = [ 'package-sign-commit' => 'Create signed package and GIT commit any changes', 'package-sign' => 'Create signed package', 'package' => 'Create unsigned package', 'commit' => 'GIT commit any changes', 'menu' => 'Do nothing else, back to menu', 'quit' => 'Do nothing else and exit script', ]; if(!sizeof($autostack)){ $saveans = CLI::PromptUser(ucfirst($packager->getLabel()) . ' saved, do you want to bundle the changes into a package?', $saveopts, 'menu'); // Append this operation onto the stack, to have it executed next. $autostack = array_merge([$saveans], $autostack); } break; case 'package': $bundle = $packager->package($packagername, $packageremail, false); echo "Created unsigned package of " . $packager->getLabel() . ' ' . $packager->getVersion() . NL . " as " . $bundle . NL; break 2; // Exit back to the menu. case 'package-sign': $bundle = $packager->package($packagername, $packageremail, true); echo "Created signed package of " . $packager->getLabel() . ' ' . $packager->getVersion() . NL . " as " . $bundle . NL; break 2; // Exit back to the menu. case 'package-sign-commit': $bundle = $packager->package($packagername, $packageremail, true); echo "Created signed package of " . $packager->getLabel() . ' ' . $packager->getVersion() . NL . " as " . $bundle . NL;