protected function tearDown()
 {
     if (PHP_VERSION_ID < 50400) {
         return;
     }
     $this->filesystem->remove($this->directory);
 }
 public function cleanup($path)
 {
     // cleanup
     $filesystem = new Filesystem();
     $filesystem->remove($path);
     return true;
 }
 /**
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @param array $files
  * @param $permission
  * @return int
  */
 public function createFolders(\Symfony\Component\Console\Output\OutputInterface $output, $files, $permission)
 {
     $dryRun = $this->getConfigurationHelper()->getDryRun();
     if (empty($files)) {
         $output->writeln('<comment>No files found.</comment>');
         return 0;
     }
     $fs = new Filesystem();
     try {
         if ($dryRun) {
             $output->writeln("<comment>Folders to be created with permission " . decoct($permission) . ":</comment>");
             foreach ($files as $file) {
                 $output->writeln($file);
             }
         } else {
             $output->writeln("<comment>Creating folders with permission " . decoct($permission) . ":</comment>");
             foreach ($files as $file) {
                 $output->writeln($file);
             }
             $fs->mkdir($files, $permission);
         }
     } catch (IOException $e) {
         echo "\n An error occurred while removing the directory: " . $e->getMessage() . "\n ";
     }
 }
示例#4
0
 /**
  * Remove the extracted directory
  */
 public function __destruct()
 {
     if ($this->extractedPath) {
         $fileSystem = new Filesystem();
         $fileSystem->remove($this->extractedPath);
     }
 }
 /**
  * Execute command
  *
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  *
  * @return int|null|void
  *
  * @throws Exception
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getArgument('path');
     /**
      * We load the options to work with
      */
     $options = $this->getUsableConfig($input);
     /**
      * Building the real directory or file to work in
      */
     $filesystem = new Filesystem();
     if (!$filesystem->isAbsolutePath($path)) {
         $path = getcwd() . DIRECTORY_SEPARATOR . $path;
     }
     if (!is_file($path) && !is_dir($path)) {
         throw new Exception('Directory or file "' . $path . '" does not exist');
     }
     /**
      * Print dry-run message if needed
      */
     $this->printDryRunMessage($input, $output, $path);
     /**
      * Print all configuration block if verbose level allows it
      */
     $this->printConfigUsed($output, $options);
     $fileFinder = new FileFinder();
     $files = $fileFinder->findPHPFilesByPath($path);
     /**
      * Parse and fix all found files
      */
     $this->parseAndFixFiles($input, $output, $files, $options);
 }
 /**
  * @param SiteEvent $event
  */
 public function onSettingUpSite(SiteEvent $event)
 {
     $drupal = $event->getDrupal();
     $this->eventDispatcher->dispatch(WritingSiteSettingsFile::NAME, $settings = new WritingSiteSettingsFile($drupal));
     $this->filesystem->mkdir($drupal->getSitePath());
     file_put_contents($drupal->getSitePath() . '/settings.php', '<?php ' . $settings->getSettings());
 }
示例#7
0
 public function tearDown()
 {
     parent::tearDown();
     $this->app['storage']->close();
     $fs = new Filesystem();
     $fs->remove($this->baseDir);
 }
 function it_uses_container_dump_to_create_the_cache(Filesystem $filesystem, ContainerDumperFactory $dumperFactory, ContainerBuilder $containerBuilder, PhpDumper $dumper)
 {
     $dumper->dump()->willReturn('file contents');
     $dumperFactory->create($containerBuilder)->willReturn($dumper);
     $this->dump($containerBuilder);
     $filesystem->dumpFile($this->path, 'file contents')->shouldHaveBeenCalled();
 }
 protected function setUp()
 {
     $fs = new Filesystem();
     if ($fs->exists(self::$cacheDir)) {
         $fs->remove(self::$cacheDir);
     }
 }
示例#10
0
 /**
  * @param Profile $profile
  * @param bool    $clear
  *
  * @return Backup[]
  *
  * @throws \Exception
  */
 public function backup(Profile $profile, $clear = false)
 {
     $scratchDir = $profile->getScratchDir();
     $processor = $profile->getProcessor();
     $filesystem = new Filesystem();
     if ($clear) {
         $this->logger->info('Clearing scratch directory...');
         $filesystem->remove($scratchDir);
     }
     if (!is_dir($scratchDir)) {
         $filesystem->mkdir($scratchDir);
     }
     $this->logger->info('Beginning backup...');
     foreach ($profile->getSources() as $source) {
         $source->fetch($scratchDir, $this->logger);
     }
     $filename = $processor->process($scratchDir, $profile->getNamer(), $this->logger);
     try {
         $backups = $this->sendToDestinations($profile, $filename);
     } catch (\Exception $e) {
         $processor->cleanup($filename, $this->logger);
         throw $e;
     }
     $processor->cleanup($filename, $this->logger);
     $this->logger->info('Done.');
     return $backups;
 }
