Development

Changeset 8148

You must first sign up to be able to contribute.

Changeset 8148

Show
Ignore:
Timestamp:
03/29/08 08:58:59 (1 year ago)
Author:
fabien
Message:

made sfFinder::ignore_version_control the default (you can disable it by calling ignore_version_control(false)) (refs #2795)

Files:

Legend:

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

    r8075 r8148  
    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/1.1/lib/autoload/sfCoreAutoload.class.php

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

    r7786 r8148  
    182182  public function addDirectory($dir, $ext = '.php') 
    183183  { 
    184     $finder = sfFinder::type('file')->ignore_version_control()->follow_link()->name('*'.$ext); 
     184    $finder = sfFinder::type('file')->follow_link()->name('*'.$ext); 
    185185    foreach (glob($dir) as $dir) 
    186186    { 
  • branches/1.1/lib/config/sfAutoloadConfigHandler.class.php

    r7849 r8148  
    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/1.1/lib/generator/sfCrudGenerator.class.php

    r7614 r8148  
    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/1.1/lib/i18n/extract/sfI18nApplicationExtract.class.php

    r7691 r8148  
    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/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php

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

    r7691 r8148  
    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/1.1/lib/task/cache/sfCacheClearTask.class.php

    r8060 r8148  
    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  } 
     
    148148    { 
    149149      // remove cache files 
    150       $this->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in($subDir)); 
     150      $this->getFilesystem()->remove(sfFinder::type('file')->discard('.sf')->in($subDir)); 
    151151    } 
    152152  } 
  • branches/1.1/lib/task/generator/sfGenerateAppTask.class.php

    r8086 r8148  
    8383 
    8484    // Create basic application structure 
    85     $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
     85    $finder = sfFinder::type('any')->discard('.sf'); 
    8686    $this->getFilesystem()->mirror(dirname(__FILE__).'/skeleton/app/app', $appDir, $finder); 
    8787 
  • branches/1.1/lib/task/generator/sfGenerateModuleTask.class.php

    r7691 r8148  
    9696 
    9797    // create basic application structure 
    98     $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
     98    $finder = sfFinder::type('any')->discard('.sf'); 
    9999    $this->getFilesystem()->mirror($skeletonDir.'/module', $moduleDir, $finder); 
    100100 
  • branches/1.1/lib/task/generator/sfGenerateProjectTask.class.php

    r7962 r8148  
    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__).'/skeleton/project', sfConfig::get('sf_root_dir'), $finder); 
    7272 
  • branches/1.1/lib/task/i18n/sfI18nFindTask.class.php

    r7691 r8148  
    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    $strings = array(); 
    5252    foreach ($moduleNames as $moduleName) 
  • branches/1.1/lib/task/log/sfLogClearTask.class.php

    r7401 r8148  
    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/1.1/lib/task/log/sfLogRotateTask.class.php

    r7335 r8148  
    9898 
    9999    // determine date of last rotation 
    100     $logs = sfFinder::type('file')->ignore_version_control()->maxdepth(1)->name($logfile.'_*.log')->in($logdir.'/history/'); 
     100    $logs = sfFinder::type('file')->maxdepth(1)->name($logfile.'_*.log')->in($logdir.'/history/'); 
    101101    $recentlog = is_array($logs) ? array_pop($logs) : null; 
    102102 
     
    143143 
    144144        // get all log history files for this application and environment 
    145         $newLogs = sfFinder::type('file')->ignore_version_control()->maxdepth(1)->name($logfile.'_*.log')->in($logdir.'/history/'); 
     145        $newLogs = sfFinder::type('file')->maxdepth(1)->name($logfile.'_*.log')->in($logdir.'/history/'); 
    146146 
    147147        // if the number of logs in history exceeds history then remove the oldest log 
  • branches/1.1/lib/task/project/sfProjectClearControllersTask.class.php

    r7614 r8148  
    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/1.1/lib/task/project/sfProjectFreezeTask.class.php

    r7962 r8148  
    7979    $this->getFilesystem()->mkdirs('data'.DIRECTORY_SEPARATOR.'symfony'); 
    8080 
    81     $finder = sfFinder::type('any')->ignore_version_control()->exec(array($this, 'excludeTests')); 
     81    $finder = sfFinder::type('any')->exec(array($this, 'excludeTests')); 
    8282    $this->getFilesystem()->mirror($symfonyLibDir, sfConfig::get('sf_lib_dir').'/symfony', $finder); 
    8383    $this->getFilesystem()->mirror($symfonyDataDir, sfConfig::get('sf_data_dir').'/symfony', $finder); 
  • branches/1.1/lib/task/project/sfProjectPermissionsTask.class.php

    r7401 r8148  
    4747 
    4848    $dirs = array(sfConfig::get('sf_cache_dir'), sfConfig::get('sf_upload_dir'), sfConfig::get('sf_log_dir')); 
    49     $dirFinder = sfFinder::type('dir')->ignore_version_control()
    50     $fileFinder = sfFinder::type('file')->ignore_version_control()
     49    $dirFinder = sfFinder::type('dir')
     50    $fileFinder = sfFinder::type('file')
    5151    foreach ($dirs as $dir) 
    5252    { 
  • branches/1.1/lib/task/project/upgrade1.1/sfUpgrade.class.php

    r7917 r8148  
    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/1.1/lib/task/sfFilesystem.class.php

    r7397 r8148  
    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/1.1/lib/task/test/sfTestAllTask.class.php

    r7953 r8148  
    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/1.1/lib/task/test/sfTestFunctionalTask.class.php

    r7953 r8148  
    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/1.1/lib/task/test/sfTestUnitTask.class.php

    r7953 r8148  
    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/1.1/lib/util/sfFinder.class.php

    r7765 r8148  
    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/1.1/test/bin/loc.php

    r7614 r8148  
    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{ 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.