コード例 #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
ファイル: Git.php プロジェクト: nickw108/jumpstorm
 /**
  * @see SourceInterface::copy()
  */
 public function copy($target, $branch = self::GIT_DEFAULT_BRANCH)
 {
     if (!Source::isGitRepo($this->source)) {
         throw new Exception('Provided source is not a Git repository: ' . $this->source);
     }
     $this->_cloneRepository($this->source, $target);
     if (null !== $branch && self::GIT_DEFAULT_BRANCH !== $branch) {
         $this->_checkout($target, $branch);
     }
 }
コード例 #3
0
ファイル: Magento.php プロジェクト: nickw108/jumpstorm
 /**
  * Install Magento Sample Data, including db tables and media files
  * @param string $source Absolute directory name or repository
  * @param string $target Absolute directory name (Magento root)
  * @throws Exception
  */
 protected function installSampledata($source, $target, $branch)
 {
     $sampleDataDir = $target . DIRECTORY_SEPARATOR . 'sampleData';
     $sourceModel = Source::getSourceModel($source);
     // copy from source to install directory
     $sourceModel->copy($sampleDataDir, $branch);
     // glob for sql file in $source
     $files = glob($sampleDataDir . DIRECTORY_SEPARATOR . '*.sql');
     if (false === $files || count($files) !== 1) {
         throw new Exception("Could not detect sample data sql file in source directory {$sampleDataDir}");
     }
     $sampledataSql = $files[0];
     Logger::log("Importing sample data from {$sampledataSql}");
     // prepare mysql command: user, host and password
     $mysql = $this->prepareMysqlCommand();
     // insert sample data to database
     exec(sprintf('%s %s < %s', $mysql, $this->config->getDbName(), $sampledataSql), $result, $return);
     if (0 !== $return) {
         throw new Exception('Could not import sample data into database');
     }
     // copy sample data images
     Logger::log("Copying sample data media files");
     $sourceMediaDir = $sampleDataDir . DIRECTORY_SEPARATOR . 'media';
     $targetMediaDir = $target . DIRECTORY_SEPARATOR . 'media';
     $sourceModel = Source::getSourceModel($sourceMediaDir);
     $sourceModel->copy($targetMediaDir);
     // remove temporary sample data folder
     exec(sprintf('rm -rf %s', $sampleDataDir));
 }
コード例 #4
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));
 }