示例#11
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $container = $this->getApplication()->getContainer();
     $commandFile = realpath($_SERVER['SCRIPT_FILENAME']);
     $currentVersion = "v" . $container->getVersion();
     $updateVersion = trim(@file_get_contents('https://raw.githubusercontent.com/kohkimakimoto/altax/master/version'));
     if (!$container->isPhar()) {
         $output->writeln('<error>You can not update altax. Because altax only supports self-update command on PHAR file version.</error>');
         return 1;
     }
     if (!preg_match('/^v[0-9].[0-9]+.[0-9]+$/', $updateVersion)) {
         $output->writeln('<error>You can not update altax. Because the latest version of altax are not available for download.</error>');
         return 1;
     }
     if ($currentVersion === $updateVersion) {
         $output->writeln('<info>You are already using altax version <comment>' . $updateVersion . '</comment>.</info>');
         return 0;
     }
     $output->writeln(sprintf("Updating to version <info>%s</info>.", $updateVersion));
     $tmpDir = "/tmp/" . uniqid("altax.update.");
     $process = new Process("mkdir {$tmpDir} && cd {$tmpDir} && curl -L https://raw.githubusercontent.com/kohkimakimoto/altax/master/installer.sh | bash -s local {$updateVersion}");
     $process->setTimeout(null);
     if ($process->run() !== 0) {
         $output->writeln('<error>You can not update altax.');
         return 1;
     }
     $fs = new Filesystem();
     $fs->copy($tmpDir . "/altax.phar", $commandFile, true);
     $fs->remove($tmpDir);
     $output->writeln("Done.");
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $finder = Finder::create()->in($this->cachePath)->notName('.gitkeep');
     $filesystem = new Filesystem();
     $filesystem->remove($finder);
     $output->writeln(sprintf("%s <info>success</info>", 'cache:clear'));
 }
 public function tearDown()
 {
     // Delete local files
     $finder = new Finder();
     $fs = new Filesystem();
     $fs->remove($finder->files()->in($this->tmpDir . "/download"));
     $fs->remove($finder->files()->in($this->tmpDir));
     $fs->remove($this->tmpDir . "/download");
     $fs->remove($this->tmpDir);
     // Delete file uploads
     $options = new ListFilesOptions();
     $options->setTags(["docker-bundle-test"]);
     $files = $this->client->listFiles($options);
     foreach ($files as $file) {
         $this->client->deleteFile($file["id"]);
     }
     if ($this->client->bucketExists("in.c-docker-test")) {
         // Delete tables
         foreach ($this->client->listTables("in.c-docker-test") as $table) {
             $this->client->dropTable($table["id"]);
         }
         // Delete bucket
         $this->client->dropBucket("in.c-docker-test");
     }
     if ($this->client->bucketExists("in.c-docker-test-redshift")) {
         // Delete tables
         foreach ($this->client->listTables("in.c-docker-test-redshift") as $table) {
             $this->client->dropTable($table["id"]);
         }
         // Delete bucket
         $this->client->dropBucket("in.c-docker-test-redshift");
     }
 }
示例#14
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io = new SymfonyStyle($input, $output);
     $locator = $this->getContainer()->get('campaignchain.core.module.locator');
     $bundles = $locator->getAvailableBundles();
     $selectedBundle = $this->selectBundle($bundles);
     $generateOutput = new BufferedOutput();
     $application = new Application($this->getContainer()->get('kernel'));
     $application->setAutoExit(false);
     $application->run(new ArrayInput(['command' => $this->getDoctrineMigrationsCommand(), '--no-interaction' => true]), $generateOutput);
     preg_match('/Generated new migration class to "(.*)"/', $generateOutput->fetch(), $matches);
     if (count($matches) < 2) {
         //error
         return;
     }
     $pathForMigrationFile = $matches[1];
     preg_match('/Version.*.php/', $pathForMigrationFile, $fileNames);
     if (!count($fileNames)) {
         return;
     }
     $schemaFile = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..';
     $schemaFile .= DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $selectedBundle->getName();
     $schemaFile .= str_replace('/', DIRECTORY_SEPARATOR, $this->getContainer()->getParameter('campaignchain_update.bundle.schema_dir'));
     $schemaFile .= DIRECTORY_SEPARATOR . $fileNames[0];
     $fs = new Filesystem();
     $fs->copy($pathForMigrationFile, $schemaFile);
     $fs->remove($pathForMigrationFile);
     $this->io->success('Generation finished. You can find the file here:');
     $this->io->text($schemaFile);
 }
