コード例 #1
0
ファイル: Extensions.php プロジェクト: nickw108/jumpstorm
 /**
  * install extension
  *
  * @param string $name
  * @param object $extension
  * @return void
  */
 protected function installExtension($name, $extension)
 {
     Logger::log('Installing extension %s from %s', array($name, $extension->source));
     // copy from source to install directory
     $sourceModel = Source::getSourceModel($extension->source);
     $sourceModel->copy($this->getExtensionFolder() . DIRECTORY_SEPARATOR . $name, $extension->branch);
     $this->deployExtension($name);
     Logger::notice('Installed extension %s', array($name));
 }
コード例 #2
0
ファイル: Unittesting.php プロジェクト: nickw108/jumpstorm
 /**
  * @see vendor/symfony/src/Symfony/Component/Console/Command/Symfony\Component\Console\Command.Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->preExecute($input, $output);
     // deploy unittesting framework using extensions command
     $config = $this->config->unittesting;
     $this->installExtension($config->framework, $config->extension);
     // apply some configuration
     $this->setupTestDatabase();
     Logger::notice('Done');
 }
コード例 #3
0
ファイル: Plugins.php プロジェクト: nickw108/jumpstorm
 /**
  * @see vendor/symfony/src/Symfony/Component/Console/Command/Symfony\Component\Console\Command.Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->preExecute($input, $output);
     $this->initMagento();
     $plugins = $this->config->getPlugins();
     foreach ($plugins as $name => $settings) {
         // check if plugin was defined in ini, but disabled
         if ('0' === $settings->enabled) {
             Logger::log('Skipping plugin "%s"', array($name));
             continue;
         }
         // set path to plugin by convention
         $path = $this->getBasePath() . 'plugins' . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR;
         // load script file
         $file = $path . $name . '.php';
         if (!file_exists($file)) {
             Logger::error('Could not find plugin "%s"', array($name), $stop = false);
             Logger::log('Expected it at path "%s"', array($path));
             continue;
         }
         // load default jumpstorm config for plugin execution
         $pluginConfig = $this->config;
         $customIni = $settings->ini;
         if (null !== $customIni && file_exists($customIni)) {
             unset($settings->ini);
             // add custom config settings, if given
             $pluginConfig = new Config($customIni, null, array('allowModifications' => true));
             $pluginConfig->merge($this->config);
         }
         Logger::comment(sprintf('Running plugin "%s"', $name));
         $class = "{$name}\\{$name}";
         $plugin = new $class($pluginConfig);
         $plugin->execute();
         Logger::notice(sprintf('Finished running plugin "%s"', $name));
     }
     Logger::notice('Done');
 }
コード例 #4
0
ファイル: CodeCoverage.php プロジェクト: djnewtown/judge
 /**
  * Check if all prerequisites for running unit tests are fullfilled or can
  * be fulfilled by using Jumpstorm.
  *
  * @param string $extensionPath Path to the extension to be evaluated
  * @throws \Exception
  */
 protected function _setupUnitTestEnvironment($extensionPath)
 {
     /**
      * getting the neccessary information like magento target from
      * the jumpstorm configuration even jumpstorm is not used to set up
      * the test environment
      */
     if (!$this->_settings->jumpstormIniFile) {
         throw new \Exception("Required information missing in ini file: plugins.CodeCoverage.jumpstormIniFile");
     }
     $jumpstormConfig = new \Zend_Config_Ini($this->_settings->jumpstormIniFile, null, array('allowModifications' => true));
     // check if required ini section is given
     if (!$jumpstormConfig->common) {
         throw new \Exception("Required information missing in jumpstorm ini file: [common]");
     }
     if ($this->_config->token) {
         $jumpstormConfig->common->magento->target = $jumpstormConfig->common->magento->target . '_' . $this->_config->token;
         $jumpstormConfig->common->db->name = $jumpstormConfig->common->db->name . '_' . $this->_config->token;
     }
     $this->_magentoTarget = rtrim($jumpstormConfig->common->magento->target, DIRECTORY_SEPARATOR);
     $this->_testDbName = $jumpstormConfig->common->db->name;
     // import test environment configuration from console: [extensions] section
     $jumpstormConfig->extensions = array('extension' => array('source' => $extensionPath));
     // force (re)installation using jumpstorm
     if ($this->_settings->useJumpstorm) {
         $requiredSections = array('magento', 'unittesting');
         foreach ($requiredSections as $section) {
             if (!$jumpstormConfig->{$section}) {
                 throw new \Exception("Required information missing in jumpstorm ini file: [{$section}]");
             }
         }
         $iniFile = 'tmp/jumpstorm' . (string) $this->_config->token . '.ini';
         $writer = new \Zend_Config_Writer_Ini();
         $writer->write($iniFile, $jumpstormConfig);
         $executable = 'vendor/netresearch/jumpstorm/jumpstorm';
         $params = '';
         if (Logger::VERBOSITY_MAX == Logger::getVerbosity()) {
             $params .= ' -v';
         }
         $command = sprintf('%s magento -c %s %s', $executable, $iniFile, $params) . ' && ' . sprintf('%s unittesting -c %s %s', $executable, $iniFile, $params) . ' && ' . sprintf('%s extensions -c %s %s', $executable, $iniFile, $params);
         Logger::notice('Setting up Magento environment via Jumpstorm');
         $output = $this->_executeCommand($command);
         if (Logger::VERBOSITY_MAX == Logger::getVerbosity()) {
             Logger::log(implode("\n", $output));
         }
         unlink($iniFile);
     }
 }
コード例 #5
0
ファイル: Extensions.php プロジェクト: netresearch/jumpstorm
 /**
  * install extension
  *
  * @param string $alias
  * @param Zend_Config $extension
  * @return void
  */
 protected function installExtension($alias, \Zend_Config $extension)
 {
     Logger::log('Installing extension %s from %s', array($alias, $extension->source));
     $this->extensionDir = $this->extensionRootDir . DIRECTORY_SEPARATOR . $alias;
     // cleanup modman directory
     exec('rm -rf ' . $this->extensionDir);
     if ($this->useModman) {
         exec(sprintf('cd %s; modman clean', $this->magentoRoot));
     }
     // copy files to modman directory
     $sourceModel = Source::getSourceModel($extension->source);
     if ($sourceModel instanceof MagentoConnect) {
         $sourceModel->setMagentoRoot($this->magentoRoot);
     } elseif ($sourceModel instanceof Git) {
         $sourceModel->setCloneRecursive((bool) $extension->recursive);
     }
     $sourceModel->copy($this->extensionDir, $extension->branch);
     // deploy files to target directory
     $this->deployExtension($alias);
     Logger::notice('Installed extension %s', array($alias));
 }