public function testIncludeThemes()
 {
     $finder = new ManifestFileFinder();
     $finder->setOption('name_regex', '/\\.txt$/');
     $finder->setOption('include_themes', true);
     $this->assertFinderFinds($finder, array('module/module.txt', 'themes/themes.txt'));
 }
Пример #2
0
 /**
  * Completely regenerates the manifest file.
  *
  * @param bool $cache Cache the result.
  */
 public function regenerateTrait($cache = true)
 {
     $this->traits = array();
     $finder = new \ManifestFileFinder();
     $finder->setOptions(array('name_regex' => '/^(_config.php|[^_].*\\.php)$/', 'ignore_files' => array('index.php', 'main.php', 'cli-script.php', 'SSTemplateParser.php'), 'ignore_tests' => false, 'file_callback' => array($this, 'handleTraitFile')));
     $finder->find($this->base);
     if ($cache) {
         $data = array('traits' => $this->traits);
         $this->cache->save($data, $this->cacheKey);
     }
 }
 /**
  * Completely regenerates the manifest file.
  */
 public function regenerate($cache = true)
 {
     $this->index = array('$statics' => array());
     $this->statics = array();
     $finder = new ManifestFileFinder();
     $finder->setOptions(array('name_regex' => '/^([^_].*\\.php)$/', 'ignore_files' => array('index.php', 'main.php', 'cli-script.php', 'SSTemplateParser.php'), 'ignore_tests' => !$this->tests, 'file_callback' => array($this, 'handleFile')));
     $finder->find($this->base);
     if ($cache) {
         $keysets = array();
         foreach ($this->statics as $class => $details) {
             if (in_array($class, self::$initial_classes)) {
                 $this->index['$statics'][$class] = $details;
             } else {
                 $key = sha1($class);
                 $this->index[$class]['key'] = $key;
                 $keysets[$key][$class] = $details;
             }
         }
         foreach ($keysets as $key => $details) {
             $this->cache->save($details, $this->key . '_' . $key);
         }
         $this->cache->save($this->index, $this->key);
     }
 }
 /**
  * Regenerates the manifest by scanning the base path.
  *
  * @param bool $cache
  */
 public function regenerate($cache = true)
 {
     $finder = new ManifestFileFinder();
     $finder->setOptions(array('name_regex' => '/\\.ss$/', 'include_themes' => true, 'ignore_tests' => !$this->tests, 'file_callback' => array($this, 'handleFile')));
     $finder->find($this->base);
     if ($cache) {
         $this->cache->save($this->templates, $this->cacheKey);
     }
     $this->inited = true;
 }
Пример #5
0
	/**
	 * Completely regenerates the manifest file. Scans through finding all php _config.php and yaml _config/*.ya?ml files,
	 * parses the yaml files into fragments, sorts them and figures out what values need to be checked to pick the
	 * correct variant.
	 *
	 * Does _not_ build the actual variant
	 *
	 * @param bool $cache Cache the result.
	 */
	public function regenerate($includeTests = false, $cache = true) {
		$this->phpConfigSources = array();
		$this->yamlConfigFragments = array();
		$this->variantKeySpec = array();

		$finder = new ManifestFileFinder();
		$finder->setOptions(array(
			'name_regex'    => '/_config.php$/',
			'ignore_tests'  => !$includeTests,
			'file_callback' => array($this, 'addSourceConfigFile')
		));
		$finder->find($this->base);

		$finder = new ManifestFileFinder();
		$finder->setOptions(array(
			'name_regex'    => '/\.ya?ml$/',
			'ignore_tests'  => !$includeTests,
			'file_callback' => array($this, 'addYAMLConfigFile')
		));
		$finder->find($this->base);

		$this->prefilterYamlFragments();
		$this->sortYamlFragments();
		$this->buildVariantKeySpec();

		if ($cache) {
			$this->cache->save($this->phpConfigSources, 'php_config_sources');
			$this->cache->save($this->yamlConfigFragments, 'yaml_config_fragments');
			$this->cache->save($this->variantKeySpec, 'variant_key_spec');
		}
	}
 /**
  * Completely regenerates the manifest file.
  *
  * @param bool $cache Cache the result.
  */
 public function regenerate($cache = true)
 {
     $reset = array('classes', 'roots', 'children', 'descendants', 'interfaces', 'implementors', 'configs', 'configDirs', 'traits');
     // Reset the manifest so stale info doesn't cause errors.
     foreach ($reset as $reset) {
         $this->{$reset} = array();
     }
     $this->setDefaults();
     $finder = new ManifestFileFinder();
     $finder->setOptions(array('name_regex' => '/^(_config.php|[^_].*\\.php)$/', 'ignore_files' => array('index.php', 'main.php', 'cli-script.php', 'SSTemplateParser.php'), 'ignore_tests' => !$this->tests, 'file_callback' => array($this, 'handleFile'), 'dir_callback' => array($this, 'handleDir')));
     $finder->find($this->base);
     foreach ($this->roots as $root) {
         $this->coalesceDescendants($root);
     }
     if ($cache) {
         $data = array('classes' => $this->classes, 'descendants' => $this->descendants, 'interfaces' => $this->interfaces, 'implementors' => $this->implementors, 'configs' => $this->configs, 'configDirs' => $this->configDirs, 'traits' => $this->traits);
         $this->cache->save($data, $this->cacheKey);
     }
 }