示例#15
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configName = $input->getArgument('config-name');
     $editor = $input->getArgument('editor');
     $config = $this->getConfigFactory()->getEditable($configName);
     $configSystem = $this->getConfigFactory()->get('system.file');
     $temporalyDirectory = $configSystem->get('path.temporary') ?: '/tmp';
     $configFile = $temporalyDirectory . '/config-edit/' . $configName . '.yml';
     $ymlFile = new Parser();
     $fileSystem = new Filesystem();
     try {
         $fileSystem->mkdir($temporalyDirectory);
         $fileSystem->dumpFile($configFile, $this->getYamlConfig($configName));
     } catch (IOExceptionInterface $e) {
         throw new \Exception($this->trans('commands.config.edit.messages.no-directory') . ' ' . $e->getPath());
     }
     if (!$editor) {
         $editor = $this->getEditor();
     }
     $processBuilder = new ProcessBuilder(array($editor, $configFile));
     $process = $processBuilder->getProcess();
     $process->setTty('true');
     $process->run();
     if ($process->isSuccessful()) {
         $value = $ymlFile->parse(file_get_contents($configFile));
         $config->setData($value);
         $config->save();
         $fileSystem->remove($configFile);
     }
     if (!$process->isSuccessful()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
 }
 /**
  * @param  \Symfony\Component\HttpKernel\Bundle\BundleInterface $bundle
  * @param  string                                               $document
  * @param  array                                                $fields
  * @param  Boolean                                              $withRepository
  * @throws \RuntimeException
  */
 public function generate(BundleInterface $bundle, $document, array $fields, $withRepository)
 {
     $config = $this->documentManager->getConfiguration();
     $config->addDocumentNamespace($bundle->getName(), $bundle->getNamespace() . '\\Document');
     $documentClass = $config->getDocumentNamespace($bundle->getName()) . '\\' . $document;
     $documentPath = $bundle->getPath() . '/Document/' . str_replace('\\', '/', $document) . '.php';
     if (file_exists($documentPath)) {
         throw new \RuntimeException(sprintf('Document "%s" already exists.', $documentClass));
     }
     $class = new ClassMetadataInfo($documentClass);
     if ($withRepository) {
         $class->setCustomRepositoryClass($documentClass . 'Repository');
     }
     $class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
     $class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
     foreach ($fields as $field) {
         $class->mapField($field);
     }
     $documentGenerator = $this->getDocumentGenerator();
     $documentCode = $documentGenerator->generateDocumentClass($class);
     $this->filesystem->mkdir(dirname($documentPath));
     file_put_contents($documentPath, rtrim($documentCode) . PHP_EOL, LOCK_EX);
     if ($withRepository) {
         $path = $bundle->getPath() . str_repeat('/..', substr_count(get_class($bundle), '\\'));
         $this->getRepositoryGenerator()->writeDocumentRepositoryClass($class->customRepositoryClassName, $path);
     }
 }
示例#17
0
 /**
  * @param $offset
  *
  * @return FinishResult|ValidResult
  * @throws \RuntimeException
  * @throws \Exception
  */
 public function run($offset)
 {
     $fs = new Filesystem();
     $requestTime = time();
     try {
         $source = new Zip($this->source);
         $count = $source->count();
         $source->seek($offset);
     } catch (\Exception $e) {
         @unlink($this->source);
         throw new \Exception('Could not open update package:<br>' . $e->getMessage(), 0, $e);
     }
     /** @var ZipEntry $entry */
     while (list($position, $entry) = $source->each()) {
         $name = $entry->getName();
         $targetName = $this->destinationDir . $name;
         if (!$entry->isDir()) {
             $fs->dumpFile($targetName, $entry->getContents());
         }
         if (time() - $requestTime >= 20 || ($position + 1) % 1000 == 0) {
             $source->close();
             return new ValidResult($position + 1, $count);
         }
     }
     $source->close();
     return new FinishResult($count, $count);
 }
