Development

Changeset 285

You must first sign up to be able to contribute.

Changeset 285

Show
Ignore:
Timestamp:
12/25/05 11:26:49 (3 years ago)
Author:
fabien
Message:

fabien-constants: new test class, changed to sfConfig::get and sfConfig::set - updated from trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/fabien-constants/CHANGELOG

    r163 r285  
    77           'data/symfony/skeleton/app/app/config/config.php' 
    88           and convert all your calls to SF_ and APP_ constants to their $this->config->get equivalent 
    9 * [fabien] cleaning cache is safer (based on a patch from jgchristopher) 
    10            applications are now unavailable when you are in the process of cleaning the config cache 
    11            WARNING: To use this new feature in your existing projects, you must override your 
    12                     config.php file with the one in 'data/symfony/skeleton/app/app/config/config.php' 
    13                     and create an unavailable.html file in your web directory 
    14                     (see an example in data/symfony/skeleton/project/web/unavailable.html) 
    15 * [fabien] added new shortcuts to help debugging 
    16 * [fabien] new class to easily load test datas from YAML files into databases (Propel) 
    17 * [fabien] better cache support 
    18 * [fabien] safeguard for recursive slots 
    19 * [fabien] added the possibility to disable the web debug sidebar for specific action (RSS, XML, SVG, ...) 
     9 
     10Version 0.4.3 
     11------------- 
     12 
     13* [jgchristopher] new input_in_place_editor_tag and input_auto_complete_tag helpers 
     14* [fabien]        new email support 
     15* [fabien]        modules can now be declared internal only (for slots and emails modules for example) 
     16* [fabien]        view classes are now configurable (per module) 
     17* [fabien]        all category in configuration files is now optional 
     18* [fabien]        added build-schema to pakefile 
     19* [fabien]        new RSS feed classes 
     20* [fabien]        cleaning cache is safer (based on a patch from jgchristopher) 
     21                  applications are now unavailable when you are in the process of cleaning the config cache 
     22                  WARNING: To use this new feature in your existing projects, you must override your 
     23                           config.php file with the one in 'data/symfony/skeleton/app/app/config/config.php' 
     24                           and create an unavailable.html file in your web directory 
     25                           (see an example in data/symfony/skeleton/project/web/unavailable.html) 
     26* [fabien]        added new shortcuts to help debugging 
     27* [fabien]        new class to easily load test datas from YAML files into databases (Propel) 
     28* [fabien]        better cache support 
     29* [fabien]        safeguard for recursive slots 
     30* [fabien]        added the possibility to disable the web debug sidebar for specific action (RSS, XML, SVG, ...) 
    2031 
    2132Version 0.4.2 
  • branches/fabien-constants/bin/symfony.php

    r98 r285  
    1717require_once 'pake/pakeGetopt.class.php'; 
    1818$OPTIONS = array( 
    19   array('--version',  '-V', pakeGetopt::NO_ARGUMENT, ''), 
     19  array('--version', '-V', pakeGetopt::NO_ARGUMENT, ''), 
     20  array('--pakefile', '-f', pakeGetopt::OPTIONAL_ARGUMENT, ''), 
    2021); 
    2122$opt = new pakeGetopt($OPTIONS); 
     
    2324{ 
    2425  $opt->parse(); 
     26 
    2527  foreach ($opt->get_options() as $opt => $value) 
    2628  { 
     
    2830    { 
    2931      echo 'symfony version '.SYMFONY_VERSION."\n"; 
     32      exit(0); 
    3033    } 
    31     exit(0); 
    3234  } 
    3335} 
    34 catch (Exception $e) 
     36catch (pakeException $e) 
    3537{ 
     38  print $e->getMessage(); 
    3639} 
    3740 
    38 pakeApp::get_instance()->run(PAKEFILE_DATA_DIR.'/symfony/bin/pakefile.php'); 
     41$pake = pakeApp::get_instance(); 
     42try 
     43
     44  $pake->run(PAKEFILE_DATA_DIR.'/symfony/bin/pakefile.php'); 
     45
     46catch (pakeException $e) 
     47
     48  echo "ERROR: symfony - ".$e->getMessage()."\n"; 
     49
    3950 
    4051?> 
  • branches/fabien-constants/data/symfony/bin/build.xml

    r1 r285  
    1919 
    2020<target name="build-model-schema"> 
    21   <phing dir="${propel_generator_dir}" target="build-model-schema"> 
     21  <phing dir="${propel_generator_dir}" target="creole"> 
    2222    <property name="project.dir" value="${application.startdir}/config" /> 
    2323    <property name="project" value="${project}" /> 
  • branches/fabien-constants/data/symfony/bin/pakefile.php

    r152 r285  
    2525pake_task('module_exists', 'app_exists'); 
    2626 
    27 pake_desc('clear cached information'); 
    28 pake_task('clear-cache', 'project_exists'); 
    29 pake_alias('cc', 'clear-cache'); 
    30  
    31 pake_desc('initialize a new symfony project'); 
    32 pake_task('init-project'); 
    33 pake_alias('new', 'init-project'); 
    34  
    35 pake_desc('initialize a new symfony application'); 
    36 pake_task('init-app', 'project_exists'); 
    37 pake_alias('app', 'init-app'); 
    38  
    39 pake_desc('initialize a new symfony module'); 
    40 pake_task('init-module', 'app_exists'); 
    41 pake_alias('module', 'init-module'); 
    42  
    43 pake_desc('initialize a new propel CRUD module'); 
    44 pake_task('init-propelcrud', 'app_exists'); 
    45  
    46 pake_desc('generate a new propel CRUD module'); 
    47 pake_task('generate-propelcrud', 'app_exists'); 
    48  
    49 pake_desc('backup uploaded datas'); 
    50 pake_task('backup-data', 'project_exists'); 
    51  
    52 pake_desc('fix directories permissions'); 
    53 pake_task('fix-perms', 'project_exists'); 
    54  
    55 pake_desc('create classes for current model'); 
    56 pake_task('build-model', 'project_exists'); 
    57  
    58 pake_desc('create sql for current model'); 
    59 pake_task('build-sql', 'project_exists'); 
    60  
    61 pake_desc('synchronise project with another machine'); 
    62 pake_task('sync', 'project_exists'); 
    63  
    64 pake_desc('launch project test suite'); 
    65 pake_task('test'); 
    66  
    6727/* tasks definition */ 
    68 function run_test($task, $args) 
    69 { 
    70   if (!count($args)) 
    71   { 
    72     throw new Exception('you must provide the app to test'); 
    73   } 
    74  
    75   $app = $args[0]; 
    76  
    77   if (!is_dir($app)) 
    78   { 
    79     throw new Exception('you must provide the app to test'); 
    80   } 
    81  
    82   // define constants 
    83   define('SF_ROOT_DIR',    getcwd()); 
    84   define('SF_APP',         $app); 
    85   define('SF_ENVIRONMENT', 'test'); 
    86   define('SF_DEBUG',       true); 
    87  
    88   // get configuration 
    89   require_once SF_ROOT_DIR.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'; 
    90  
    91   $dirs_to_test = array($app); 
    92   if (is_dir('test/project')) 
    93   { 
    94     $dirs_to_test[] = 'project'; 
    95   } 
    96  
    97   pake_import('simpletest', false); 
    98   pakeSimpletestTask::call_simpletest($task, 'text', $dirs_to_test); 
    99 } 
    100  
    10128function run_fix() 
    10229{ 
    10330  // noop 
    104 } 
    105  
    106 function run_sync($task, $args) 
    107 { 
    108   if (!count($args)) 
    109   { 
    110     throw new Exception('you must provide an environment to synchronize'); 
    111   } 
    112  
    113   $env = $args[0]; 
    114  
    115   $dryrun = isset($args[1]) ? $args[1] : false; 
    116  
    117   if (!file_exists('config/rsync_exclude.txt')) 
    118   { 
    119     throw new Exception('you must create a rsync_exclude file for your project'); 
    120   } 
    121  
    122   $host = $task->get_property('host', $env); 
    123   if (!$host) 
    124   { 
    125     throw new Exception('you must set "host" variable in your properties.ini file'); 
    126   } 
    127  
    128   $user = $task->get_property('user', $env); 
    129   if (!$user) 
    130   { 
    131     throw new Exception('you must set "user" variable in your properties.ini file'); 
    132   } 
    133  
    134   $dir = $task->get_property('dir', $env); 
    135   if (!$dir) 
    136   { 
    137     throw new Exception('you must set "dir" variable in your properties.ini file'); 
    138   } 
    139  
    140   if (substr($dir, -1) != '/') 
    141   { 
    142     $dir .= '/'; 
    143   } 
    144  
    145   $ssh = 'ssh'; 
    146  
    147   $port = $task->get_property('port', $env); 
    148   if ($port) 
    149   { 
    150     $ssh = '"ssh -p'.$port.'"'; 
    151   } 
    152  
    153   $dry_run = ($dryrun == 'go' || $dryrun == 'ok') ? '' : '--dry-run'; 
    154   $cmd = "rsync --progress $dry_run -azC --exclude-from=config/rsync_exclude.txt --force --delete -e $ssh ./ $user@$host:$dir"; 
    155  
    156   echo pake_sh($cmd); 
    15731} 
    15832 
     
    19367} 
    19468 
    195 function run_build_model($task, $args) 
     69/* include all tasks definitions */ 
     70$tasks = pakeFinder::type('file')->name('sfPake*.php')->in(realpath(dirname(__FILE__).'/..').DIRECTORY_SEPARATOR.'tasks'); 
     71foreach ($tasks as $task) 
    19672{ 
    197   _call_phing($task, 'build-om'); 
    198 
    199  
    200 function run_build_sql($task, $args) 
    201 
    202   _call_phing($task, 'build-sql'); 
    203 
    204  
    205 function _call_phing($task, $task_name, $check_schema = true) 
    206 
    207   if ($check_schema && !file_exists('config/schema.xml')) 
    208   { 
    209     throw new Exception('you must create a schema.xml file'); 
    210   } 
    211  
    212   // FIXME: we update propel.ini with uptodate values 
    213  
    214   $propel_generator_dir = PAKEFILE_SYMFONY_LIB_DIR.'/propel-generator'; 
    215  
    216   // call phing targets 
    217   pake_import('Phing', false); 
    218   pakePhingTask::call_phing($task, array($task_name), dirname(__FILE__).'/build.xml', array('project' => $task->get_property('name', 'symfony'), 'lib_dir' => PAKEFILE_LIB_DIR, 'data_dir' => PAKEFILE_DATA_DIR, 'propel_generator_dir' => $propel_generator_dir)); 
    219 
    220  
    221 function run_fix_perms($task, $args) 
    222 
    223   $finder = pakeFinder::type('dir')->prune('.svn')->discard('.svn'); 
    224   pake_chmod($finder, getcwd().'/web/uploads', 0777); 
    225   pake_chmod('log', getcwd(), 0777); 
    226   pake_chmod('cache', getcwd(), 0777); 
    227  
    228   $finder = pakeFinder::type('file')->prune('.svn')->discard('.svn'); 
    229   pake_chmod($finder, getcwd().'/web/uploads', 0666); 
    230   pake_chmod($finder, getcwd().'/log', 0666); 
    231 
    232  
    233 function run_clear_cache($task, $args) 
    234 
    235   if (!file_exists('cache')) 
    236   { 
    237     throw new Exception('cache directory does not exist'); 
    238   } 
    239  
    240   $cache_dir = 'cache'; 
    241  
    242   // app 
    243   $main_app = ''; 
    244   if (isset($args[0])) 
    245   { 
    246     $main_app = $args[0]; 
    247   } 
    248  
    249