protected function _cleanupAdminGenModules()
 {
     $fs = new sfFilesystem($this->getContext()->getEventDispatcher(), new sfFormatter());
     foreach ($this->_modules as $module) {
         $this->info('Removing admin gen module "' . $module . '"');
         $fs->execute('rm -rf ' . sfConfig::get('sf_app_module_dir') . '/' . $module);
     }
     $fs->execute('rm -rf ' . sfConfig::get('sf_test_dir') . '/functional/backend');
     $fs->execute('rm -rf ' . sfConfig::get('sf_data_dir') . '/*.sqlite');
 }
/**
 * @author Julien Muetton
 * @see http://www.symfony-project.org/blog/2009/06/10/new-in-symfony-1-3-project-creation-customization
 */
$fs = new sfFilesystem();
$this->logSection('install', 'default to propel');
$this->logSection('install', 'default to sqlite');
$this->runTask('configure:database', sprintf("'sqlite:%s/propel.db'", sfConfig::get('sf_data_dir')));
$this->logSection('install', 'fix sqlite database permissions');
touch(sfConfig::get('sf_data_dir') . '/propel.db');
chmod(sfConfig::get('sf_data_dir'), 0777);
chmod(sfConfig::get('sf_data_dir') . '/propel.db', 0777);
$this->logSection('install', 'install propel 1.6');
sfSymfonyPluginManager::disablePlugin('sfPropelPlugin', sfConfig::get('sf_config_dir'));
$fs->execute(sprintf('git clone http://github.com/propelorm/sfPropelORMPlugin.git %s/sfPropelORMPlugin', sfConfig::get('sf_plugins_dir')));
$fs->execute(sprintf('cd %s/sfPropelORMPlugin ; git submodule update --init --recursive ; cd -;', sfConfig::get('sf_plugins_dir')));
sfSymfonyPluginManager::enablePlugin('sfPropelORMPlugin', sfConfig::get('sf_config_dir'));
$this->logSection('install', 'setup propel behavior');
$ini_file = sfConfig::get('sf_config_dir') . '/propel.ini';
$content = file_get_contents($ini_file);
preg_replace('#^propel.behavior#', ';\\1', $content);
$content .= <<<EOF
propel.behavior.default                        = symfony,symfony_i18n
propel.behavior.symfony.class                  = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfony
propel.behavior.symfony_i18n.class             = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18n
propel.behavior.symfony_i18n_translation.class = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18nTranslation
propel.behavior.symfony_behaviors.class        = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfonyBehaviors
propel.behavior.symfony_timestampable.class    = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorTimestampable
EOF;
file_put_contents($ini_file, $content);
Beispiel #3
0
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * Outputs formatted Subversion log entries.
 *
 * Usage: php data/bin/changelog.php -r12345:67890 /branches/1.3
 *
 * @package    symfony
 * @author     Fabien Potencier <*****@*****.**>
 * @version    SVN: $Id$
 */
require_once __DIR__ . '/../../lib/task/sfFilesystem.class.php';
if (!isset($argv[1])) {
    echo "You must provide a revision range (-r123:456)\n";
    exit(1);
}
if (!isset($argv[2])) {
    echo "You must provide a repository path (/branches/1.4)\n";
    exit(1);
}
$filesystem = new sfFilesystem();
list($out, $err) = $filesystem->execute('svn info --xml');
$info = new SimpleXMLElement($out);
list($out, $err) = $filesystem->execute(vsprintf('svn log %s --xml %s', array_map('escapeshellarg', array($argv[1], (string) $info->entry->repository->root . $argv[2]))));
$log = new SimpleXMLElement($out);
foreach ($log->logentry as $logentry) {
    echo sprintf(' * [%d] %s', $logentry['revision'], trim(preg_replace('/\\s*\\[[\\d\\., ]+\\]\\s*/', '', (string) $logentry->msg)));
    echo PHP_EOL;
}
 /**
  * Calls lessc compiler for LESS file
  *
  * @param   string  $lessFile a LESS file
  * @param   string  $cssFile  a CSS file
  * 
  * @return  string            output
  */
 public function callLesscCompiler($lessFile, $cssFile)
 {
     // Setting current file. We will output this var if compiler throws error
     $this->currentFile = $lessFile;
     // Compile with lessc
     $fs = new sfFilesystem();
     $command = sprintf('lessc "%s" "%s"', $lessFile, $cssFile);
     if ('1.3.0' <= SYMFONY_VERSION) {
         try {
             $fs->execute($command, null, array($this, 'throwCompilerError'));
         } catch (RuntimeException $e) {
             return false;
         }
     } else {
         $fs->sh($command);
     }
     // Setting current file to null
     $this->currentFile = null;
     return file_get_contents($cssFile);
 }
Beispiel #5
0
 */