示例#18
0
 /**
  * {@inheritdoc}
  */
 public function clear($cacheDir)
 {
     $this->filesystem->remove($cacheDir . '/contao/config');
     $this->filesystem->remove($cacheDir . '/contao/dca');
     $this->filesystem->remove($cacheDir . '/contao/languages');
     $this->filesystem->remove($cacheDir . '/contao/sql');
 }
示例#19
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Ask for an app and environment.
     $this->getApp($input, $output);
     $this->getEnvironment($input, $output);
     $environment_name = $this->environment->name;
     $app_name = $this->app->name;
     // Confirm removal of the app.
     $helper = $this->getHelper('question');
     $question = new ConfirmationQuestion("Are you sure you would like to remove the environment <question>{$app_name}:{$environment_name}</question>?  All files at {$this->environment->path} will be deleted, and all containers will be killed. [y/N] ", false);
     if (!$helper->ask($input, $output, $question)) {
         $output->writeln('<error>Cancelled</error>');
         return;
     } else {
         // Remove the environment from config registry.
         // @TODO: Move this to EnvironmentFactory class
         // Remove files
         $fs = new Filesystem();
         try {
             $fs->remove(array($this->environment->path));
             $output->writeln("<info>Files for environment {$app_name}:{$environment_name} has been deleted.</info>");
         } catch (IOExceptionInterface $e) {
             $output->writeln('<error>Unable to remove ' . $e->getPath() . '</error>');
         }
         // Destroy the environment
         $environmentFactory = new EnvironmentFactory($this->environment, $this->app);
         $environmentFactory->destroy();
         unset($this->app->environments[$environment_name]);
         $this->getApplication()->getTerra()->getConfig()->add('apps', $app_name, (array) $this->app);
         $this->getApplication()->getTerra()->getConfig()->save();
         $output->writeln("<info>Environment {$app_name}:{$environment_name} has been removed.</info>");
     }
 }
示例#20
0
 function it_should_locate_config_file_on_empty_composer_configuration(Filesystem $filesystem, PackageInterface $package)
 {
     $package->getExtra()->willReturn(array());
     $filesystem->exists($this->pathArgument('/composer/grumphp.yml'))->willReturn(true);
     $filesystem->isAbsolutePath($this->pathArgument('/composer/grumphp.yml'))->willReturn(true);
     $this->locate('/composer', $package)->shouldMatch($this->pathRegex('/composer/grumphp.yml'));
 }
示例#21
0
 /**
  * {@inheritdoc}
  */
 public function tearDown()
 {
     if (isset($this->workDir)) {
         $filesystem = new Filesystem();
         $filesystem->remove($this->workDir);
     }
 }
