Example #1
0
 /**
  * Generate phpspec file/settings.
  *
  * @return void
  */
 protected function phpspec()
 {
     $this->testingVersion = '~2.0';
     $file = $this->file->get(__DIR__ . '/stubs/phpspec.stub');
     $content = str_replace('{namespace}', $this->createNamespace(), $file);
     $this->file->put($this->projectLower . '/' . 'phpspec.yml', $content);
     $this->exportIgnores[] = 'phpspec.yml';
 }
 /**
  * Determine if a configuration is applicable.
  *
  * @param  string  The default or a command line provided configuration file.
  * @return boolean
  */
 private function isConfigurationApplicable($configuration)
 {
     if ($configuration === $this->filesystem->getDefaultConfigurationFile() && $this->filesystem->hasDefaultConfigurationFile()) {
         return true;
     }
     if ($configuration !== $this->filesystem->getDefaultConfigurationFile()) {
         return true;
     }
     return false;
 }
Example #3
0
 /**
  * Generate phpspec config file, create a specs directory and
  * add package to development requirements.
  *
  * @return void
  */
 protected function phpspec()
 {
     $this->developmentRequirements[] = 'phpspec/phpspec';
     $file = $this->file->get(__DIR__ . '/stubs/phpspec.stub');
     $content = str_replace('{namespace}', $this->createNamespace(), $file);
     $this->file->makeDirectory($this->projectLower . '/specs');
     $this->exportIgnores[] = 'specs/';
     $this->file->put($this->projectLower . '/' . 'phpspec.yml.dist', $content);
     $this->exportIgnores[] = 'phpspec.yml.dist';
     $this->gitIgnores[] = 'phpspec.yml';
 }
 /**
  * Get settings derived from the configuration file.
  *
  * @param string                                       $configurationFile Path to the configuration file.
  * @param string                                       $projectName       Name of the project.
  * @param string                                       $keywords          Composer keywords.
  * @param \JonathanTorres\Construct\Helpers\Filesystem $filesystemHelper
  *
  * @return \JonathanTorres\Construct\Settings
  */
 public static function getSettings($configurationFile, $projectName, $keywords, $filesystemHelper)
 {
     if (!$filesystemHelper->isFile($configurationFile)) {
         $exceptionMessage = "Configuration file '{$configurationFile}' is not existent.";
         throw new \RuntimeException($exceptionMessage);
     }
     if (!$filesystemHelper->isReadable($configurationFile)) {
         $exceptionMessage = "Configuration file '{$configurationFile}' is not readable.";
         throw new \RuntimeException($exceptionMessage);
     }
     $configuration = Yaml::parse($filesystemHelper->get($configurationFile));
     $defaults = new Defaults();
     if (isset($configuration['construct-with'])) {
         $configuration['construct-with'] = array_flip($configuration['construct-with']);
     }
     if (isset($configuration['construct-with']['github'])) {
         $configuration['construct-with']['github-templates'] = true;
         $configuration['construct-with']['github-docs'] = true;
     }
     return new Settings($projectName, isset($configuration['test-framework']) ? $configuration['test-framework'] : $defaults->testingFrameworks[0], isset($configuration['license']) ? $configuration['license'] : $defaults->licenses[0], isset($configuration['namespace']) ? $configuration['namespace'] : null, isset($configuration['construct-with']['git']) ? true : false, isset($configuration['construct-with']['phpcs']) ? true : false, $keywords, isset($configuration['construct-with']['vagrant']) ? true : false, isset($configuration['construct-with']['editor-config']) ? true : false, isset($configuration['php']) ? (string) $configuration['php'] : PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION, isset($configuration['construct-with']['env']) ? true : false, isset($configuration['construct-with']['lgtm']) ? true : false, isset($configuration['construct-with']['github-templates']) ? true : false, isset($configuration['construct-with']['code-of-conduct']) ? true : false, isset($configuration['construct-with']['github-docs']) ? true : false);
 }