本文整理汇总了PHP中pake_mkdirs函数的典型用法代码示例。如果您正苦于以下问题:PHP pake_mkdirs函数的具体用法?PHP pake_mkdirs怎么用?PHP pake_mkdirs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pake_mkdirs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run_init_app
function run_init_app($task, $args)
{
if (!count($args)) {
throw new Exception('You must provide your application name.');
}
$app = $args[0];
$sf_root_dir = sfConfig::get('sf_root_dir');
$app_dir = $sf_root_dir . '/' . sfConfig::get('sf_apps_dir_name') . '/' . $app;
if (is_dir($app_dir)) {
throw new Exception(sprintf('The directory "%s" already exists.', $app_dir));
}
// create basic application structure
$finder = pakeFinder::type('any')->ignore_version_control()->discard('.sf');
pake_mirror($finder, sfConfig::get('sf_symfony_data_dir') . '/skeleton/app/app', $app_dir);
// create $app.php or index.php if it is our first app
$index_name = 'index';
$first_app = file_exists(sfConfig::get('sf_web_dir') . '/index.php') ? false : true;
if (!$first_app) {
$index_name = $app;
}
// set no_script_name value in settings.yml for production environment
$finder = pakeFinder::type('file')->name('settings.yml');
pake_replace_tokens($finder, $app_dir . '/' . sfConfig::get('sf_app_config_dir_name'), '##', '##', array('NO_SCRIPT_NAME' => $first_app ? 'on' : 'off'));
pake_copy(sfConfig::get('sf_symfony_data_dir') . '/skeleton/app/web/index.php', sfConfig::get('sf_web_dir') . '/' . $index_name . '.php');
pake_copy(sfConfig::get('sf_symfony_data_dir') . '/skeleton/app/web/index_dev.php', sfConfig::get('sf_web_dir') . '/' . $app . '_dev.php');
$finder = pakeFinder::type('file')->name($index_name . '.php', $app . '_dev.php');
pake_replace_tokens($finder, sfConfig::get('sf_web_dir'), '##', '##', array('APP_NAME' => $app));
run_fix_perms($task, $args);
// create test dir
pake_mkdirs($sf_root_dir . '/test/functional/' . $app);
}
开发者ID:taryono,项目名称:school,代码行数:31,代码来源:sfPakeGenerator.php
示例2: emitFile
public static function emitFile($data, $file)
{
if (file_exists($file) and !is_writable($file)) {
throw new pakeException('Not enough rights to overwrite "' . $file . '"');
}
$dir = dirname($file);
pake_mkdirs($dir);
if (!is_writable($dir)) {
throw new pakeException('Not enough rights to create file in "' . $dir . '"');
}
if (extension_loaded('yaml')) {
// not yet implemented:
// yaml_emit_file($file, $data);
// so using this instead:
if (false === file_put_contents($file, yaml_emit($data))) {
throw new pakeException("Couldn't create file");
}
} else {
sfYaml::setSpecVersion('1.1');
// more compatible
$dumper = new sfYamlDumper();
if (false === file_put_contents($file, $dumper->dump($data, 1))) {
throw new pakeException("Couldn't create file");
}
}
pake_echo_action('file+', $file);
}
开发者ID:piotras,项目名称:pake,代码行数:27,代码来源:pakeYaml.class.php
示例3: run_alba_dump_data
/**
* La funcion original en dist/symfony/data/tasks/sfPakePropel.php
* NO FUNCIONA
* porque a la funcion dumpData() no se le pasan los parametros correctos
*
*
* Dumps yml database data to fixtures directory.
*
* @example symfony dump-data frontend data.yml
* @example symfony dump-data frontend data.yml dev
*
* @param object $task
* @param array $args
*/
function run_alba_dump_data($task, $args)
{
if (!count($args)) {
throw new Exception('You must provide the app.');
}
$app = $args[0];
if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) {
throw new Exception('The app "' . $app . '" does not exist.');
}
if (!isset($args[1])) {
throw new Exception('You must provide a filename.');
}
$filename = $args[1];
$env = empty($args[2]) ? 'dev' : $args[2];
// define constants
define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
define('SF_APP', $app);
define('SF_ENVIRONMENT', $env);
define('SF_DEBUG', true);
// get configuration
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
$databaseManager = new sfDatabaseManager();
$databaseManager->initialize();
if (!sfToolkit::isPathAbsolute($filename)) {
$dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'fixtures';
pake_mkdirs($dir);
$filename = $dir . DIRECTORY_SEPARATOR . $filename;
}
pake_echo_action('propel', sprintf('dumping data to "%s"', $filename));
$data = new sfPropelData();
// FIX de parametros
$data->dumpData($filename, 'all', 'alba');
}
开发者ID:mediasadc,项目名称:alba,代码行数:47,代码来源:alba.php
示例4: acquire
/**
* Returns true if the lock is acquired for the given token (no waiting here).
* A Write lock can only be acquired as long as there are no W or R locks.
* A Read lock can be acquired as long as there are no W locks.
* Does not not complain if 2 Read locks are taken on the same token by the same php script.
*
* @param string $token
* @param int $mode LOCK_SH (reader) or LOCK_EX (writer)
* @param array $opts
* @param bool $autoCleanup when true, on first lock acquired we remove any stale locks found
* @return bool
*/
public static function acquire($token, $mode, $opts = array(), $autoCleanup = true)
{
// just in case (is_file results might be cached!)...
clearstatcache();
if ($autoCleanup && !self::$cleanedUp) {
self::cleanup($opts);
self::$cleanedUp = true;
}
$lockDir = self::lockDir($opts);
$wLockFile = "{$lockDir}/{$token}_W.lock";
if (file_exists($wLockFile)) {
return false;
}
if ($mode == LOCK_EX && count(glob($lockDir . "/{$token}_R/*.lock"))) {
return false;
}
if ($mode == LOCK_EX) {
pake_mkdirs($lockDir);
if (!file_put_contents($wLockFile, getmypid(), LOCK_EX)) {
pake_echo_error("Could not create W lock file '{$wLockFile}'");
return false;
}
return true;
}
// assume a read lock
$rLockFile = "{$lockDir}/{$token}_R/" . getmypid() . ".lock";
pake_mkdirs("{$lockDir}/{$token}_R/");
// we assume to be running in single-thread mode: do not lock the file for writing
if (!file_put_contents($rLockFile, getmypid())) {
// log some error?
pake_echo_error("Could not create R lock file '{$wLockFile}'");
return false;
}
return true;
}
开发者ID:gggeek,项目名称:ezextensionbuilder,代码行数:47,代码来源:SharedLock.php
示例5: run_freeze
function run_freeze($task, $args)
{
// check that the symfony librairies are not already freeze for this project
if (is_readable(sfConfig::get('sf_lib_dir') . '/symfony')) {
throw new Exception('You can only freeze when lib/symfony is empty.');
}
if (is_readable(sfConfig::get('sf_data_dir') . '/symfony')) {
throw new Exception('You can only freeze when data/symfony is empty.');
}
if (is_readable(sfConfig::get('sf_web_dir') . '/sf')) {
throw new Exception('You can only freeze when web/sf is empty.');
}
if (is_link(sfConfig::get('sf_web_dir') . '/sf')) {
pake_remove(sfConfig::get('sf_web_dir') . '/sf', '');
}
$symfony_lib_dir = sfConfig::get('sf_symfony_lib_dir');
$symfony_data_dir = sfConfig::get('sf_symfony_data_dir');
pake_echo_action('freeze', 'freezing lib found in "' . $symfony_lib_dir . '"');
pake_echo_action('freeze', 'freezing data found in "' . $symfony_data_dir . '"');
pake_mkdirs(sfConfig::get('sf_lib_dir') . DIRECTORY_SEPARATOR . 'symfony');
pake_mkdirs(sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'symfony');
$finder = pakeFinder::type('any')->ignore_version_control();
pake_mirror($finder, $symfony_lib_dir, sfConfig::get('sf_lib_dir') . '/symfony');
pake_mirror($finder, $symfony_data_dir, sfConfig::get('sf_data_dir') . '/symfony');
pake_rename(sfConfig::get('sf_data_dir') . '/symfony/web/sf', sfConfig::get('sf_web_dir') . '/sf');
// change symfony paths in config/config.php
file_put_contents('config/config.php.bak', "{$symfony_lib_dir}#{$symfony_data_dir}");
_change_symfony_dirs("dirname(__FILE__).'/../lib/symfony'", "dirname(__FILE__).'/../data/symfony'");
// install the command line
pake_copy($symfony_data_dir . '/bin/symfony.php', 'symfony.php');
}
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:31,代码来源:sfPakeSymfony.php
示例6: package_pear_package
public static function package_pear_package($package_xml_path, $target_dir)
{
if (!file_exists($package_xml_path)) {
throw new pakeException('"' . $package_xml_path . '" file does not exist');
}
pake_mkdirs($target_dir);
$current = getcwd();
chdir($target_dir);
if (!class_exists('PEAR_Packager')) {
@(include 'PEAR/Packager.php');
if (!class_exists('PEAR_Packager')) {
// falling back to cli-call
$results = pake_sh('pear package ' . escapeshellarg($package_xml_path));
if ($task->is_verbose()) {
echo $results;
}
chdir($current);
return;
}
}
$packager = new PEAR_Packager();
$packager->debug = 0;
// silence output
$archive = $packager->package($package_xml_path, true);
pake_echo_action('file+', $target_dir . '/' . $archive);
chdir($current);
}
开发者ID:piotras,项目名称:pake,代码行数:27,代码来源:pakePearTask.class.php
示例7: copy_from_server
public function copy_from_server($src, $local_path)
{
if (is_string($src)) {
$src = array($src);
}
pake_mkdirs($local_path);
foreach ($src as &$remote_path) {
$remote_path = $this->login . '@' . $this->host . ':' . $remote_path;
}
pake_sh(escapeshellarg(pake_which('scp')) . ' -rC ' . implode(' ', array_map('escapeshellarg', $src)) . ' ' . escapeshellarg($local_path));
}
开发者ID:JasonWayne,项目名称:markdown-resume,代码行数:11,代码来源:pakeSSH.class.php
示例8: run_init_migration
function run_init_migration($task, $args)
{
if (count($args) == 0) {
throw new Exception('You must provide a migration name.');
}
if ($args[0]) {
$migrator = new sfMigrator();
if (!is_dir($migrator->getMigrationsDir())) {
pake_mkdirs($migrator->getMigrationsDir());
}
pake_echo_action('migrations', 'generating new migration stub');
$filename = $migrator->generateMigration($args[0]);
pake_echo_action('file+', $filename);
}
}
开发者ID:jcoby,项目名称:sfPropelMigrationsPlugin,代码行数:15,代码来源:sfPakePropelMigrationsLight.php
示例9: run_phpunit
function run_phpunit()
{
$cc_token = getenv('CODECLIMATE_REPO_TOKEN');
$cc = !empty($cc_token);
$clover = $cc ? ' --coverage-clover build/logs/clover.xml' : '';
$circle_test_reports = getenv('CIRCLE_TEST_REPORTS');
if (!empty($circle_test_reports)) {
pake_mkdirs($circle_test_reports);
$junit = " --log-junit {$circle_test_reports}/phpunit/junit.xml";
} else {
$junit = '';
}
print pake_sh('vendor/bin/phpunit' . $clover . $junit);
if ($cc && file_exists('build/logs/clover.xml')) {
print pake_sh('vendor/bin/test-reporter');
}
}
开发者ID:mscharley,项目名称:colourist,代码行数:17,代码来源:pakefile.php
示例10: run_compact
/**
* To be able to include a plugin in pake_runtime.php, you have to use include_once for external dependencies
* and require_once for internal dependencies (for other included PI or pake classes) because we strip
* all require_once statements
*/
function run_compact($task, $args)
{
$_root = dirname(__FILE__);
$options = pakeYaml::loadFile($_root . '/options.yaml');
$version = $options['version'];
pake_replace_tokens('lib/pake/pakeApp.class.php', $_root, 'const VERSION = \'', '\';', array('1.1.DEV' => "const VERSION = '{$version}';"));
// core-files
$files = array($_root . '/lib/pake/init.php', $_root . '/lib/pake/pakeFunction.php');
// adding pake-classes library
$files = array_merge($files, pakeFinder::type('file')->name('*.class.php')->maxdepth(0)->in($_root . '/lib/pake'));
// adding sfYaml library
$files = array_merge($files, pakeFinder::type('file')->name('*.php')->in($_root . '/lib/pake/sfYaml'));
$plugins = $args;
foreach ($plugins as $plugin_name) {
$files[] = $_root . '/lib/pake/tasks/pake' . $plugin_name . 'Task.class.php';
}
// starter
$files[] = $_root . '/bin/pake.php';
// merge all files
$content = '';
foreach ($files as $file) {
$content .= file_get_contents($file);
}
pake_replace_tokens('lib/pake/pakeApp.class.php', $_root, "const VERSION = '", "';", array($version => "const VERSION = '1.1.DEV';"));
// strip require_once statements
$content = preg_replace('/^\\s*require(?:_once)?[^$;]+;/m', '', $content);
// replace windows and mac format with unix format
$content = str_replace(array("\r\n"), "\n", $content);
// strip php tags
$content = preg_replace(array("/<\\?php/", "/<\\?/", "/\\?>/"), '', $content);
// replace multiple new lines with a single newline
$content = preg_replace(array("/\n\\s+\n/s", "/\n+/s"), "\n", $content);
$content = "#!/usr/bin/env php\n<?php\n" . trim($content) . "\n";
$target_dir = $_root . '/target';
pake_mkdirs($target_dir);
$target = $target_dir . '/pake';
if (!file_put_contents($target, $content)) {
throw new pakeException('Failed to write to "' . $target . '"');
}
pake_echo_action('file+', $target);
// strip all comments
pake_strip_php_comments($target);
pake_chmod('pake', $target_dir, 0755);
}
开发者ID:umonkey,项目名称:pake,代码行数:49,代码来源:pakefile.php
示例11: checkout
public static function checkout($src_url, $target_path)
{
pake_mkdirs($target_path);
if (self::isRepository($target_path)) {
throw new pakeException('"' . $target_path . '" directory is a Subversion repository already');
}
if (count(pakeFinder::type('any')->in($target_path)) > 0) {
throw new pakeException('"' . $target_path . '" directory is not empty. Can not checkout there');
}
pake_echo_action('svn checkout', $target_path);
if (extension_loaded('svn')) {
$result = svn_checkout($src_url, $target_path);
if (false === $result) {
throw new pakeException('Couldn\'t checkout "' . $src_url . '" repository');
}
} else {
pake_sh(escapeshellarg(pake_which('svn')) . ' checkout ' . escapeshellarg($src_url) . ' ' . escapeshellarg($target_path));
}
}
开发者ID:JasonWayne,项目名称:markdown-resume,代码行数:19,代码来源:pakeSubversion.class.php
示例12: clone_repository
public static function clone_repository($src_url, $target_path = null)
{
if (null === $target_path) {
// trying to "guess" path
$target_path = basename($src_url);
// removing suffix
if (substr($target_path, -3) === '.hg') {
$target_path = substr($target_path, 0, -3);
}
}
if (self::isRepository($target_path)) {
throw new pakeException('"' . $target_path . '" directory is a Mercurial repository already');
}
if (file_exists($target_path)) {
throw new pakeException('"' . $target_path . '" directory already exists. Can not clone Mercurial-repository there');
}
pake_mkdirs($target_path);
pake_sh('hg clone -q ' . escapeshellarg($src_url) . ' ' . escapeshellarg($target_path));
return new pakeMercurial($target_path);
}
开发者ID:piotras,项目名称:pake,代码行数:20,代码来源:pakeMercurial.class.php
示例13: run_dist_wpi
/**
* Creates the MS WPI
*/
public static function run_dist_wpi($task = null, $args = array(), $cliopts = array())
{
$opts = self::getOpts($args, $cliopts);
if ($opts['create']['mswpipackage']) {
pake_mkdirs($opts['dist']['dir']);
$toppath = $opts['build']['dir'] . '/release';
$rootpath = $toppath . '/' . self::getProjName();
if ($opts['create']['mswpipackage']) {
// add extra files to build
/// @todo move this to another phase/task... ?
/// @todo shall we check that there's no spurious file in $toppath?
$resourcesPath = self::getResourceDir();
pake_copy($resourcesPath . '/wpifiles/install.sql', $toppath . '/install.sql', array('override' => true));
/// @todo: if the $rootpath is different from "ezpublish", the manifest and parameters files need to be altered accordingly
/// after copying them to their location
pake_copy($resourcesPath . '/wpifiles/manifest.xml', $toppath . '/manifest.xml', array('override' => true));
pake_copy($resourcesPath . '/wpifiles/parameters.xml', $toppath . '/parameters.xml', array('override' => true));
// this one is overwritten
pake_copy($resourcesPath . '/wpifiles/kickstart.ini', $rootpath . '/kickstart.ini', array('override' => true));
if (is_file($rootpath . '/web.config-RECOMMENDED')) {
pake_copy($rootpath . '/web.config-RECOMMENDED', $rootpath . '/web.config', array('override' => true));
} else {
if (!is_file($rootpath . '/web.config')) {
pake_copy($resourcesPath . '/wpifiles/web.config', $rootpath . '/web.config', array('override' => true));
}
}
// create zip
/// @todo if name is empty do not add an extra hyphen
$filename = self::getProjFileName() . '-wpi.zip';
$target = $opts['dist']['dir'] . '/' . $filename;
self::archiveDir($toppath, $target, true);
// update feed file
$feedfile = 'ezpcpmswpifeed.xml';
pake_copy($resourcesPath . '/wpifiles/' . $feedfile, $opts['dist']['dir'] . '/' . $feedfile);
$files = pakeFinder::type('file')->name($feedfile)->maxdepth(0)->in($opts['dist']['dir']);
//pake_replace_regexp( $files, $opts['dist']['dir'], array(
//) );
pake_replace_tokens($files, $opts['dist']['dir'], '{', '}', array('$update_date' => gmdate('c'), '$version' => $opts['version']['alias'], '$sha1' => sha1_file($target), '$filename' => $filename, '$filesizeKB' => round(filesize($target) / 1024)));
}
}
}
开发者ID:gggeek,项目名称:ezpublishbuilder,代码行数:44,代码来源:MSWPITasks.php
示例14: sync_from_server
public static function sync_from_server($local_path, $server_host, $remote_paths, $rsync_login = '', $transport = 'ssh')
{
if (strlen($rsync_login) > 0) {
$rsync_login .= '@';
}
pake_mkdirs($local_path);
if (is_string($remote_paths)) {
// sync contents of dir, so adding trailing slash
if ($remote_paths[strlen($remote_paths) - 1] != '/') {
$remote_paths .= '/';
}
$remote_paths = array($remote_paths);
} elseif (is_array($remote_paths)) {
// syncing multiple objects, so removing trailing slashes
$remote_paths = array_map(create_function('$path', 'return rtrim($path, "/");'), $remote_paths);
}
foreach ($remote_paths as &$remote_path) {
$remote_path = $rsync_login . $server_host . ':' . $remote_path;
}
pake_sh('rsync -az -e ' . escapeshellarg($transport) . ' ' . implode(' ', array_map('escapeshellarg', $remote_paths)) . ' ' . escapeshellarg($local_path));
}
开发者ID:piotras,项目名称:pake,代码行数:21,代码来源:pakeRSync.class.php
示例15: init
public static function init($path, $template_path = null, $shared = false)
{
pake_mkdirs($path);
if (false === $shared) {
$shared = 'false';
} elseif (true === $shared) {
$shared = 'true';
} elseif (is_int($shared)) {
$shared = sprintf("%o", $shared);
}
$cmd = escapeshellarg(pake_which('git')) . ' init -q';
if (null !== $template_path) {
$cmd .= ' ' . escapeshellarg('--template=' . $template_path);
}
$cmd .= ' ' . escapeshellarg('--shared=' . $shared);
$cwd = getcwd();
chdir($path);
chdir('.');
// hack for windows. see http://docs.php.net/manual/en/function.chdir.php#88617
pake_sh($cmd);
chdir($cwd);
return new pakeGit($path);
}
开发者ID:rosko,项目名称:pake,代码行数:23,代码来源:pakeGit.class.php
示例16: _pear_init
function _pear_init()
{
// Remove E_STRICT from error_reporting
error_reporting(error_reporting() & ~E_STRICT);
require_once 'PEAR.php';
require_once 'PEAR/Frontend.php';
require_once 'PEAR/Config.php';
require_once 'PEAR/Registry.php';
require_once 'PEAR/Command.php';
require_once 'PEAR/Remote.php';
// current symfony release
$sf_version = preg_replace('/\\-\\w+$/', '', file_get_contents(sfConfig::get('sf_symfony_lib_dir') . '/VERSION'));
// PEAR
PEAR_Command::setFrontendType('CLI');
$ui =& PEAR_Command::getFrontendObject();
// read user/system configuration (don't use the singleton)
$config = new PEAR_Config();
$config_file = sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . '.pearrc';
// change the configuration for symfony use
$config->set('php_dir', sfConfig::get('sf_plugins_dir'));
$config->set('data_dir', sfConfig::get('sf_plugins_dir'));
$config->set('test_dir', sfConfig::get('sf_plugins_dir'));
$config->set('doc_dir', sfConfig::get('sf_plugins_dir'));
$config->set('bin_dir', sfConfig::get('sf_plugins_dir'));
// change the PEAR temp dir
$config->set('cache_dir', sfConfig::get('sf_cache_dir'));
$config->set('download_dir', sfConfig::get('sf_cache_dir'));
$config->set('tmp_dir', sfConfig::get('sf_cache_dir'));
// save out configuration file
$config->writeConfigFile($config_file, 'user');
// use our configuration file
$config =& PEAR_Config::singleton($config_file);
$config->set('verbose', 1);
$ui->setConfig($config);
date_default_timezone_set('UTC');
// register our channel
$symfony_channel = array('attribs' => array('version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd'), 'name' => 'pear.symfony-project.com', 'summary' => 'symfony project PEAR channel', 'suggestedalias' => 'symfony', 'servers' => array('primary' => array('rest' => array('baseurl' => array(array('attribs' => array('type' => 'REST1.0'), '_content' => 'http://pear.symfony-project.com/Chiara_PEAR_Server_REST/'), array('attribs' => array('type' => 'REST1.1'), '_content' => 'http://pear.symfony-project.com/Chiara_PEAR_Server_REST/'))))), '_lastmodified' => array('ETag' => "113845-297-dc93f000", 'Last-Modified' => date('r')));
pake_mkdirs(sfConfig::get('sf_plugins_dir') . '/.channels/.alias');
file_put_contents(sfConfig::get('sf_plugins_dir') . '/.channels/pear.symfony-project.com.reg', serialize($symfony_channel));
file_put_contents(sfConfig::get('sf_plugins_dir') . '/.channels/.alias/symfony.txt', 'pear.symfony-project.com');
// register symfony for dependencies
$symfony = array('name' => 'symfony', 'channel' => 'pear.symfony-project.com', 'date' => date('Y-m-d'), 'time' => date('H:i:s'), 'version' => array('release' => $sf_version, 'api' => '1.0.0'), 'stability' => array('release' => 'stable', 'api' => 'stable'), 'xsdversion' => '2.0', '_lastmodified' => time(), 'old' => array('version' => $sf_version, 'release_state' => 'stable'));
$dir = sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . '.registry' . DIRECTORY_SEPARATOR . '.channel.pear.symfony-project.com';
pake_mkdirs($dir);
file_put_contents($dir . DIRECTORY_SEPARATOR . 'symfony.reg', serialize($symfony));
return $config;
}
开发者ID:taryono,项目名称:school,代码行数:47,代码来源:sfPakePlugins.php
示例17: run_dist
/**
* Creates the tarballs for a release
*/
function run_dist($task = null, $args = array(), $cliOpts = array())
{
// copy workspace dir into dist dir, without git
pake_mkdirs(Builder::distDir());
$finder = pakeFinder::type('any')->ignore_version_control();
pake_mirror($finder, realpath(Builder::workspaceDir()), realpath(Builder::distDir()));
// remove unwanted files from dist dir
// also: do we still need to run dos2unix?
// create tarballs
$cwd = getcwd();
chdir(dirname(Builder::distDir()));
foreach (Builder::distFiles() as $distFile) {
// php can not really create good zip files via phar: they are not compressed!
if (substr($distFile, -4) == '.zip') {
$cmd = Builder::tool('zip');
$extra = '-9 -r';
pake_sh("{$cmd} {$distFile} {$extra} " . basename(Builder::distDir()));
} else {
$finder = pakeFinder::type('any')->pattern(basename(Builder::distDir()) . '/**');
// see https://bugs.php.net/bug.php?id=58852
$pharFile = str_replace(Builder::libVersion(), '_LIBVERSION_', $distFile);
pakeArchive::createArchive($finder, '.', $pharFile);
rename($pharFile, $distFile);
}
}
chdir($cwd);
}
开发者ID:shahzadsab,项目名称:phpxmlrpc,代码行数:30,代码来源:pakefile.php
示例18: run_dist_init
/**
* Downloads the build tarballs from Jenkins for further repackaging; options: --build=<buildnr>
*/
public static function run_dist_init($task = null, $args = array(), $cliopts = array())
{
$opts = self::getOpts($args, $cliopts);
$buildnr = @$cliopts['build'];
if ($buildnr == '') {
pake_echo('Fetching latest available build');
$buildnr = 'lastBuild';
}
// get list of files from the build
$out = self::jenkinsCall('job/' . $opts['jenkins']['jobs']['community'] . '/' . $buildnr . '/api/json', $opts);
if (!is_array($out) || !is_array(@$out['artifacts'])) {
pake_echo('Error in retrieving build description from Jenkins or no artifacts in build');
return;
} else {
if ($buildnr == 'lastBuild') {
pake_echo('Found build ' . $out['number']);
}
}
// find the correct variant
//$buildurl = self::jenkinsUrl( 'job/' . $opts['jenkins']['jobs']['community'] . '/' . $buildnr, $opts );
$fileurl = '';
foreach ($out['artifacts'] as $artifact) {
if (substr($artifact['fileName'], -4) == '.bz2') {
$fileurl = 'job/' . $opts['jenkins']['jobs']['community'] . '/' . $buildnr . '/artifact/' . $artifact['relativePath'];
break;
}
}
if ($fileurl == '') {
pake_echo("No artifacts available for build {$buildnr}");
return;
}
// clean up the 'release' dir
$rootpath = $opts['build']['dir'] . '/release';
/// @todo this method is a bit slow, should find a faster one
pake_remove_dir($rootpath);
// download and unzip the file
pake_mkdirs($rootpath);
$filename = $rootpath . '/' . $artifact['fileName'];
pake_write_file($filename, self::jenkinsCall($fileurl, $opts, 'GET', null, false), 'cpb');
// and unzip eZ into it - in a folder with a specific name
$tar = self::getTool('tar', $opts);
pake_sh(self::getCdCmd($rootpath) . " && {$tar} -xjf " . escapeshellarg($artifact['fileName']));
$currdir = pakeFinder::type('directory')->in($rootpath);
$currdir = $currdir[0];
$finaldir = $rootpath . '/' . self::getProjName();
pake_rename($currdir, $finaldir);
pake_echo("dir+ " . $finaldir);
}
开发者ID:gggeek,项目名称:ezpublishbuilder,代码行数:51,代码来源:Tasks.php
示例19: run_generate_md5sums
/**
* Creates a share/filelist.md5 file, with the checksum of all files in the build.
*
* This task is only run if in the configuration file md5 creation is specified.
*/
static function run_generate_md5sums($task = null, $args = array(), $cliopts = array())
{
$opts = self::getOpts(@$args[0], @$args[1], $cliopts);
if ($opts['create']['filelist_md5']) {
if (!SharedLock::acquire($opts['extension']['name'], LOCK_EX, $opts)) {
throw new PakeException("Source code locked by another process");
}
$destdir = self::getBuildDir($opts) . '/' . $opts['extension']['name'];
// make sure we do not add to checksum file the file itself
@unlink($destdir . '/share/filelist.md5');
$files = pakeFinder::type('file')->in($destdir);
$out = array();
$rootpath = pakeFinder::type('directory')->name($opts['extension']['name'])->in(self::getBuildDir($opts));
foreach ($files as $file) {
$out[] = md5_file($file) . ' ' . ltrim(str_replace(array($rootpath[0], '\\'), array('', '/'), $file), '/');
}
pake_mkdirs($destdir . '/share');
file_put_contents($destdir . '/share/filelist.md5', implode("\n", $out));
pake_echo_action('file+', $destdir . '/share/filelist.md5');
SharedLock::release($opts['extension']['name'], LOCK_EX, $opts);
}
}
开发者ID:gggeek,项目名称:ezextensionbuilder,代码行数:27,代码来源:BuildTasks.php
示例20: extractArchive
public static function extractArchive($archive_file, $target_dir, $overwrite = false, $files = null)
{
if (!extension_loaded('phar')) {
throw new pakeException(__CLASS__ . ' module requires "phar" extension');
}
pake_mkdirs($target_dir);
pake_echo_action('extract', $archive_file);
$arc = new PharData($archive_file);
$arc->extractTo($target_dir, $files, $overwrite);
}
开发者ID:otis22,项目名称:reserve-copy-system,代码行数:10,代码来源:pake.php
注:本文中的pake_mkdirs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论