示例#22
0
 /**
  * setData constructor.
  *
  * @param \Aura\Web\Request $request
  * @param \Aura\Web\Response $response
  * @param \Aura\View\View $view
  */
 public function __construct($request, $response, $view)
 {
     $status = 'success';
     $message = 'Image saved successfully.';
     $image = $request->files->get('file', ['error' => 1]);
     $secureToken = (new Config())->getConfig()['secure_token'];
     $retrievedSecureToken = $request->query->get('key', '');
     if ($secureToken !== $retrievedSecureToken) {
         $status = 'error';
         $message = 'Incorrect secure token';
     } else {
         if ($image['error'] === 0) {
             $fileSystem = new Filesystem();
             $tmpName = $image['tmp_name'];
             $path = '../storage/';
             try {
                 $fileSystem->copy($tmpName, $path . $image['name']);
             } catch (\Exception $e) {
                 Log::addError('Image upload error: ' . $e->getMessage());
                 $status = 'error';
                 $message = 'Move image exception: ' . $e->getMessage();
             }
         } else {
             Log::addError('Image upload error: ' . serialize($image));
             $status = 'error';
             $message = 'Image upload error';
         }
     }
     $view->setData(['status' => $status, 'message' => $message]);
     $response->content->set($view->__invoke());
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $identifier = $input->getArgument('identifier');
     if (!$identifier) {
         $identifier = '1799-Auobj';
     }
     $path = utils::normalize(__DIR__ . "/../data/{$identifier}.json");
     $content = file_get_contents($path);
     $data = json_decode($content);
     $localFile = utils::normalize(__DIR__ . "/../tmp/{$data->name}");
     $file = fopen($localFile, 'wb');
     $http = new \ADN\Extract\HttpRequest($data->uri, [], null, null);
     $response = $http->get(function ($code, $chunk) use($file, $data, $path) {
         if ($code != 'data') {
             return false;
         }
         fwrite($file, $chunk);
         $data->bytesRead += strlen($chunk);
         file_put_contents($path, json_encode($data));
         return true;
     });
     fclose($file);
     if (!$response || $response->code != Response::HTTP_OK) {
         $output->writeln('oops');
         $fs = new Filesystem();
         $fs->remove($path);
         $fs->remove($localFile);
         return;
     }
     $data->size = utils::findKey($response->headers, 'Content-Length');
     $data->bytesRead = $data->size;
     file_put_contents($path, json_encode($data));
     utils::log('ok');
 }
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $destDir = $this->getDestDir();
     $finder = new Finder();
     $fs = new Filesystem();
     try {
         $fs->mkdir($destDir);
     } catch (IOException $e) {
         $output->writeln(sprintf('<error>Could not create directory %s.</error>', $destDir));
         return;
     }
     $srcDir = $this->getSrcDir();
     if (false === file_exists($srcDir)) {
         $output->writeln(sprintf('<error>Fonts directory "%s" does not exist. Did you install twbs/bootstrap? ' . 'If you used something other than Composer you need to manually change the path in ' . '"braincrafted_bootstrap.assets_dir". If you want to use Font Awesome you need to install the font and change the option "braincrafted_bootstrap.fontawesome_dir".</error>', $srcDir));
         return;
     }
     $finder->files()->in($srcDir);
     foreach ($finder as $file) {
         $dest = sprintf('%s/%s', $destDir, $file->getBaseName());
         try {
             $fs->copy($file, $dest);
         } catch (IOException $e) {
             $output->writeln(sprintf('<error>Could not copy %s</error>', $file->getBaseName()));
             return;
         }
     }
     $output->writeln(sprintf('Copied icon fonts to <comment>%s</comment>.', $destDir));
 }
 public function setUp()
 {
     $this->numberOfPayloads = 5;
     $this->tempDirectory = sys_get_temp_dir() . '/orphanage';
     $this->realDirectory = sys_get_temp_dir() . '/storage';
     $this->payloads = array();
     $filesystem = new Filesystem();
     $filesystem->mkdir($this->tempDirectory);
     $filesystem->mkdir($this->realDirectory);
     for ($i = 0; $i < $this->numberOfPayloads; $i++) {
         // create temporary file
         $file = tempnam(sys_get_temp_dir(), 'uploader');
         $pointer = fopen($file, 'w+');
         fwrite($pointer, str_repeat('A', 1024), 1024);
         fclose($pointer);
         $this->payloads[] = new FilesystemFile(new UploadedFile($file, $i . 'grumpycat.jpeg', null, null, null, true));
     }
     // create underlying storage
     $this->storage = new FilesystemStorage($this->realDirectory);
     // is ignored anyways
     $chunkStorage = new FilesystemChunkStorage('/tmp/');
     // create orphanage
     $session = new Session(new MockArraySessionStorage());
     $session->start();
     $config = array('directory' => $this->tempDirectory);
     $this->orphanage = new FilesystemOrphanageStorage($this->storage, $session, $chunkStorage, $config, 'cat');
 }
示例#26
0
 public static function main($argc, $argv)
 {
     if ($argc < 2) {
         echo 'Usage: php test.php number_of_files_to_copy' . PHP_EOL;
         exit;
     }
     $numFilesToCopy = (int) $argv[1];
     if ($numFilesToCopy < 1) {
         $numFilesToCopy = 1;
     }
     $fileName = 'test.yml';
     $filePath = __DIR__ . '/' . $fileName;
     $yamlArr = Yaml::parse(file_get_contents($filePath));
     $newFilenamePrefix = $yamlArr['new_filename_prefix'];
     try {
         $filesystem = new Filesystem();
         for ($i = 1; $i <= $numFilesToCopy; $i++) {
             $newFilepath = __DIR__ . "/{$newFilenamePrefix}_{$i}.yml";
             $filesystem->copy($filePath, $newFilepath);
         }
     } catch (FileNotFoundException $e) {
         echo "File '{$filePath}' could not be found!" . PHP_EOL;
     } catch (IOException $e) {
         echo "Could not copy file '{$filePath}' to '{$newFilepath}'!" . PHP_EOL;
     } finally {
         // Just for fun
         unset($filesystem);
     }
     $funny = (int) ((0.7 + 0.1) * 10);
     echo $funny . PHP_EOL;
     $notFunny = BigDecimal::of(0.7)->plus(BigDecimal::of(0.1))->multipliedBy(10)->toInteger();
     echo $notFunny . PHP_EOL;
     $notFunny = BigRational::of('7/10')->plus(BigRational::of('1/10'))->multipliedBy(10)->toInteger();
     echo $notFunny . PHP_EOL;
 }
