Пример #1
0
 /**
  * Should manage creation and migration
  * @return bool
  */
 protected function createConfig()
 {
     $this->logger->info('Create config');
     $this->config = Config::create(getenv('HOME'), $this->git->getProjectRootDir());
     foreach (['global', 'project'] as $part) {
         if ('project' === $part && !$this->git->isInGitRepo()) {
             continue;
         }
         $this->initTwgitConfDir($part);
     }
 }
Пример #2
0
 /**
  */
 protected function initConfig()
 {
     $createConfigFile = false;
     $this->config = Config::create(getenv('HOME'), realpath(getcwd()));
     $this->config->set('twgit.protected.revision', self::REVISION);
     $sourceConfig = __DIR__ . '/../../app/config/config.yml.dist';
     foreach (['global', 'project'] as $part) {
         $configDir = sprintf($this->config->get(sprintf('twgit.protected.%s.root_dir', $part)));
         $configFile = sprintf('%s/%s', $configDir, $this->config->get('twgit.protected.config_file'));
         if ('project' === $part && !$this->isInGitRepo()) {
             continue;
         }
         if (!is_dir($configDir)) {
             mkdir($configDir, 0755);
         }
         if (!is_file($configFile)) {
             copy($sourceConfig, $configFile);
             $createConfigFile = true;
             $this->logger->help(sprintf('A %s config file has been created in "%s". Please configure it !', $part, $configFile));
         }
         $this->config->import($configFile);
         $sourceConfig = $configFile;
     }
     if ($createConfigFile) {
         exit(1);
     }
 }
Пример #3
0
 /**
  * Init configuration object
  */
 protected function initConfig()
 {
     $this->config = Config::create(getenv('HOME'), $this->git->getProjectRootDir());
     $this->config->set('twgit.protected.revision', Application::REVISION);
 }
Пример #4
0
 /**
  * Check if twgit is initialized by checking if config exists
  * @throws WorkflowException
  */
 protected function isTwgitInitialized()
 {
     $this->config = Config::create(getenv('HOME'), $this->git->getProjectRootDir());
     $configDir = sprintf($this->config->get(sprintf('twgit.protected.project.config_dir')));
     $configFile = sprintf('%s/%s', $configDir, $this->config->get('twgit.protected.config_file'));
     return file_exists($configFile);
 }