Index: /plugins/sfFilesystemFixturesPlugin/branches/0.1/lib/task/sfFilesystemFixturesLoadTask.class.php =================================================================== --- /plugins/sfFilesystemFixturesPlugin/branches/0.1/lib/task/sfFilesystemFixturesLoadTask.class.php (revision 31443) +++ /plugins/sfFilesystemFixturesPlugin/branches/0.1/lib/task/sfFilesystemFixturesLoadTask.class.php (revision 31443) @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** +* Loads filesystem fixture data. +* +* @package sfFilesystemFixturesPlugin +* @author Erin Millard +* @version $Id$ +*/ +class sfFilesystemFixturesLoadTask extends sfBaseTask +{ + /** + * @see sfTask + */ + protected function configure() + { + $this->addOptions(array( + new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', null), + new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), + )); + + $this->namespace = 'fs-fixtures'; + $this->name = 'load'; + $this->briefDescription = 'Loads filesystem fixture data'; + $this->detailedDescription = <<processDirectory(sfConfig::get('sf_data_dir').'/fs_fixtures'); + $this->processDirectory(sfConfig::get('sf_data_dir').'/fs_fixtures_'.sfFilesystemFixtures::getInstance()->getEnvironment()); + } + + /** + * Copies files from the filesystem fixtures directory to their intended locations + * + * @param string $path The path containing the filesystem fixtures + */ + protected function processDirectory($path) + { + if (!is_dir($path)) return; + if (!$path = realpath($path)) return; + + $this->logSection('fs-fixtures', 'Loading fs fixtures from "'.$path.'"'); + sfFilesystemFixtures::getInstance()->processDirectory($path); + } +}