public static function import_default_tasks()
 {
     pake_desc('Display help on available commands');
     pake_task('pakeInteractiveTask::help_pake');
     pake_alias('?', 'pakeInteractiveTask::help_pake');
     pake_desc('Quit interactive mode');
     pake_task('pakeInteractiveTask::quit_pake');
 }
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 */
/**
 * @package    
 * @subpackage Task per importare atti in openparlamento
 * @author     Guglielmo Celata <*****@*****.**>
 */
pake_desc("import ddl a partire da file yaml");
pake_task('opp-import-ddl-from-yaml', 'project_exists');
pake_desc("update ddl a partire da file yaml");
pake_task('opp-update-ddl-from-yaml', 'project_exists');
pake_desc("prepara uno o più ddl per l'upgrade test");
pake_task('opp-prepare-ddl-for-test', 'project_exists');
/**
 * Importa dei ddl a partire da un file yaml
 */
function run_opp_import_ddl_from_yaml($task, $args, $options)
{
    static $loaded;
    // load application context
    if (!$loaded) {
        _loader();
    }
    $dry_run = false;
    if (array_key_exists('dry-run', $options)) {
        $dry_run = true;
    }
    if (array_key_exists('yaml-file', $options)) {
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
pake_desc('synchronise project with another machine');
pake_task('sync', 'project_exists');
function run_sync($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide an environment to synchronize.');
    }
    $env = $args[0];
    $dryrun = isset($args[1]) ? $args[1] : false;
    if (!file_exists('config/rsync_exclude.txt')) {
        throw new Exception('You must create a rsync_exclude file for your project.');
    }
    $host = $task->get_property('host', $env);
    $dir = $task->get_property('dir', $env);
    try {
        $user = $task->get_property('user', $env) . '@';
    } catch (pakeException $e) {
        $user = '';
    }
    if (substr($dir, -1) != '/') {
        $dir .= '/';
    }
 *
 * usage :
 *   symfony import-vocabulary {type} {ID} {file path} -d ('delete existing' -- optional)
 *
 */

use ImportVocab\ImportVocab;

pake_desc('Import a file into a vocabulary');
pake_task('import-vocabulary');

pake_desc('Import a list of vocabulary files');
pake_task('import-list');

pake_desc('Repair references in an import batch');
pake_task('import-repair');

echo "\n";

//xdebug_break();

//we could also prepend these as arguments, but not today
//define('SF_APP', $app);
//define('SF_ENVIRONMENT', $env);
define('SF_APP', 'frontend');
define('SF_ENVIRONMENT', 'dev');
define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
define('SF_DEBUG', false);

require_once(SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'vendor'. DIRECTORY_SEPARATOR .'autoload.php');
Esempio n. 5
0
pake_desc('compile settings');
pake_task('compile-settings', 'project_exists');
pake_alias('cs', 'compile-settings');
pake_desc('compile right');
pake_task('compile-rights', 'project_exists');
pake_alias('cr', 'compile-rights');
pake_desc('create module: <module_name> <lib>');
pake_task('create-module', 'project_exists');
pake_alias('cm', 'create-module');
pake_task('compress-files', 'project_exists');
pake_alias('cf', 'compress-files');
pake_task('newsletter', 'project_exists');
pake_alias('nl', 'newsletter');
pake_task('tags-relations', 'project_exists');
pake_alias('tr', 'tags-relations');
pake_task('url-relations', 'project_exists');
pake_alias('ur', 'url-relations');
function run_compress_files($task, $args)
{
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', 'frontend');
    define('SF_ENVIRONMENT', 'prod');
    define('SF_DEBUG', false);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    //$files = FileHelper::getSubElements(SF_ROOT_DIR.DIRECTORY_SEPARATOR."www".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."frontend");
    //$files = FileHelper::getSubElements(SF_ROOT_DIR.DIRECTORY_SEPARATOR."www".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."backend");
    $files = FileHelper::getSubElements(SF_ROOT_DIR . DIRECTORY_SEPARATOR . "www" . DIRECTORY_SEPARATOR . "css");
    foreach ($files as $file) {
        $ext = strrchr($file, ".");
        if ($ext != ".css" || $ext != ".js" || $ext != ".php") {
            continue;
Esempio n. 6
0
<?php

pake_task('dm', 'project_exists');
pake_task('di', 'project_exists');
pake_task('dis', 'project_exists');
pake_task('dt', 'project_exists');
function run_dm($task, $args)
{
    ini_set("memory_limit", "6146M");
    ini_set("display_errors", 1);
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', 'frontend');
    define('SF_ENVIRONMENT', 'prod');
    define('SF_DEBUG', true);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    sfConfig::set('sf_cache_objects', false);
    sfConfig::set('sf_cache_relations', false);
    sfConfig::set('sf_use_relations_cache', false);
    $c = new Criteria();
    //$c->add(ImportSessionPeer::CREATED_AT, "2014-10-12", Criteria::GREATER_THAN);
    //$c->add(ImportSessionPeer::IMPORT_ID, null, Criteria::ISNOTNULL);
    $c->addJoin(ImportSessionPeer::IMPORT_ID, ImportPeer::ID, Criteria::LEFT_JOIN);
    $c->add(ImportPeer::SYSTEM, 3);
    $c->add(ImportSessionPeer::CREATED_AT, "2014-11-21", Criteria::GREATER_EQUAL);
    $importSessions = ImportSessionPeer::doSelect($c);
    $i = 1;
    foreach ($importSessions as $importSession) {
        $res = Document::getChildrenOf($importSession->getId(), "SearchMatch");
        foreach ($res as $r) {
 public function load_pakefile()
 {
     pake_desc('Run server. usage: aip app [config.yaml]');
     pake_task('MFS\\AppServer\\Runner\\RunnerApp::app');
 }
<?php

// Task description
pake_desc('synchronize a physical folder content with the asset library');
pake_task('sfassetlibrary-synchronize', 'project_exists');
pake_alias('sfals', 'sfassetlibrary-synchronize');
/**
 *
 * @param object $task
 * @param array $args
 */
function run_sfassetlibrary_synchronize($task, $args, $options)
{
    if (!count($args)) {
        sfAssetsLibraryTools::log('Usage: php symfony sfassetlibrary-synchronize [app] [dirname] --notVerbose --removeOrphanAssets --removeOrphanFolders');
        return;
    }
    $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 define a sychronization folder');
    }
    $base_folder = $args[1];
    $verbose = array_key_exists('notVerbose', $options) ? false : true;
    $removeOrphanAssets = array_key_exists('removeOrphanAssets', $options) ? true : false;
    $removeOrphanFolders = array_key_exists('removeOrphanFolders', $options) ? true : false;
    // define constants
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', $app);
Esempio n. 9
0
 public static function import_default_tasks()
 {
     pake_desc('launch project test suite');
     pake_task('pakeSimpletestTask::test');
 }
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
pake_desc('freeze symfony libraries');
pake_task('freeze', 'project_exists');
pake_desc('unfreeze symfony libraries');
pake_task('unfreeze', 'project_exists');
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 . '"');
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
pake_desc('initialize a new propel admin module');
pake_task('propel-init-admin', 'app_exists');
function run_propel_init_admin($task, $args)
{
    if (count($args) < 2) {
        throw new Exception('You must provide your module name.');
    }
    if (count($args) < 3) {
        throw new Exception('You must provide your model class name.');
    }
    $app = $args[0];
    $module = $args[1];
    $model_class = $args[2];
    $theme = isset($args[3]) ? $args[3] : 'default';
    try {
        $author_name = $task->get_property('author', 'symfony');
    } catch (pakeException $e) {
        $author_name = 'Your name here';
    }
    $constants = array('PROJECT_NAME' => $task->get_property('name', 'symfony'), 'APP_NAME' => $app, 'MODULE_NAME' => $module, 'MODEL_CLASS' => $model_class, 'AUTHOR_NAME' => $author_name, 'THEME' => $theme);
    $moduleDir = sfConfig::get('sf_root_dir') . '/' . sfConfig::get('sf_apps_dir_name') . '/' . $app . '/' . sfConfig::get('sf_app_module_dir_name') . '/' . $module;
    // create module structure
Esempio n. 12
0
pake_desc('create schema.xml from schema.yml');
pake_task('propel-convert-yml-schema', 'project_exists');
pake_desc('create schema.yml from schema.xml');
pake_task('propel-convert-xml-schema', 'project_exists');
pake_desc('load data from fixtures directory');
pake_task('propel-load-data', 'project_exists');
pake_desc('dump data to fixtures directory');
pake_task('propel-dump-data', 'project_exists');
pake_desc('create database for current model');
pake_task('propel-build-db', 'project_exists');
pake_desc('insert sql for current model');
pake_task('propel-insert-sql', 'project_exists');
pake_desc('generate propel model and sql and initialize database');
pake_task('propel-build-all', 'propel-build-model', 'propel-build-sql', 'propel-insert-sql');
pake_desc('generate propel model and sql and initialize database, and load data');
pake_task('propel-build-all-load', 'propel-build-all', 'propel-load-data');
function run_propel_convert_yml_schema($task, $args)
{
    _propel_convert_yml_schema(true);
}
function run_propel_convert_xml_schema($task, $args)
{
    _propel_convert_xml_schema(true);
}
function _propel_convert_yml_schema($check_schema = true, $prefix = '')
{
    $finder = pakeFinder::type('file')->name('*schema.yml');
    $dirs = array('config');
    if ($pluginDirs = glob(sfConfig::get('sf_root_dir') . '/plugins/*/config')) {
        $dirs = array_merge($dirs, $pluginDirs);
    }
Esempio n. 13
0
<?php

pake_desc('Listado de Usuarios');
pake_task('alba-list-users', 'project_exists');
pake_desc('Limpiar archivos temporales');
pake_task('alba-clear-temp', 'project_exists');
pake_desc('[ALBA-fix] dump data to fixtures directory');
pake_task('alba-dump-data', 'project_exists');
pake_desc('[ALBA-fix] load data to fixtures directory');
pake_task('alba-load-data', 'project_exists');
function run_alba_list_users($task, $args)
{
    // define constants
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', 'principal');
    define('SF_ENVIRONMENT', 'prod');
    define('SF_DEBUG', true);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    $users = UsuarioPeer::doSelect(new Criteria());
    foreach ($users as $user) {
        pake_echo_action($user->getId(), $user->getUsuario() . " [" . $user->getEmail() . "]");
    }
}
function run_alba_clear_temp($task, $args)
{
    pake_echo_action('Limpiando archivos temporales...', 'Ok');
    pake_echo_action("NO IMPLEMENTADO AUN");
}
/**
Esempio n. 14
0
<?php

pake_import('pear');
pake_desc('package and install current snapshot');
pake_task('install', 'pear_package');
pake_desc('run Demo-application');
pake_task('demo');
function run_install()
{
    pake_superuser_sh('pear install -f AppServer-0.2.2.tgz');
}
function run_demo()
{
    pake_sh('aip app ' . realpath(__DIR__ . '/examples/new/config.yaml'), true);
}
Esempio n. 15
0
    pake_task('eZExtBuilder\\BuildTasks::update-package-xml');
    pake_task('eZExtBuilder\\BuildTasks::generate-documentation');
    pake_task('eZExtBuilder\\BuildTasks::generate-md5sums');
    pake_task('eZExtBuilder\\BuildTasks::generate-package-filelist');
    pake_task('eZExtBuilder\\BuildTasks::dist');
    pake_task('eZExtBuilder\\BuildTasks::build-dependencies');
    /*
    pake_desc( 'Creates an ezpackage tarball.' );
    pake_task( 'generate-package-tarball', 'update-package-xml', 'generate-package-filelist' );
    */
    pake_task('eZExtBuilder\\BuildTasks::fat-dist');
    pake_task('eZExtBuilder\\BuildTasks::generate-sample-package-xml');
    pake_task('eZExtBuilder\\BuildTasks::clean-all', 'clean', 'dist-clean');
    pake_task('eZExtBuilder\\BuildTasks::clean');
    pake_task('eZExtBuilder\\BuildTasks::dist-clean');
    pake_task('eZExtBuilder\\ReportTasks::all-code-reports', 'code-quality-reports', 'code-metrics-reports');
    pake_task('eZExtBuilder\\ReportTasks::code-quality-reports', 'coding-style-report', 'code-mess-report', 'copy-paste-report', 'dead-code-report');
    pake_task('eZExtBuilder\\ReportTasks::code-mess-report');
    pake_task('eZExtBuilder\\ReportTasks::coding-style-report');
    pake_task('eZExtBuilder\\ReportTasks::copy-paste-report');
    pake_task('eZExtBuilder\\ReportTasks::dead-code-report');
    pake_task('eZExtBuilder\\ReportTasks::code-metrics-reports', 'php-loc-report', 'php-pdepend-report');
    pake_task('eZExtBuilder\\ReportTasks::php-loc-report');
    pake_task('eZExtBuilder\\ReportTasks::php-pdepend-report');
    pake_task('eZExtBuilder\\GenericTasks::tool-version');
    pake_task('eZExtBuilder\\GenericTasks::show-properties');
    pake_task('eZExtBuilder\\GenericTasks::list-extensions');
    pake_task('eZExtBuilder\\GenericTasks::generate-extension-config');
    pake_task('eZExtBuilder\\GenericTasks::download-extension-config');
    pake_task('eZExtBuilder\\GenericTasks::convert-configuration');
}
<?php

pake_desc('Register Facebook users for later linking');
pake_task('facebook-register-users');
function run_facebook_register_users($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide an application.');
    }
    $app = $args[0];
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', $app);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    sfContext::getInstance();
    $sfGuardUsers = sfFacebookConnect::getNonRegisteredUsers();
    echo count($sfGuardUsers) . " non registered users in your database\n";
    $chunks = array_chunk($sfGuardUsers, 50);
    $num_registered = 0;
    foreach ($chunks as $chunk) {
        $num_registered += sfFacebookConnect::registerUsers($chunk);
        echo $num_registered . " registered.\n";
    }
}
Esempio n. 17
0
<?php

pake_import('pear', false);
pake_task('default');
pake_alias('init_mvc', 'default');
pake_alias('reinit_db', 'default');
// TASKS
function run_default($task, $args)
{
    pake_echo_error('Installer is a separate tool now. Please use that');
    try {
        pake_which('mvc_install');
        pake_echo_comment('It is already installed on your system. Type: mvc_install');
    } catch (pakeException $e) {
        pake_echo_comment('I will install it for you…');
        pakePearTask::install_pear_package('midgardmvc_installer', 'pear.indeyets.pp.ru');
        pake_echo_comment('Done. To use it, type: mvc_install');
    }
}
Esempio n. 18
0
    }
    pake_echo_comment("oops… you're using installed pake. restarting with local version…");
    pake_sh(escapeshellarg($php_exec) . ' ' . escapeshellarg(dirname(__FILE__) . '/bin/pake.php') . $force_tty . $args, true);
    die;
} else {
    pake_echo_comment("using local version of pake. good!");
}
/* registration */
pake_import('simpletest');
pake_import('pear');
pake_task('compact');
pake_task('phar');
pake_task('release');
pake_task('create_package_xml');
pake_task('obs');
pake_task('foo');
/**
 * Demo-task
 *
 * @param string $task
 * @param string $args
 * @return bool
 * @author Alexey Zakhlestin
 */
function run_foo($task, $args)
{
    $age = pake_input('How old are you?');
    pake_echo_comment("You are " . $age);
    // throw new Exception('test');
}
/* tasks */
Esempio n. 19
0
        if (isRunWorker($id)) {
            killWorker($id);
        }
        startWorker($id);
    }
}
pake_desc("Hard stop all gearman workers");
pake_task("stop_workers");
function run_stop_workers()
{
    $out = "";
    @pake_sh("pgrep -f worker.php | xargs kill");
    pake_echo(print_r($out, true));
}
pake_desc("Check is need run wokers and start it");
pake_task("worker_monitor");
function run_worker_monitor()
{
    $workerStarter = Job_Monitor_Factory::createWorkerStarter();
    if (!$workerStarter->isRun()) {
        Api_Core_Application::log("Не запущенны воркеры", null, Api_Component_Log_Logger::LEVEL_ERROR);
        run_restart_workers();
    }
}
function isRunWorker($id)
{
    $pidfile = RUNTIME_PATH . getWorkerPidFile($id);
    return file_exists($pidfile);
}
function startWorker($id)
{
Esempio n. 20
0
<?php

pake_desc('promote a user super administrator');
pake_task('promote-super-admin', 'project_exists');
function run_promote_super_admin($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide a user name.');
    }
    $username = $args[0];
    throw new Exception('This task is not yet implemented.');
}
Esempio n. 21
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *  
 */
pake_task('project_exists');
pake_task('app_exists', 'project_exists');
pake_task('module_exists', 'app_exists');
/**
 * Function run_project_exists
 * access public
 */
function run_project_exists($task, $args)
{
    //  if (!file_exists('pre_processor.php'))
    //  {
    //    throw new Exception('you must be in a gulliver project directory');
    //  }
    //  pake_properties('config/properties.ini');
}
/**
 * Function run_app_exists
 * access public
 * This task is used to import either a vocabulary or an element set into an instance of the Registry
 *
 * It will look for the XSLT file data/transform/clay2propel.xsl
 *
 * @author  <*****@*****.**>
 *
 * usage :
 *   symfony import-vocabulary {type} {ID} {file path} -d ('delete existing' -- optional)
 *
 */

pake_desc('Import a file into a vocabulary');
pake_task('import-marc-vocabulary');

pake_desc('Import a list of vocabulary files');
pake_task('import-marc-list');

echo "\n";

//xdebug_break();

//we could also prepend these as arguments, but not today
//define('SF_APP', $app);
//define('SF_ENVIRONMENT', $env);
if ( ! defined('SF_APP')) {
    define('SF_APP', 'frontend');
}
if ( ! defined('SF_ENVIRONMENT')) {
    define('SF_ENVIRONMENT', 'prod');
}
if ( ! defined('SF_ROOT_DIR')) {
Esempio n. 23
0
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
pake_desc('launch unit tests');
pake_task('test-unit', 'project_exists');
pake_desc('launch functional tests for an application');
pake_task('test-functional', 'project_exists');
pake_desc('launch all tests');
pake_task('test-all', 'project_exists');
function run_test_all($task, $args)
{
    require_once sfConfig::get('sf_symfony_lib_dir') . '/vendor/lime/lime.php';
    $h = new lime_harness(new lime_output_color());
    $h->base_dir = sfConfig::get('sf_test_dir');
    // register all tests
    $finder = pakeFinder::type('file')->ignore_version_control()->follow_link()->name('*Test.php');
    $h->register($finder->in($h->base_dir));
    $h->run();
}
function run_test_functional($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide the app to test.');
    }
    $app = $args[0];
Esempio n. 24
0
    print pake_sh('vendor/bin/phpcs -s');
}
pake_desc('Run PHPCBF to attempt to fix CS issues');
pake_task('phpcbf');
function run_phpcbf()
{
    print pake_sh('vendor/bin/phpcbf');
}
pake_desc('Run PHPMD');
pake_task('phpmd');
function run_phpmd()
{
    print pake_sh('vendor/bin/phpmd ./ text cleancode,codesize,controversial,design,unusedcode --exclude vendor');
}
pake_desc('Run PHPUnit tests');
pake_task('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');
/*
 * This file is part of the anno0Tasks package.
 *
 * (c) 2011 Guglielmo Celata <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * @package    
 * @subpackage Task per estrarre dati per anno0
 * @author     Guglielmo Celata <*****@*****.**>
 */
pake_desc("estrae atti più rilevanti per determinati argomenti");
pake_task('a0-get-main-acts-for-tags', 'project_exists');
/**
 * estrae gli N atti più rilevanti per determinati argomenti (tag)
 */
function run_a0_get_main_acts_for_tags($task, $args, $options)
{
    static $loaded;
    // load application context
    if (!$loaded) {
        task_loader();
        $loaded = true;
    }
    echo "memory usage: " . memory_get_usage() . "\n";
    $msg = sprintf("start time: %s\n", date('H:i:s'));
    echo $msg;
    $n = 1;
Esempio n. 26
0
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
pake_desc('initialize a new propel CRUD module');
pake_task('propel-init-crud', 'app_exists');
pake_desc('generate a new propel CRUD module');
pake_task('propel-generate-crud', 'app_exists');
function run_propel_init_crud($task, $args)
{
    if (count($args) < 2) {
        throw new Exception('You must provide your module name.');
    }
    if (count($args) < 3) {
        throw new Exception('You must provide your model class name.');
    }
    $app = $args[0];
    $module = $args[1];
    $model_class = $args[2];
    try {
        $author_name = $task->get_property('author', 'symfony');
    } catch (pakeException $e) {
        $author_name = 'Your name here';
    }
    $constants = array('PROJECT_NAME' => $task->get_property('name', 'symfony'), 'APP_NAME' => $app, 'MODULE_NAME' => $module, 'MODEL_CLASS' => $model_class, 'AUTHOR_NAME' => $author_name);
    $sf_root_dir = sfConfig::get('sf_root_dir');
/**
 * @package    
 * @subpackage Task that fetches politicians' images from op_openpolis and  
 *             stores resized versions in the op_openparlamento db
 * @author     Guglielmo Celata <*****@*****.**>
 */
pake_desc("add tags to acts");
pake_task('opp-add-tags-to-acts', 'project_exists');
pake_desc("get all opp_carica_id(s) from the politician_id");
pake_task('opp-get-carica-id', 'project_exists');
pake_desc("sync politicians' images from op_openpolis, storing resized versions in the local db");
pake_task('opp-sync-polimages', 'project_exists');
pake_desc("create a list of URLs to pre-fetch, in order to populate the cache");
pake_task('opp-urls-to-cache', 'project_exists');
pake_desc('load data from fixtures directory (using myPropelData class)');
pake_task('opp-load-fixtures', 'project_exists');
/**
 * estrae e mostra le cariche id relative al politico id
 */
function run_opp_get_carica_id($task, $args, $options)
{
    static $loaded;
    // load application context
    if (!$loaded) {
        _loader();
    }
    $politici_id = $args;
    foreach ($politici_id as $politico_id) {
        $msg = sprintf("politico ID: {$politico_id} ... ");
        echo pakeColor::colorize($msg, array('fg' => 'green', 'bold' => false));
        $politico = OppPoliticoPeer::retrieveByPK($politico_id);
Esempio n. 28
0
                pakeArchive::createArchive($finder, '.', $pharFile);
                rename($pharFile, $distFile);
            }
        }
        chdir($cwd);
    }
    function run_clean_workspace($task = null, $args = array(), $cliOpts = array())
    {
        pake_remove_dir(Builder::workspaceDir());
    }
    /**
     * Cleans up the whole build directory
     * @todo 'make clean' usually just removes the results of the build, distclean removes all but sources
     */
    function run_clean($task = null, $args = array(), $cliOpts = array())
    {
        pake_remove_dir(Builder::buildDir());
    }
    // helper task: display help text
    pake_task('default');
    // internal task: parse cli options
    pake_task('getopts');
    pake_task('init', 'getopts');
    pake_task('doc', 'getopts', 'init', 'clean-doc');
    pake_task('build', 'getopts', 'init', 'doc');
    pake_task('dist', 'getopts', 'init', 'build', 'clean-dist');
    pake_task('clean-doc', 'getopts');
    pake_task('clean-dist', 'getopts');
    pake_task('clean-workspace', 'getopts');
    pake_task('clean', 'getopts');
}
Esempio n. 29
0
<?php

pake_desc('generate database patch');
pake_task('propel-build-sql-diff');
pake_desc('insert database patch');
pake_task('propel-insert-sql-diff');
pake_desc('rebuild model and upgrade database');
pake_task('propel-update-all', 'app_exists', 'propel-build-model', 'propel-insert-sql-diff', 'clear-cache');
function run_propel_build_sql_diff($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide the application.');
    }
    $app = $args[0];
    if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) {
        throw new Exception(sprintf('The app "%s" does not exist.', $app));
    }
    run_propel_build_sql($task, $args);
    pake_echo_action('propel-sql-diff', "building database patch");
    define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/../../../..'));
    define('SF_APP', $app);
    define('SF_ENVIRONMENT', isset($args[1]) ? $args[1] : 'dev');
    define('SF_DEBUG', 1);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    $i = new dbInfo();
    $i->loadFromDb();
    $i2 = new dbInfo();
    $i2->loadAllFilesInDir(sfConfig::get('sf_data_dir') . '/sql');
    $diff = $i->getDiffWith($i2);
Esempio n. 30
0
/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
pake_desc('install a new plugin');
pake_task('plugin-install', 'project_exists');
pake_desc('upgrade a plugin');
pake_task('plugin-upgrade', 'project_exists');
pake_desc('uninstall a plugin');
pake_task('plugin-uninstall', 'project_exists');
pake_desc('list installed plugins');
pake_task('plugin-list', 'project_exists');
// symfony plugin-install pluginName
function run_plugin_install($task, $args)
{
    if (!isset($args[0])) {
        throw new Exception('You must provide the plugin name.');
    }
    $config = _pear_init();
    // install plugin
    $packages = array($args[0]);
    pake_echo_action('plugin', 'installing plugin "' . $args[0] . '"');
    list($ret, $error) = _pear_run_command($config, 'install', array(), $packages);
    if ($error) {
        throw new Exception($error);
    }
    _install_web_content(_get_plugin_name($args[0]));