require_once __DIR__ . '/../../lib/exception/sfException.class.php';
require_once __DIR__ . '/../../lib/task/sfFilesystem.class.php';
require_once __DIR__ . '/../../lib/util/sfFinder.class.php';
require_once __DIR__ . '/../../lib/vendor/lime/lime.php';
if (!isset($argv[1])) {
    throw new Exception('You must provide version prefix.');
}
if (!isset($argv[2])) {
    throw new Exception('You must provide stability status (alpha/beta/stable).');
}
$stability = $argv[2];
$filesystem = new sfFilesystem();
if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $argv[1])) < 2) {
    $version_prefix = $argv[1];
    list($result) = $filesystem->execute('svn status -u ' . getcwd());
    if (preg_match('/Status against revision\\:\\s+(\\d+)\\s*$/im', $result, $match)) {
        $version = $match[1];
    }
    if (!isset($version)) {
        throw new Exception('Unable to find last SVN revision.');
    }
    // make a PEAR compatible version
    $version = $version_prefix . '.' . $version;
} else {
    $version = $argv[1];
}
print sprintf("Releasing symfony version \"%s\".\n", $version);
// tests
list($result) = $filesystem->execute('php data/bin/symfony symfony:test');
if (0 != $result) {
 /**
  * Calls lessc compiler for LESS file
  *
  * @param string $lessFile a LESS file
  * @param string $cssFile a CSS file
  * @return string output
  */
 public function callLesscCompiler($lessFile, $cssFile)
 {
     // Compile with lessc
     $fs = new sfFilesystem();
     $command = sprintf('lessc%s "%s" "%s"', $this->isUseGrowl() ? ' -g' : '', $lessFile, $cssFile);
     if ('1.3.0' <= SYMFONY_VERSION) {
         try {
             $fs->execute($command, null, array($this, 'throwCompilerError'));
         } catch (RuntimeException $e) {
             return false;
         }
     } else {
         $fs->sh($command);
     }
     return file_get_contents($cssFile);
 }
touch(sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR .'propel.db');
chmod(sfConfig::get('sf_data_dir'), 0777);
chmod(sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'propel.db', 0777);


$this->logSection('install', 'install propel 1.6');
sfSymfonyPluginManager::disablePlugin('sfPropelPlugin', sfConfig::get('sf_config_dir'));
$fs->mkdirs(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . 'sfPropelORMPlugin');

$root_dir = realpath(sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
$plugin_dir = realpath(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . 'sfPropelORMPlugin');

$finder = sfFinder::type('any')->ignore_version_control(false)->discard('mockproject')->prune('mockproject');
$fs->mirror($root_dir, $plugin_dir, $finder);

$fs->execute(sprintf('cd %s && git submodule update --init --recursive', $plugin_dir));
sfSymfonyPluginManager::enablePlugin('sfPropelORMPlugin', sfConfig::get('sf_config_dir'));

$this->logSection('install', 'setup propel behavior');
$ini_file = sfConfig::get('sf_config_dir'). DIRECTORY_SEPARATOR . 'propel.ini';
$content = file_get_contents($ini_file);
preg_replace('#^propel.behavior#', ';\1', $content);
$content .= <<<EOF
propel.behavior.default                        = symfony,symfony_i18n
propel.behavior.symfony.class                  = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorSymfony
propel.behavior.symfony_i18n.class             = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorI18n
propel.behavior.symfony_i18n_translation.class = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorI18nTranslation
propel.behavior.symfony_behaviors.class        = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorSymfonyBehaviors
propel.behavior.symfony_timestampable.class    = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorTimestampable
EOF;
Beispiel #8
0
 /**
  * Calls lessc compiler for LESS file
  *
  * @param   string  $lessFile a LESS file
  * @param   string  $cssFile  a CSS file
  *
  * @return  string            output
  */
 public function callLesscCompiler($lessFile, $cssFile)
 {
     // Setting current file. We will output this var if compiler throws error
     $this->currentFile = $lessFile;
     if (self::getConfig()->isUseLessphp()) {
         require_once sfConfig::get('sf_lib_dir') . '/vendor/lessphp/lessc.inc.php';
         $less = new lessc($lessFile);
         file_put_contents($cssFile, $less->parse());
     } else {
         // Compile with lessc
         $fs = new sfFilesystem();
         $command = sprintf('lessc "%s" "%s"', $lessFile, $cssFile);
         if ('1.3.0' <= SYMFONY_VERSION) {
             try {
                 $fs->execute($command, null, array($this, 'throwCompilerError'));
             } catch (RuntimeException $e) {
                 return false;
             }
         } else {
             $fs->sh($command);
         }
     }
     // Setting current file to null
     $this->currentFile = null;
     return file_get_contents($cssFile);
 }