Development

Changeset 8154

You must first sign up to be able to contribute.

Changeset 8154

Show
Ignore:
Timestamp:
03/30/08 00:57:25 (8 months ago)
Author:
dwhittle
Message:

dwhittle: merged changes to branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dwhittle/1.1/data/bin/release.php

    r8082 r8154  
    7878 
    7979// add class files 
    80 $finder = sfFinder::type('file')->ignore_version_control()->relative(); 
     80$finder = sfFinder::type('file')->relative(); 
    8181$xml_classes = ''; 
    8282$dirs = array('lib' => 'php', 'data' => 'data'); 
  • branches/dwhittle/1.1/lib/autoload/sfCoreAutoload.class.php

    r8017 r8154  
    103103 
    104104    $files = sfFinder::type('file') 
    105       ->ignore_version_control() 
    106105      ->prune('plugins') 
    107106      ->prune('vendor') 
  • branches/dwhittle/1.1/lib/autoload/sfSimpleAutoload.class.php

    r7797 r8154  
    184184    if ($dirs = glob($dir)) 
    185185    { 
    186       $finder = sfFinder::type('file')->ignore_version_control()->follow_link()->name('*'.$ext); 
     186      $finder = sfFinder::type('file')->follow_link()->name('*'.$ext); 
    187187      foreach ($dirs as $dir) 
    188188      { 
  • branches/dwhittle/1.1/lib/config/sfAutoloadConfigHandler.class.php

    r7853 r8154  
    6666        // we automatically add our php classes 
    6767        require_once(sfConfig::get('sf_symfony_lib_dir').'/util/sfFinder.class.php'); 
    68         $finder = sfFinder::type('file')->ignore_version_control()->name('*'.$ext)->follow_link(); 
     68        $finder = sfFinder::type('file')->name('*'.$ext)->follow_link(); 
    6969 
    7070        // recursive mapping? 
  • branches/dwhittle/1.1/lib/event/sfEvent.class.php

    r6506 r8154  
    2929   * Constructs a new sfEvent. 
    3030   * 
    31    * @param mixed  The subject 
    32    * @param string The event name 
    33    * @param array  An array of parameters 
     31   * @param mixed  $subject      The subject 
     32   * @param string $name         The event name 
     33   * @param array  $parameters   An array of parameters 
    3434   */ 
    3535  public function __construct($subject, $name, $parameters = array()) 
     
    4444   * Returns the subject. 
    4545   * 
    46    * @param mixed The subject 
     46   * @return mixed The subject 
    4747   */ 
    4848  public function getSubject() 
     
    5454   * Returns the event name. 
    5555   * 
    56    * @param string The event name 
     56   * @return string The event name 
    5757   */ 
    5858  public function getName() 
     
    6464   * Sets the return value for this event. 
    6565   * 
    66    * @param mixed The return value 
     66   * @param mixed $value The return value 
    6767   */ 
    6868  public function setReturnValue($value) 
     
    8484   * Sets the processed flag. 
    8585   * 
    86    * @param Boolean The processed flag value 
     86   * @param Boolean $processed The processed flag value 
    8787   */ 
    8888  public function setProcessed($processed) 
     
    9494   * Returns whether the event has been processed by a listener or not. 
    9595   * 
    96    * @param Boolean true if the event has been processed, false otherwise 
     96   * @return Boolean true if the event has been processed, false otherwise 
    9797   */ 
    9898  public function isProcessed() 
     
    101101  } 
    102102 
     103  /** 
     104   * Returns the event parameters. 
     105   * 
     106   * @return array The event parameters 
     107   */ 
    103108  public function getParameters() 
    104109  { 
     
    109114   * Returns true if the parameter exists (implements the ArrayAccess interface). 
    110115   * 
    111    * @param  string  The parameter name 
     116   * @param  string  $name  The parameter name 
    112117   * 
    113118   * @return Boolean true if the parameter exists, false otherwise 
     
    121126   * Returns a parameter value (implements the ArrayAccess interface). 
    122127   * 
    123    * @param  string The parameter name 
     128   * @param  string $name  The parameter name 
    124129   * 
    125130   * @return mixed  The parameter value 
     
    133138   * Sets a parameter (implements the ArrayAccess interface). 
    134139   * 
    135    * @param string The parameter name 
    136    * @param mixed   
     140   * @param string $name   The parameter name 
     141   * @param mixed  $value  The parameter value  
    137142   */ 
    138143  public function offsetSet($name, $value) 
     
    144149   * Removes a parameter (implements the ArrayAccess interface). 
    145150   * 
    146    * @param string The parameter name 
     151   * @param string $name    The parameter name 
    147152   */ 
    148153  public function offsetUnset($name) 
  • branches/dwhittle/1.1/lib/event/sfEventDispatcher.class.php

    r5125 r8154  
    2727   * Connects a listener to a given event name. 
    2828   * 
    29    * @param string An event name 
    30    * @param mixed  A PHP callable 
     29   * @param string $name      An event name 
     30   * @param mixed  $listener  A PHP callable 
    3131   */ 
    3232  public function connect($name, $listener) 
     
    4343   * Disconnects a listener for a given event name. 
    4444   * 
    45    * @param string An event name 
    46    * @param mixed  A PHP callable 
     45   * @param string   $name      An event name 
     46   * @param mixed    $listener  A PHP callable 
     47   * 
     48   * @return mixed false if listener does not exist, null otherwise 
    4749   */ 
    4850  public function disconnect($name, $listener) 
     
    6567   * Notifies all listeners of a given event. 
    6668   * 
    67    * @param sfEvent A sfEvent instance 
     69   * @param sfEvent $event A sfEvent instance 
    6870   * 
    6971   * @return sfEvent The sfEvent instance 
     
    8284   * Notifies all listeners of a given event until one returns a non null value. 
    8385   * 
    84    * @param  sfEvent A sfEvent instance 
     86   * @param  sfEvent $event A sfEvent instance 
    8587   * 
    8688   * @return sfEvent The sfEvent instance 
     
    103105   * Filters a value by calling all listeners of a given event. 
    104106   * 
    105    * @param  sfEvent A sfEvent instance 
    106    * @param  mixed   The value to be filtered 
     107   * @param  sfEvent $event   A sfEvent instance 
     108   * @param  mixed    $value   The value to be filtered 
    107109   * 
    108110   * @return sfEvent The sfEvent instance 
     
    123125   * Returns true if the given event name has some listeners. 
    124126   * 
    125    * @param  string  The event name 
     127   * @param  string  $name    The event name 
    126128   * 
    127129   * @return Boolean true if some listeners are connected, false otherwise 
     
    140142   * Returns all listeners associated with a given event name. 
    141143   * 
    142    * @param  string The event name 
     144   * @param  string   $name    The event name 
    143145   * 
    144146   * @return array  An array of listeners 
  • branches/dwhittle/1.1/lib/generator/sfCrudGenerator.class.php

    r7618 r8154  
    7979 
    8080    $this->setTheme($theme); 
    81     $files = sfFinder::type('file')->ignore_version_control()->relative()->in($themeDir); 
     81    $files = sfFinder::type('file')->relative()->in($themeDir); 
    8282 
    8383    $this->generatePhpFiles($this->generatedModuleName, $files); 
  • branches/dwhittle/1.1/lib/i18n/extract/sfI18nApplicationExtract.class.php

    r7697 r8154  
    2727 
    2828    // Modules 
    29     $moduleNames = sfFinder::type('dir')->maxdepth(0)->ignore_version_control()->relative()->in(sfConfig::get('sf_app_module_dir')); 
     29    $moduleNames = sfFinder::type('dir')->maxdepth(0)->relative()->in(sfConfig::get('sf_app_module_dir')); 
    3030    foreach ($moduleNames as $moduleName) 
    3131    { 
  • branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/addon/sfPropelData.class.php

    r8133 r8154  
    315315   * Returns data from one or more tables. 
    316316   * 
    317    * @param  string directory or file to dump to 
    318317   * @param  mixed  name or names of tables to dump (or all to dump all tables) 
    319318   * @param  string connection name 
  • branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataDumpTask.class.php

    r7989 r8154  
    3434      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environement', 'cli'), 
    3535      new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'), 
     36      new sfCommandOption('classes', null, sfCommandOption::PARAMETER_REQUIRED, 'The class names to dump (separated by a colon)', null), 
    3637    )); 
    3738 
     
    6162 
    6263  [./symfony propel:data-load --connection="name" frontend|INFO] 
     64 
     65If you only want to dump some classes, use the [classes|COMMENT] option: 
     66 
     67  [./symfony propel:data-load --classes="Article,Category" frontend|INFO] 
    6368EOF; 
    6469  } 
     
    8590    $data = new sfPropelData(); 
    8691 
     92    $classes = is_null($options['classes']) ? 'all' : explode(',', $options['classes']); 
     93 
    8794    if (!is_null($filename)) 
    8895    { 
    89       $data->dumpData($filename, 'all', $options['connection']); 
     96      $data->dumpData($filename, $classes, $options['connection']); 
    9097    } 
    9198    else 
    9299    { 
    93       fwrite(STDOUT, sfYaml::dump($data->getData('all', $options['connection']), 3)); 
     100      fwrite(STDOUT, sfYaml::dump($data->getData($classes, $options['connection']), 3)); 
    94101    } 
    95102  } 
  • branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php

    r7697 r8154  
    136136 
    137137    // create basic application structure 
    138     $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
     138    $finder = sfFinder::type('any')->discard('.sf'); 
    139139    $dirs = $this->configuration->getGeneratorSkeletonDirs('sfPropelCrud', $options['theme']); 
    140140    foreach ($dirs as $dir) 
  • branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelInitAdminTask.class.php

    r7697 r8154  
    7777 
    7878    // create module structure 
    79     $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
     79    $finder = sfFinder::type('any')->discard('.sf'); 
    8080    $dirs = $this->configuration->getGeneratorSkeletonDirs('sfPropelAdmin', $options['theme']); 
    8181    foreach ($dirs as $dir) 
  • branches/dwhittle/1.1/lib/task/cache/sfCacheClearTask.class.php

    r8061 r8154  
    7878 
    7979    // finder to find directories (1 level) in a directory 
    80     $dirFinder = sfFinder::type('dir')->ignore_version_control()->discard('.sf')->maxdepth(0)->relative(); 
     80    $dirFinder = sfFinder::type('dir')->discard('.sf')->maxdepth(0)->relative(); 
    8181 
    8282    // iterate through applications 
     
    125125    if (is_null($options['app'])) 
    126126    { 
    127       $this->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in(sfConfig::get('sf_cache_dir'))); 
     127      $this->getFilesystem()->remove(sfFinder::type('file')->discard('.sf')->in(sfConfig::get('sf_cache_dir'))); 
    128128    } 
    129129  } 
     
    150150    { 
    151151      // remove cache files 
    152       $this->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in($subDir)); 
     152      $this->getFilesystem()->remove(sfFinder::type('file')->discard('.sf')->in($subDir)); 
    153153    } 
    154154  } 
  • branches/dwhittle/1.1/lib/task/generator/sfGenerateAppTask.class.php

    r8085 r8154  
    8282 
    8383    // Create basic application structure 
    84     $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
     84    $finder = sfFinder::type('any')->discard('.sf'); 
    8585    $this->getFilesystem()->mirror(dirname(__FILE__).DIRECTORY_SEPARATOR.'skeleton'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'app', $appDir, $finder); 
    8686 
  • branches/dwhittle/1.1/lib/task/generator/sfGenerateModuleTask.class.php

    r7697 r8154  
    9595 
    9696    // create basic application structure 
    97     $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
     97    $finder = sfFinder::type('any')->discard('.sf'); 
    9898    $this->getFilesystem()->mirror($skeletonDir.DIRECTORY_SEPARATOR.'module', $moduleDir, $finder); 
    9999 
  • branches/dwhittle/1.1/lib/task/generator/sfGenerateProjectTask.class.php

    r7989 r8154  
    6868 
    6969    // create basic project structure 
    70     $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
     70    $finder = sfFinder::type('any')->discard('.sf'); 
    7171    $this->getFilesystem()->mirror(dirname(__FILE__).DIRECTORY_SEPARATOR.'skeleton'.DIRECTORY_SEPARATOR.'project', sfConfig::get('sf_root_dir'), $finder); 
    7272 
  • branches/dwhittle/1.1/lib/task/i18n/sfI18nFindTask.class.php

    r7697 r8154  
    4848 
    4949    // Look in templates 
    50     $moduleNames = sfFinder::type('dir')->maxdepth(0)->ignore_version_control()->relative()->in(sfConfig::get('sf_app_module_dir')); 
     50    $moduleNames = sfFinder::type('dir')->maxdepth(0)->relative()->in(sfConfig::get('sf_app_module_dir')); 
    5151 
    5252    $strings = array(); 
  • branches/dwhittle/1.1/lib/task/log/sfLogClearTask.class.php

    r7416 r8154  
    4141  protected function execute($arguments = array(), $options = array()) 
    4242  { 
    43     $logs = sfFinder::type('file')->ignore_version_control()->in(sfConfig::get('sf_log_dir')); 
     43    $logs = sfFinder::type('file')->in(sfConfig::get('sf_log_dir')); 
    4444    $this->getFilesystem()->remove($logs); 
    4545  } 
  • branches/dwhittle/1.1/lib/task/log/sfLogRotateTask.class.php

    r7349 r8154  
    9393 
    9494    // determine date of last rotation 
    95     $logs = sfFinder::type('file')->ignore_version_control()->maxdepth(1)->name($logfile.'_*.log')->in($logdir.DIRECTORY_SEPARATOR.'history'.DIRECTORY_SEPARATOR); 
     95    $logs = sfFinder::type('file')->maxdepth(1)->name($logfile.'_*.log')->in($logdir.'/history/'); 
    9696    $recentlog = is_array($logs) ? array_pop($logs) : null; 
    9797 
     
    138138 
    139139        // get all log history files for this application and environment 
    140         $newLogs = sfFinder::type('file')->ignore_version_control()->maxdepth(1)->name($logfile.'_*.log')->in($logdir.DIRECTORY_SEPARATOR.'history'.DIRECTORY_SEPARATOR); 
     140        $newLogs = sfFinder::type('file')->maxdepth(1)->name($logfile.'_*.log')->in($logdir.'/history/'); 
    141141 
    142142        // if the number of logs in history exceeds history then remove the oldest log 
  • branches/dwhittle/1.1/lib/task/project/sfProjectClearControllersTask.class.php

    r7618 r8154  
    6262  protected function execute($arguments = array(), $options = array()) 
    6363  { 
    64     $finder = sfFinder::type('file')->ignore_version_control()->maxdepth(1)->name('*.php'); 
     64    $finder = sfFinder::type('file')->maxdepth(1)->name('*.php'); 
    6565    foreach ($finder->in(sfConfig::get('sf_web_dir')) as $controller) 
    6666    { 
  • branches/dwhittle/1.1/lib/task/project/sfProjectFreezeTask.class.php

    r7989 r8154  
    8484    $this->getFilesystem()->mkdirs($sf_data_dir.DIRECTORY_SEPARATOR.'symfony'); 
    8585 
    86     $finder = sfFinder::type('any')->ignore_version_control()->exec(array($this, 'excludeTests')); 
     86    $finder = sfFinder::type('any')->exec(array($this, 'excludeTests')); 
    8787    $this->getFilesystem()->mirror($symfonyLibDir, sfConfig::get('sf_lib_dir').'/symfony', $finder); 
    8888    $this->getFilesystem()->mirror($symfonyDataDir, sfConfig::get('sf_data_dir').'/symfony', $finder); 
  • branches/dwhittle/1.1/lib/task/project/sfProjectPermissionsTask.class.php

    r7416 r8154  
    4848 
    4949    $dirs = array(sfConfig::get('sf_cache_dir'), sfConfig::get('sf_upload_dir'), sfConfig::get('sf_log_dir')); 
    50     $dirFinder = sfFinder::type('dir')->ignore_version_control()
    51     $fileFinder = sfFinder::type('file')->ignore_version_control()
     50    $dirFinder = sfFinder::type('dir')
     51    $fileFinder = sfFinder::type('file')
    5252    foreach ($dirs as $dir) 
    5353    { 
  • branches/dwhittle/1.1/lib/task/project/upgrade1.1/sfUpgrade.class.php

    r7918 r8154  
    108108  protected function getApplications() 
    109109  { 
    110     return sfFinder::type('dir')->maxdepth(0)->ignore_version_control()->relative()->in(sfConfig::get('sf_apps_dir')); 
     110    return sfFinder::type('dir')->maxdepth(0)->relative()->in(sfConfig::get('sf_apps_dir')); 
    111111  } 
    112112} 
  • branches/dwhittle/1.1/lib/task/sfFilesystem.class.php

    r7416 r8154  
    201201    if (!function_exists('symlink') && $copyOnWindows) 
    202202    { 
    203       $finder = sfFinder::type('any')->ignore_version_control()
     203      $finder = sfFinder::type('any')
    204204      $this->mirror($originDir, $targetDir, $finder); 
    205205      return; 
  • branches/dwhittle/1.1/lib/task/test/sfTestAllTask.class.php

    r7955 r8154  
    5252 
    5353    // register all tests 
    54     $finder = sfFinder::type('file')->ignore_version_control()->follow_link()->name('*Test.php'); 
     54    $finder = sfFinder::type('file')->follow_link()->name('*Test.php'); 
    5555    $h->register($finder->in($h->base_dir)); 
    5656 
  • branches/dwhittle/1.1/lib/task/test/sfTestFunctionalTask.class.php

    r7955 r8154  
    6464      foreach ($arguments['controller'] as $controller) 
    6565      { 
    66         $files = sfFinder::type('file')->ignore_version_control()->follow_link()->name(basename($controller).'Test.php')->in(sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'functional'.DIRECTORY_SEPARATOR.$app.DIRECTORY_SEPARATOR.dirname($controller)); 
     66        $files = sfFinder::type('file')->follow_link()->name(basename($controller).'Test.php')->in(sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'functional'.DIRECTORY_SEPARATOR.$app.DIRECTORY_SEPARATOR.dirname($controller)); 
    6767        foreach ($files as $file) 
    6868        { 
     
    7979 
    8080      // register functional tests 
    81       $finder = sfFinder::type('file')->ignore_version_control()->follow_link()->name('*Test.php'); 
     81      $finder = sfFinder::type('file')->follow_link()->name('*Test.php'); 
    8282      $h->register($finder->in($h->base_dir)); 
    8383 
  • branches/dwhittle/1.1/lib/task/test/sfTestUnitTask.class.php

    r7955 r8154  
    5959      foreach ($arguments['name'] as $name) 
    6060      { 
    61         $files = sfFinder::type('file')->ignore_version_control()->follow_link()->name(basename($name).'Test.php')->in(sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'unit'.DIRECTORY_SEPARATOR.dirname($name)); 
     61        $files = sfFinder::type('file')->follow_link()->name(basename($name).'Test.php')->in(sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'unit'.DIRECTORY_SEPARATOR.dirname($name)); 
    6262        foreach ($files as $file) 
    6363        { 
     
    7474 
    7575      // register unit tests 
    76       $finder = sfFinder::type('file')->ignore_version_control()->follow_link()->name('*Test.php'); 
     76      $finder = sfFinder::type('file')->follow_link()->name('*Test.php'); 
    7777      $h->register($finder->in($h->base_dir)); 
    7878 
  • branches/dwhittle/1.1/lib/util/sfFinder.class.php

    r7772 r8154  
    3131class sfFinder 
    3232{ 
    33   protected $type        = 'file'; 
    34   protected $names       = array(); 
    35   protected $prunes      = array(); 
    36   protected $discards    = array(); 
    37   protected $execs       = array(); 
    38   protected $mindepth    = 0; 
    39   protected $sizes       = array(); 
    40   protected $maxdepth    = 1000000; 
    41   protected $relative    = false; 
    42   protected $follow_link = false; 
    43   protected $sort        = false; 
     33  protected $type                   = 'file'; 
     34  protected $names                  = array(); 
     35  protected $prunes                 = array(); 
     36  protected $discards               = array(); 
     37  protected $execs                  = array(); 
     38  protected $mindepth               = 0; 
     39  protected $sizes                  = array(); 
     40  protected $maxdepth               = 1000000; 
     41  protected $relative               = false; 
     42  protected $follow_link            = false; 
     43  protected $sort                   = false; 
     44  protected $ignore_version_control = true; 
    4445 
    4546  /** 
     
    236237   * @return object current sfFinder object 
    237238   */ 
    238   public function ignore_version_control(
    239   { 
    240     $ignores = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg')
    241  
    242     return $this->discard($ignores)->prune($ignores)
     239  public function ignore_version_control($ignore = true
     240  { 
     241    $this->ignore_version_control = $ignore
     242 
     243    return $this
    243244  } 
    244245 
     
    334335    $arg_list = func_get_args(); 
    335336 
     337    $finder = clone $this; 
     338 
     339    if ($this->ignore_version_control) 
     340    { 
     341      $ignores = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'); 
     342 
     343      $finder->discard($ignores)->prune($ignores); 
     344    } 
     345 
    336346    // first argument is an array? 
    337347    if ($numargs == 1 && is_array($arg_list[0])) 
     
    362372      if ($this->relative) 
    363373      { 
    364         $files = array_merge($files, str_replace($dir.DIRECTORY_SEPARATOR, '', $this->search_in($dir))); 
     374        $files = array_merge($files, str_replace($dir.DIRECTORY_SEPARATOR, '', $finder->search_in($dir))); 
    365375      } 
    366376      else 
    367377      { 
    368         $files = array_merge($files, $this->search_in($dir)); 
     378        $files = array_merge($files, $finder->search_in($dir)); 
    369379      } 
    370380    } 
  • branches/dwhittle/1.1/test/bin/loc.php

    r7618 r8154  
    1313// symfony core LOC 
    1414$total_loc = 0; 
    15 $files = sfFinder::type('file')->name('*.php')->ignore_version_control()->prune('vendor')->in($root_dir.'/lib'); 
     15$files = sfFinder::type('file')->name('*.php')->prune('vendor')->in($root_dir.'/lib'); 
    1616foreach ($files as $file) 
    1717{ 
     
    2121// symfony tests LOC 
    2222$total_tests_loc = 0; 
    23 $files = sfFinder::type('file')->name('*Test.php')->ignore_version_control()->in(array($root_dir.'/test/unit', $root_dir.'/test/functional', $root_dir.'/test/other')); 
     23$files = sfFinder::type('file')->name('*Test.php')->in(array($root_dir.'/test/unit', $root_dir.'/test/functional', $root_dir.'/test/other')); 
    2424foreach ($files as $file) 
    2525{