Changeset 7401
- Timestamp:
- 02/08/08 09:01:18 (10 months ago)
- Files:
-
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBaseTask.class.php (modified) (2 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataDumpTask.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php (modified) (4 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelInitAdminTask.class.php (modified) (2 diffs)
- branches/1.1/lib/task/cache/sfCacheClearTask.class.php (modified) (3 diffs)
- branches/1.1/lib/task/generator/sfGenerateAppTask.class.php (modified) (3 diffs)
- branches/1.1/lib/task/generator/sfGenerateControllerTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/generator/sfGenerateModuleTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/generator/sfGenerateProjectTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/log/sfLogClearTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectClearControllersTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectDeployTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectDisableTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectEnableTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectFreezeTask.class.php (modified) (2 diffs)
- branches/1.1/lib/task/project/sfProjectPermissionsTask.class.php (modified) (2 diffs)
- branches/1.1/lib/task/project/sfProjectUnfreezeTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/sfBaseTask.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBaseTask.class.php
r7398 r7401 170 170 } 171 171 172 $this-> filesystem->copy($schema, 'config'.DIRECTORY_SEPARATOR.$localprefix.basename($schema));172 $this->getFilesystem()->copy($schema, 'config'.DIRECTORY_SEPARATOR.$localprefix.basename($schema)); 173 173 if ('' === $localprefix) 174 174 { 175 $this-> filesystem->remove($schema);175 $this->getFilesystem()->remove($schema); 176 176 } 177 177 } … … 181 181 { 182 182 $finder = sfFinder::type('file')->name('generated-*schema.xml'); 183 $this-> filesystem->remove($finder->in(array('config', 'plugins')));183 $this->getFilesystem()->remove($finder->in(array('config', 'plugins'))); 184 184 } 185 185 branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataDumpTask.class.php
r7399 r7401 81 81 { 82 82 $dir = sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'fixtures'; 83 $this-> filesystem->mkdirs($dir);83 $this->getFilesystem()->mkdirs($dir); 84 84 $filename = $dir.DIRECTORY_SEPARATOR.$filename; 85 85 branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php
r7333 r7401 113 113 114 114 // copy our generated module 115 $this-> filesystem->mirror($tmpDir.'/auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any'));115 $this->getFilesystem()->mirror($tmpDir.'/auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any')); 116 116 117 117 if (!$options['with-show']) 118 118 { 119 $this-> filesystem->remove($moduleDir.'/templates/showSuccess.php');119 $this->getFilesystem()->remove($moduleDir.'/templates/showSuccess.php'); 120 120 } 121 121 122 122 // change module name 123 $this-> filesystem->replaceTokens($moduleDir.'/actions/actions.class.php', '', '', array('auto'.ucfirst($arguments['module']) => $arguments['module']));123 $this->getFilesystem()->replaceTokens($moduleDir.'/actions/actions.class.php', '', '', array('auto'.ucfirst($arguments['module']) => $arguments['module'])); 124 124 125 125 // customize php and yml files 126 126 $finder = sfFinder::type('file')->name('*.php', '*.yml'); 127 $this-> filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants);127 $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 128 128 129 129 // create basic test 130 $this-> filesystem->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/module/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php');130 $this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/module/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php'); 131 131 132 132 // customize test file 133 $this-> filesystem->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants);133 $this->getFilesystem()->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 134 134 135 135 // delete temp files 136 $this-> filesystem->remove(sfFinder::type('any')->in($tmpDir));136 $this->getFilesystem()->remove(sfFinder::type('any')->in($tmpDir)); 137 137 } 138 138 … … 148 148 if (is_dir($dir)) 149 149 { 150 $this-> filesystem->mirror($dir, $moduleDir, $finder);150 $this->getFilesystem()->mirror($dir, $moduleDir, $finder); 151 151 break; 152 152 } … … 154 154 155 155 // create basic test 156 $this-> filesystem->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/module/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php');156 $this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/module/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php'); 157 157 158 158 // customize test file 159 $this-> filesystem->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants);159 $this->getFilesystem()->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 160 160 161 161 // customize php and yml files … … 166 166 $options['with-show'] ? 'true' : 'false' 167 167 ); 168 $this-> filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants);168 $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 169 169 } 170 170 } branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelInitAdminTask.class.php
r7333 r7401 83 83 if (is_dir($dir)) 84 84 { 85 $this-> filesystem->mirror($dir, $moduleDir, $finder);85 $this->getFilesystem()->mirror($dir, $moduleDir, $finder); 86 86 break; 87 87 } … … 90 90 // customize php and yml files 91 91 $finder = sfFinder::type('file')->name('*.php', '*.yml'); 92 $this-> filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $constants);92 $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $constants); 93 93 } 94 94 } branches/1.1/lib/task/cache/sfCacheClearTask.class.php
r7335 r7401 95 95 if (!$mainApp) 96 96 { 97 $this-> filesystem->remove($finder->in(sfConfig::get('sf_cache_dir')));97 $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_cache_dir'))); 98 98 } 99 99 … … 146 146 else 147 147 { 148 $this-> filesystem->remove($finder->in(sfConfig::get('sf_root_dir').'/'.$subDir));148 $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_root_dir').'/'.$subDir)); 149 149 } 150 150 } … … 163 163 { 164 164 // create a lock file 165 $this-> filesystem->touch(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck');165 $this->getFilesystem()->touch(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck'); 166 166 167 167 // change mode so the web user can remove it if we die 168 $this-> filesystem->chmod(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck', 0777);168 $this->getFilesystem()->chmod(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck', 0777); 169 169 170 170 // remove cache files 171 $this-> filesystem->remove($finder->in(sfConfig::get('sf_root_dir').'/'.$subDir));171 $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_root_dir').'/'.$subDir)); 172 172 173 173 // release lock 174 $this-> filesystem->remove(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck');174 $this->getFilesystem()->remove(sfConfig::get('sf_cache_dir').'/'.$lockName.'.lck'); 175 175 } 176 176 } branches/1.1/lib/task/generator/sfGenerateAppTask.class.php
r7400 r7401 84 84 // Create basic application structure 85 85 $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 86 $this-> filesystem->mirror(dirname(__FILE__).'/skeleton/app/app', $appDir, $finder);86 $this->getFilesystem()->mirror(dirname(__FILE__).'/skeleton/app/app', $appDir, $finder); 87 87 88 88 // Create $app.php or index.php if it is our first app … … 96 96 // Set no_script_name value in settings.yml for production environment 97 97 $finder = sfFinder::type('file')->name('settings.yml'); 98 $this-> filesystem->replaceTokens($finder->in($appDir.'/'.sfConfig::get('sf_app_config_dir_name')), '##', '##', array('NO_SCRIPT_NAME' => ($firstApp ? 'on' : 'off')));98 $this->getFilesystem()->replaceTokens($finder->in($appDir.'/'.sfConfig::get('sf_app_config_dir_name')), '##', '##', array('NO_SCRIPT_NAME' => ($firstApp ? 'on' : 'off'))); 99 99 100 $this-> filesystem->copy(dirname(__FILE__).'/skeleton/app/web/index.php', sfConfig::get('sf_web_dir').'/'.$indexName.'.php');101 $this-> filesystem->copy(dirname(__FILE__).'/skeleton/app/web/index_dev.php', sfConfig::get('sf_web_dir').'/'.$app.'_dev.php');100 $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/app/web/index.php', sfConfig::get('sf_web_dir').'/'.$indexName.'.php'); 101 $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/app/web/index_dev.php', sfConfig::get('sf_web_dir').'/'.$app.'_dev.php'); 102 102 103 103 $finder = sfFinder::type('file')->name($indexName.'.php', $app.'_dev.php'); 104 $this-> filesystem->replaceTokens($finder->in(sfConfig::get('sf_web_dir')), '##', '##', array('APP_NAME' => $app));104 $this->getFilesystem()->replaceTokens($finder->in(sfConfig::get('sf_web_dir')), '##', '##', array('APP_NAME' => $app)); 105 105 106 106 $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter); … … 109 109 110 110 // Create test dir 111 $this-> filesystem->mkdirs(sfConfig::get('sf_test_dir').'/functional/'.$app);111 $this->getFilesystem()->mkdirs(sfConfig::get('sf_test_dir').'/functional/'.$app); 112 112 } 113 113 } branches/1.1/lib/task/generator/sfGenerateControllerTask.class.php
r7296 r7401 79 79 ); 80 80 81 $this-> filesystem->copy(dirname(__FILE__).'/skeleton/controller/controller.php', sfConfig::get('sf_web_dir').'/'.$controller.'.php');82 $this-> filesystem->replaceTokens(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$controller.'.php', '##', '##', $constants);81 $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/controller/controller.php', sfConfig::get('sf_web_dir').'/'.$controller.'.php'); 82 $this->getFilesystem()->replaceTokens(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$controller.'.php', '##', '##', $constants); 83 83 } 84 84 } branches/1.1/lib/task/generator/sfGenerateModuleTask.class.php
r7333 r7401 97 97 // create basic application structure 98 98 $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 99 $this-> filesystem->mirror($skeletonDir.'/module', $moduleDir, $finder);99 $this->getFilesystem()->mirror($skeletonDir.'/module', $moduleDir, $finder); 100 100 101 101 // create basic test 102 $this-> filesystem->copy($skeletonDir.'/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$app.'/'.$module.'ActionsTest.php');102 $this->getFilesystem()->copy($skeletonDir.'/test/actionsTest.php', sfConfig::get('sf_test_dir').'/functional/'.$app.'/'.$module.'ActionsTest.php'); 103 103 104 104 // customize test file 105 $this-> filesystem->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$app.DIRECTORY_SEPARATOR.$module.'ActionsTest.php', '##', '##', $constants);105 $this->getFilesystem()->replaceTokens(sfConfig::get('sf_test_dir').'/functional/'.$app.DIRECTORY_SEPARATOR.$module.'ActionsTest.php', '##', '##', $constants); 106 106 107 107 // customize php and yml files 108 108 $finder = sfFinder::type('file')->name('*.php', '*.yml'); 109 $this-> filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $constants);109 $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $constants); 110 110 } 111 111 } branches/1.1/lib/task/generator/sfGenerateProjectTask.class.php
r7400 r7401 69 69 // Create basic project structure 70 70 $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 71 $this-> filesystem->mirror(dirname(__FILE__).'/skeleton/project', sfConfig::get('sf_root_dir'), $finder);71 $this->getFilesystem()->mirror(dirname(__FILE__).'/skeleton/project', sfConfig::get('sf_root_dir'), $finder); 72 72 73 73 // Update project name and directory 74 74 $finder = sfFinder::type('file')->name('properties.ini', 'apache.conf', 'propel.ini'); 75 $this-> filesystem->replaceTokens($finder->in(sfConfig::get('sf_config_dir')), '##', '##', array('PROJECT_NAME' => $arguments['name'],75 $this->getFilesystem()->replaceTokens($finder->in(sfConfig::get('sf_config_dir')), '##', '##', array('PROJECT_NAME' => $arguments['name'], 76 76 'PROJECT_DIR' => sfConfig::get('sf_root_dir'))); 77 77 78 78 // Update config/config.php 79 $this-> filesystem->replaceTokens(sfConfig::get('sf_config_dir').'/config.php', '##', '##', array(79 $this->getFilesystem()->replaceTokens(sfConfig::get('sf_config_dir').'/config.php', '##', '##', array( 80 80 'SYMFONY_LIB_DIR' => sfConfig::get('sf_symfony_lib_dir'), 81 81 )); branches/1.1/lib/task/log/sfLogClearTask.class.php
r6931 r7401 42 42 { 43 43 $logs = sfFinder::type('file')->ignore_version_control()->in(sfConfig::get('sf_log_dir')); 44 $this-> filesystem->remove($logs);44 $this->getFilesystem()->remove($logs); 45 45 } 46 46 } branches/1.1/lib/task/project/sfProjectClearControllersTask.class.php
r6931 r7401 72 72 if (isset($foundApp[1]) && isset($env[1]) && $env[1] != 'prod') 73 73 { 74 $this-> filesystem->remove($controller);74 $this->getFilesystem()->remove($controller); 75 75 } 76 76 } branches/1.1/lib/task/project/sfProjectDeployTask.class.php
r7397 r7401 146 146 $dryRun = $options['go'] ? '' : '--dry-run'; 147 147 148 $this->log($this-> filesystem->sh("rsync --progress $dryRun $parameters -e $ssh ./ $user$host:$dir"));148 $this->log($this->getFilesystem()->sh("rsync --progress $dryRun $parameters -e $ssh ./ $user$host:$dir")); 149 149 } 150 150 } branches/1.1/lib/task/project/sfProjectDisableTask.class.php
r7397 r7401 55 55 } 56 56 57 $this-> filesystem->touch($lockFile);57 $this->getFilesystem()->touch($lockFile); 58 58 59 59 $this->logSection('enable', sprintf('%s [%s] has been DISABLED', $app, $env)); branches/1.1/lib/task/project/sfProjectEnableTask.class.php
r7400 r7401 55 55 } 56 56 57 $this-> filesystem->remove($lockFile);57 $this->getFilesystem()->remove($lockFile); 58 58 59 59 $clearCache = new sfCacheClearTask($this->dispatcher, $this->formatter); branches/1.1/lib/task/project/sfProjectFreezeTask.class.php
r7397 r7401 67 67 if (is_link(sfConfig::get('sf_web_dir').'/sf')) 68 68 { 69 $this-> filesystem->remove(sfConfig::get('sf_web_dir').'/sf');69 $this->getFilesystem()->remove(sfConfig::get('sf_web_dir').'/sf'); 70 70 } 71 71 … … 76 76 $this->logSection('freeze', sprintf('freezing data found in "%s"', $symfony_data_dir)); 77 77 78 $this-> filesystem->mkdirs('lib'.DIRECTORY_SEPARATOR.'symfony');79 $this-> filesystem->mkdirs('data'.DIRECTORY_SEPARATOR.'symfony');78 $this->getFilesystem()->mkdirs('lib'.DIRECTORY_SEPARATOR.'symfony'); 79 $this->getFilesystem()->mkdirs('data'.DIRECTORY_SEPARATOR.'symfony'); 80 80 81 81 $finder = sfFinder::type('any')->ignore_version_control(); 82 $this-> filesystem->mirror($symfony_lib_dir, sfConfig::get('sf_lib_dir').'/symfony', $finder);83 $this-> filesystem->mirror($symfony_data_dir, sfConfig::get('sf_data_dir').'/symfony', $finder);82 $this->getFilesystem()->mirror($symfony_lib_dir, sfConfig::get('sf_lib_dir').'/symfony', $finder); 83 $this->getFilesystem()->mirror($symfony_data_dir, sfConfig::get('sf_data_dir').'/symfony', $finder); 84 84 85 $this-> filesystem->rename(sfConfig::get('sf_data_dir').'/symfony/web/sf', sfConfig::get('sf_web_dir').'/sf');85 $this->getFilesystem()->rename(sfConfig::get('sf_data_dir').'/symfony/web/sf', sfConfig::get('sf_web_dir').'/sf'); 86 86 87 87 // change symfony paths in config/config.php branches/1.1/lib/task/project/sfProjectPermissionsTask.class.php
r7336 r7401 41 41 protected function execute($arguments = array(), $options = array()) 42 42 { 43 $this-> filesystem->chmod(sfConfig::get('sf_cache_dir'), 0777);44 $this-> filesystem->chmod(sfConfig::get('sf_log_dir'), 0777);45 $this-> filesystem->chmod(sfConfig::get('sf_upload_dir'), 0777);46 $this-> filesystem->chmod(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'symfony', 0777);43 $this->getFilesystem()->chmod(sfConfig::get('sf_cache_dir'), 0777); 44 $this->getFilesystem()->chmod(sfConfig::get('sf_log_dir'), 0777); 45 $this->getFilesystem()->chmod(sfConfig::get('sf_upload_dir'), 0777); 46 $this->getFilesystem()->chmod(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'symfony', 0777); 47 47 48 48 $dirs = array(sfConfig::get('sf_cache_dir'), sfConfig::get('sf_upload_dir'), sfConfig::get('sf_log_dir')); … … 51 51 foreach ($dirs as $dir) 52 52 { 53 $this-> filesystem->chmod($dirFinder->in($dir), 0777);54 $this-> filesystem->chmod($fileFinder->in($dir), 0666);53 $this->getFilesystem()->chmod($dirFinder->in($dir), 0777); 54 $this->getFilesystem()->chmod($fileFinder->in($dir), 0666); 55 55 } 56 56 } branches/1.1/lib/task/project/sfProjectUnfreezeTask.class.php
r7332 r7401 54 54 55 55 $finder = sfFinder::type('any'); 56 $this-> filesystem->remove($finder->in(sfConfig::get('sf_lib_dir').'/symfony'));57 $this-> filesystem->remove(sfConfig::get('sf_lib_dir').'/symfony');58 $this-> filesystem->remove($finder->in(sfConfig::get('sf_data_dir').'/symfony'));59 $this-> filesystem->remove(sfConfig::get('sf_data_dir').'/symfony');60 $this-> filesystem->remove($finder->in(sfConfig::get('sf_web_dir').'/sf'));61 $this-> filesystem->remove(sfConfig::get('sf_web_dir').'/sf');56 $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_lib_dir').'/symfony')); 57 $this->getFilesystem()->remove(sfConfig::get('sf_lib_dir').'/symfony'); 58 $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_data_dir').'/symfony')); 59 $this->getFilesystem()->remove(sfConfig::get('sf_data_dir').'/symfony'); 60 $this->getFilesystem()->remove($finder->in(sfConfig::get('sf_web_dir').'/sf')); 61 $this->getFilesystem()->remove(sfConfig::get('sf_web_dir').'/sf'); 62 62 } 63 63 branches/1.1/lib/task/sfBaseTask.class.php
r7400 r7401 42 42 } 43 43 44 public function __get($key) 44 /** 45 * Returns the filesystem instance. 46 * 47 * @return sfFilesystem A sfFilesystem instance 48 */ 49 public function getFilesystem() 45 50 { 46 switch ($key)51 if (!isset($this->filesystem)) 47 52 { 48 case 'filesystem': 49 if (!isset($this->filesystem)) 50 { 51 if (is_null($this->commandApplication) || $this->commandApplication->isVerbose()) 52 { 53 $this->filesystem = new sfFilesystem($this->dispatcher, $this->formatter); 54 } 55 else 56 { 57 $this->filesystem = new sfFilesystem(); 58 } 59 } 53 if (is_null($this->commandApplication) || $this->commandApplication->isVerbose()) 54 { 55 $this->filesystem = new sfFilesystem($this->dispatcher, $this->formatter); 56 } 57 else 58 { 59 $this->filesystem = new sfFilesystem(); 60 } 61 } 60 62 61 return $this->filesystem; 62 default: 63 trigger_error(sprintf('Undefined property: %s::$%s', get_class($this), $key), E_USER_NOTICE); 64 } 63 return $this->filesystem; 65 64 } 66 65