示例#27
0
 /**
  * Generate a copy of a theme package.
  *
  * @param Request $request
  *
  * @throws PackageManagerException
  *
  * @return Response
  */
 public function generateTheme(Request $request)
 {
     $theme = $request->get('theme');
     $newName = $request->get('name');
     if (empty($theme)) {
         return new Response(Trans::__('No theme name found. Theme is not generated.'));
     }
     if (!$newName) {
         $newName = basename($theme);
     }
     $source = $this->resources()->getPath('extensions/vendor/' . $theme);
     $destination = $this->resources()->getPath('themebase/' . $newName);
     if (is_dir($source)) {
         try {
             $filesystem = new Filesystem();
             $filesystem->mkdir($destination);
             $filesystem->mirror($source, $destination);
             if (file_exists($destination . "/config.yml.dist")) {
                 $filesystem->copy($destination . "/config.yml.dist", $destination . "/config.yml");
             }
             return new Response(Trans::__('Theme successfully generated. You can now edit it directly from your theme folder.'));
         } catch (\Exception $e) {
             return new Response(Trans::__('We were unable to generate the theme. It is likely that your theme directory is not writable by Bolt. Check the permissions and try reinstalling.'));
         }
     }
     throw new PackageManagerException("Invalid theme source directory: {$source}");
 }
 function it_throws_an_exception_if_resource_can_not_be_located(Filesystem $filesystem, ThemeInterface $theme)
 {
     $theme->getName()->willReturn('theme/name');
     $theme->getPath()->willReturn('/theme/path');
     $filesystem->exists('/theme/path/resource')->willReturn(false);
     $this->shouldThrow(ResourceNotFoundException::class)->during('locateResource', ['resource', $theme]);
 }
 /**
  * Run paths migrations
  *
  * @return void
  */
 protected function runPathsMigration()
 {
     $_fileService = new Filesystem();
     $_tmpPath = app_path('storage') . DIRECTORY_SEPARATOR . 'migrations';
     if (!is_dir($_tmpPath) && !$_fileService->exists($_tmpPath)) {
         $_fileService->mkdir($_tmpPath);
     }
     $this->info("Gathering migration files to {$_tmpPath}");
     // Copy all files to storage/migrations
     foreach ($this->migrationList as $migration) {
         $_fileService->mirror($migration['path'], $_tmpPath);
     }
     //call migrate command on temporary path
     $this->info("Migrating...");
     $opts = array('--path' => ltrim(str_replace(base_path(), '', $_tmpPath), '/'));
     if ($this->input->getOption('force')) {
         $opts['--force'] = true;
     }
     if ($this->input->getOption('database')) {
         $opts['--database'] = $this->input->getOption('database');
     }
     $this->call('migrate', $opts);
     // Delete all temp migration files
     $this->info("Cleaning temporary files");
     $_fileService->remove($_tmpPath);
     // Done
     $this->info("DONE!");
 }
 /**
  * {@inheritdoc}
  *
  * @see \Symfony\Component\Console\Command\Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $assets = $this->getContainer()->getParameter('asf_layout.assets');
     $this->twbs_config = $assets['twbs'];
     $dest_dir = $this->twbs_config['fonts_dir'];
     $src_dir = sprintf('%s/%s', $this->twbs_config['twbs_dir'], 'fonts');
     $finder = new Finder();
     $fs = new Filesystem();
     try {
         $fs->mkdir($dest_dir);
     } catch (IOException $e) {
         $output->writeln(sprintf('<error>Could not create directory %s.</error>', $dest_dir));
         return;
     }
     if (false === file_exists($src_dir)) {
         $output->writeln(sprintf('<error>Fonts directory "%s" does not exist. Did you install Twitter Bootstrap ? ' . 'If you used something other than Composer you need to manually change the path in ' . '"asf_layout.twbs.twbs_dir".</error>', $src_dir));
         return;
     }
     $finder->files()->in($src_dir);
     foreach ($finder as $file) {
         $dest = sprintf('%s/%s', $dest_dir, $file->getBaseName());
         try {
             $fs->copy($file, $dest);
         } catch (IOException $e) {
             $output->writeln(sprintf('<error>Could not copy %s</error>', $file->getBaseName()));
             return;
         }
     }
     $output->writeln(sprintf('[OK] Twitter Bootstrap Glyphicons icons was successfully created in "%s".', $dest_dir));
 }