/** * Return path of the git wrapper file. If it doesn't exist, it will be created * * @return string * @throws \RuntimeException */ private function getGitWrapper() { $dir = $this->pathProvider->getRuntimeDir() . '/sw-cli-tools/'; $wrapperFile = $dir . $this->wrapperFileName; if (file_exists($wrapperFile) || $this->writeGitSshWrapper($dir)) { return $wrapperFile; } throw new \RuntimeException("Could not create git wrapper file {$wrapperFile}"); }
/** * Iterate the extension directories and return config.yaml files * * @return string[] */ public function collectConfigFiles() { $files = array(); // Load user file first. Its config values cannot be overwritten $userConfig = $this->pathProvider->getConfigPath() . '/config.yaml'; if (file_exists($userConfig)) { $files[] = $userConfig; } $extensionPath = $this->pathProvider->getExtensionPath(); $files = array_merge($files, $this->interateVendors($extensionPath)); // Load config.yaml.dist as latest - this way the fallback config options are defined $files[] = $this->pathProvider->getCliToolPath() . '/config.yaml.dist'; return $files; }
/** * @param string $installDir */ public function setup($installDir) { $assetDir = $this->pathProvider->getAssetsPath(); if (!is_dir($assetDir)) { mkdir($assetDir); } if (!file_exists($assetDir . '/demo.zip')) { $this->ioService->writeln("<info>Downloading demodata from shopware.de</info>"); $this->utilities->executeCommand("wget {$this->demoUrl} -O {$assetDir}/demo.zip"); $this->ioService->writeln("<info>Unzipping demo data</info>"); $this->utilities->executeCommand("unzip -q {$assetDir}/demo.zip -d {$assetDir}"); } // todo: This should be done in PHP $this->ioService->writeln("<info>Copying demo data to shop</info>"); $this->utilities->executeCommand("cp -rf {$assetDir}/files {$installDir}"); $this->utilities->executeCommand("cp -rf {$assetDir}/media {$installDir}"); $this->utilities->executeCommand("find {$installDir}/cache -type d -exec chmod 777 {} \\;", true); $this->utilities->executeCommand("find {$installDir}/media -type d -exec chmod 777 {} \\;", true); $this->utilities->executeCommand("find {$installDir}/files -type d -exec chmod 777 {} \\;", true); $this->utilities->executeCommand("find {$installDir}/logs -type d -exec chmod 777 {} \\;", true); }
/** * @param string $installDir */ public function setup($installDir) { $assetDir = $this->pathProvider->getAssetsPath(); if (!is_dir($assetDir)) { mkdir($assetDir); } $targetFile = md5($this->demoUrl) . '_demo.zip'; if (!file_exists($assetDir . '/' . $targetFile)) { $this->ioService->writeln("<info>Downloading demodata from shopware.de</info>"); $this->processExecutor->execute("wget {$this->demoUrl} -O {$assetDir}/{$targetFile}"); $this->ioService->writeln("<info>Unzipping demo data</info>"); $this->processExecutor->execute("unzip -q {$assetDir}/{$targetFile} -d {$assetDir}"); } // todo: This should be done in PHP $this->ioService->writeln("<info>Copying demo data to shop</info>"); $this->processExecutor->execute("cp -rf {$assetDir}/files {$installDir}"); $this->processExecutor->execute("cp -rf {$assetDir}/media {$installDir}"); $this->processExecutor->execute("find " . $this->shopwareInfo->getCacheDir($installDir) . " -type d -exec chmod 777 {} \\;", true); $this->processExecutor->execute("find " . $this->shopwareInfo->getMediaDir($installDir) . " -type d -exec chmod 777 {} \\;", true); $this->processExecutor->execute("find " . $this->shopwareInfo->getFilesDir($installDir) . " -type d -exec chmod 777 {} \\;", true); $this->processExecutor->execute("find " . $this->shopwareInfo->getCacheDir($installDir) . " -type d -exec chmod 777 {} \\;", true); }
public function __construct(PathProvider $pathProvider) { $this->pathProvider = $pathProvider; $this->path = $pathProvider->getCachePath() . DIRECTORY_SEPARATOR; $this->info = $this->readTable(); }