当前位置: 首页>>代码示例>>PHP>>正文


PHP pake_mkdirs函数代码示例

本文整理汇总了PHP中pake_mkdirs函数的典型用法代码示例。如果您正苦于以下问题:PHP pake_mkdirs函数的具体用法?PHP pake_mkdirs怎么用?PHP pake_mkdirs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pake_mkdirs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的pake_mkdirs函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。