Example #1
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $package = 'barryvdh/laravel-elfinder';
     $destination = $this->publishPath . "/packages/{$package}";
     if (!is_null($path = $this->getElfinderPath())) {
         if (!$this->files->deleteDirectory($destination)) {
             $this->error('Could not delete existing package folder');
         }
         $copyElfinder = $this->copyElfinderFiles($destination);
     } else {
         $copyElfinder = false;
         $this->error('Could not find elfinder path');
     }
     if (!is_null($path = $this->getPath())) {
         $copyPublic = $this->files->copyDirectory($path, $destination);
     } else {
         $copyPublic = false;
         $this->error('Could not find public path');
     }
     if ($copyElfinder && $copyPublic) {
         $this->info('Published assets for: ' . $package);
     } else {
         $this->error('Could not publish alles assets for ' . $package);
     }
 }
Example #2
0
 /**
  * Execute the console command.
  *
  * @return bool|null
  */
 public function fire()
 {
     // get plugin name, namespace, path
     $name = $this->getPluginName();
     $namespace = $this->getNamespace();
     $title = $this->getTitleInput();
     $path = app('xe.plugin')->getPluginsDir() . '/' . $name;
     if ($this->checkEnv($path, $name, $namespace, $title) === false) {
         return false;
     }
     try {
         // plugin.php 파일 생성
         $this->makePluginClass($path, $name, $namespace, $title);
         // composer.json 파일 생성
         $this->makeComposerJson($path, $name, $namespace, $title);
         // directory structure 생성
         $this->makeDirectoryStructure($path);
         // composer update
         $this->runComposerDump($path);
         // plugin activate
         $this->activatePlugin($name);
     } catch (\Exception $e) {
         $this->files->deleteDirectory($path);
         throw $e;
     }
     // print info
     $url = trim(config('app.url'), '/') . '/' . config('xe.routing.fixedPrefix') . '/' . $name;
     $this->info("Plugin is created and activated successfully.");
     $this->info("See ./plugins/{$name} directory. And open {$url} in your browser.");
     $this->info("Input and modify your plugin information in ./plugins/{$name}/composer.json file.");
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $package = 'ribrit/elfinder';
     $destination = $this->publishPath . "/packages/{$package}";
     if (!is_null($path = $this->getElfinderPath())) {
         if ($this->files->exists($destination)) {
             $this->files->deleteDirectory($destination);
             $this->info('Old published Assets have been removed');
         }
         $copyElfinder = $this->copyElfinderFiles($destination);
     } else {
         $copyElfinder = false;
         $this->error('Could not find elfinder path');
     }
     if (!is_null($path = $this->getPath())) {
         $copyPublic = $this->files->copyDirectory($path, $destination);
     } else {
         $copyPublic = false;
         $this->error('Could not find public path');
     }
     if ($copyElfinder && $copyPublic) {
         $this->info('Published assets to: ' . $package);
     } else {
         $this->error('Could not publish alles assets for ' . $package);
     }
 }
 public function delete()
 {
     if (!$this->filesystem->exists($this->path)) {
         return;
     }
     $this->filesystem->deleteDirectory($this->path);
 }
 public function tearDown()
 {
     $this->finder->deleteDirectory($this->modulePath);
     if ($this->finder->isDirectory(base_path('modules/ModuleName'))) {
         $this->finder->deleteDirectory(base_path('modules/ModuleName'));
     }
     parent::tearDown();
 }
 /**
  * @return void
  */
 public function fire()
 {
     $statics = $this->files->glob($this->notadd->publicPath() . DIRECTORY_SEPARATOR . 'cache' . '/*');
     foreach ($statics as $static) {
         $this->files->deleteDirectory($static);
     }
     $this->info('Static files cleared!');
 }
 public function testSaveNamespace()
 {
     $namespace = md5(uniqid());
     $group = md5(uniqid());
     $item = 'test.item';
     $key = "{$namespace}::{$group}.{$item}";
     $this->repository->save($key, $namespace);
     $this->assertEquals($namespace, $this->repository->get($key, false));
     $this->files->deleteDirectory(DIR_APPLICATION . "/config/generated_overrides/{$namespace}/");
 }
Example #8
0
 public function tearDown()
 {
     $remove = array_reverse($this->to_remove);
     foreach ($remove as $path) {
         if ($this->files->isDirectory($path)) {
             $this->files->deleteDirectory($path);
         } else {
             $this->files->delete($path);
         }
     }
 }
Example #9
0
 /**
  * fire.
  *
  * @method fire
  */
 public function fire()
 {
     $root = $this->getLaravel()->basePath();
     $directories = ['.git', 'node_modules', 'vendor/**/**/.git', 'vendor/**/**/node_modules', 'vendor/**/**/vendor', 'vendor/**/**/Tests', 'vendor/**/**/tests', 'vendor/**/**/Test', 'vendor/**/**/test'];
     (new Collection($directories))->map(function ($directory) use($root) {
         return $this->filesystem->glob($root . '/' . $directory, GLOB_ONLYDIR);
     })->collapse()->each(function ($directory) {
         $this->filesystem->deleteDirectory($directory);
         $this->error('delete directory: ' . $directory);
     });
 }
Example #10
0
 /**
  * Extract an existing Phar
  *
  * @param string $destination
  *
  * @return void
  */
 public function extract($destination)
 {
     // Recompile phar archive
     $this->compile();
     // Remove any already extracted archive
     if (file_exists($destination)) {
         $this->files->deleteDirectory($destination);
     }
     $phar = new Phar($this->phar);
     $phar->extractTo($destination);
 }
Example #11
0
 /**
  * $this
  * @param StoresMedia $owner
  * @param $size
  */
 public function handleOwner(StoresMedia $owner, $size)
 {
     if ($owner->mediaStoresMultiple()) {
         foreach ($owner->images as $image) {
             $this->handleImage($image);
         }
     } elseif ($owner->images) {
         $this->handleImage($owner->images);
     }
     $this->files->deleteDirectory(rtrim($this->config->getPublicPath($owner, 'images', $size), '/'));
 }
Example #12
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // The theme is not exists.
     if (!$this->files->isDirectory($this->getPath(null))) {
         return $this->error('Theme "' . $this->getTheme() . '" is not exists.');
     }
     $themePath = $this->getPath(null);
     if ($this->confirm('Are you sure you want to permanently delete? [yes|no]')) {
         // Delete permanent.
         $this->files->deleteDirectory($themePath, false);
         $this->info('Theme "' . $this->getTheme() . '" has been destroyed.');
     }
 }
Example #13
0
 public function handle()
 {
     $this->files->deleteDirectory(public_path(config('media.path')));
     $this->call('migrate:refresh');
     $this->call('cache:clear');
     $this->call('search:speed', ['speed' => '5m']);
     $this->call('search:flush');
     $this->call('search:settings');
     $this->call('search:build');
     if ($this->option('seed')) {
         $this->call('db:seed');
     }
     $this->call('search:speed');
 }
Example #14
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     foreach ($this->getFiles() as $file) {
         $this->files->delete($file);
         $this->line('<info>Removed File:</info> ' . $file);
     }
     foreach ($this->getDirectories() as $directory) {
         $this->files->deleteDirectory($directory);
         $this->line('<comment>Removed Directory:</comment> ' . $directory);
     }
     foreach ($this->getStubs() as $stub => $path) {
         $this->files->put($path, $this->files->get(__DIR__ . '/stubs/fresh/' . $stub));
     }
     $this->info('Scaffolding Removed!');
 }
Example #15
0
 /**
  * @return bool
  * @throws FieldException
  */
 protected function deleteDirectory()
 {
     if (!$this->files->deleteDirectory($this->getFolder())) {
         throw new FieldException("Can't delete directory [{$this->getFolder()}]");
     }
     return true;
 }
 /**
  * Handle the command.
  *
  * @param Filesystem $files
  */
 public function handle(Filesystem $files)
 {
     $path = $this->fieldType->getStoragePath();
     if ($path && $files->isDirectory(dirname($path))) {
         $files->deleteDirectory(dirname($path));
     }
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $vendorDir = realpath($this->argument('dir'));
     $this->info("Cleaning dir: {$vendorDir}");
     $rules = Config::get('laravel-vendor-cleanup::rules');
     $filesystem = new Filesystem();
     foreach ($rules as $packageDir => $rule) {
         if (!file_exists($vendorDir . '/' . $packageDir)) {
             continue;
         }
         $patterns = explode(' ', $rule);
         foreach ($patterns as $pattern) {
             try {
                 $finder = new Finder();
                 $finder->name($pattern)->in($vendorDir . '/' . $packageDir);
                 // we can't directly iterate over $finder if it lists dirs we're deleting
                 $files = iterator_to_array($finder);
                 /** @var \SplFileInfo $file */
                 foreach ($files as $file) {
                     if ($file->isDir()) {
                         $filesystem->deleteDirectory($file);
                     } elseif ($file->isFile()) {
                         $filesystem->delete($file);
                     }
                 }
             } catch (\Exception $e) {
                 $this->error("Could not parse {$packageDir} ({$pattern}): " . $e->getMessage());
             }
         }
     }
 }
 /**
  * Tears down the fixture, for example, close a network connection.
  * This method is called after a test is executed.
  */
 protected function tearDown()
 {
     $filesystem = new Filesystem();
     $filesystem->deleteDirectory(tests_path() . DIRECTORY_SEPARATOR . 'Http');
     unset($this->generator);
     parent::tearDown();
 }
Example #19
0
 /**
  * Delete a theme.
  * 
  * @param string $theme
  */
 public function deleteTheme($theme)
 {
     $theme = strtolower($theme);
     $themeLocation = $this->config->get('displore.themes.locations.themes') . '/' . $theme;
     $assetsLocation = $this->config->get('displore.themes.locations.assets') . '/' . $theme;
     if ($this->filesystem->exists($themeLocation)) {
         $this->filesystem->deleteDirectory($themeLocation);
     } else {
         $errors[] = 'The theme location could not be found.';
     }
     if ($this->filesystem->exists($assetsLocation)) {
         $this->filesystem->deleteDirectory($assetsLocation);
     } else {
         $errors[] = 'The assets location could not be found.';
     }
     if (isset($errors)) {
         foreach ($errors as $error) {
             $this->error($error);
             $this->info('The locations are: ');
             $this->info($themeLocation);
             $this->info($assetsLocation);
         }
         exit;
     }
     $this->info('Succesfully deleted the theme ' . $theme);
     $this->info('The locations were: ');
     $this->info($themeLocation);
     $this->info($assetsLocation);
 }
 /**
  * Remove all items from the cache.
  *
  * @return void
  */
 public function flush()
 {
     if ($this->files->isDirectory($this->directory)) {
         foreach ($this->files->directories($this->directory) as $directory) {
             $this->files->deleteDirectory($directory);
         }
     }
 }
 /**
  * Delete subdirectories in the migrations folder.
  *
  * @return void
  */
 public function deleteDirs()
 {
     $dirs = $this->files->directories($this->basePath);
     foreach ($dirs as $dir) {
         $this->files->deleteDirectory($dir);
     }
     $this->info('Subdirectories deleted');
 }
Example #22
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $files = new Filesystem();
     $files->deleteDirectory(app_path('Http/Controllers/Auth'));
     $files->delete(base_path('database/migrations/2014_10_12_000000_create_users_table.php'));
     $files->delete(base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php'));
     $this->info('Original Auth removed! Enjoy your fresh start.');
 }
 /**
  * Uninstalls an plugin.
  *
  * @param string $name
  */
 public function uninstall($name)
 {
     $plugin = $this->getPlugin($name);
     $this->disable($name);
     $this->filesystem->deleteDirectory($plugin->getPath());
     // refresh plugin list
     $this->plugins = null;
     // $this->dispatcher->fire(new PluginWasUninstalled($plugin));
 }
Example #24
0
 public function fire()
 {
     $smarty = $this->laravel['smarty'];
     $compilePath = $smarty->compile_dir;
     $cachePath = $smarty->cache_dir;
     $file = new Filesystem();
     $file->deleteDirectory($cachePath);
     if (!file_exists($cachePath)) {
         $this->info('Smarty cache path cleaned');
     } else {
         $this->error('Smarty cache path could not be cleaned');
     }
     $file->deleteDirectory($compilePath);
     if (!file_exists($compilePath)) {
         $this->info('Smarty compile path cleaned');
     } else {
         $this->error('Smarty compile path could not be cleaned');
     }
 }
 /**
  * Deletes a folder by the specified directory
  *
  * @param $path
  * @return bool
  */
 public function deleteDirectory($path)
 {
     /*
      * Make sure no files exist inside before deleting the directory
      */
     if (count($this->files($path)) === 0) {
         return $this->storage->deleteDirectory($this->storagePath($path));
     }
     return false;
 }
Example #26
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $package = 'mrkj/admininja';
     $source = __DIR__ . '/../../../resources/assets/';
     $destination = $this->publishPath . '/packages/' . $package;
     if ($this->files->isDirectory($destination)) {
         $deleted = $this->files->deleteDirectory($destination);
         if ($deleted) {
             $this->info('Cleaned up previous published assets for ' . $package);
         } else {
             $this->error('Could not clean up previous published assets for ' . $package);
         }
     }
     $copiedFiles = $this->files->copyDirectory($source, $destination);
     if ($copiedFiles) {
         $this->info('Published assets to: ' . $destination);
     } else {
         $this->error('Could not publish all assets for ' . $package);
     }
 }
 /**
  * Makes the directory for the Api files, and will clean out existing
  *
  * @param bool|null            $clean
  * @param OutputInterface|null $output
  *
  * @return $this
  */
 public function makeApiDirectory($clean = false, OutputInterface $output = null)
 {
     $this->verifyMakeDirectory($this->apiDirectory(null, false), $output);
     if ($clean) {
         $this->outputLine("Cleaning out the old files.", $output, "comment");
         $this->files->deleteDirectory($this->apiDirectory(null, false), true);
     }
     $this->verifyMakeDirectory($this->generatedDirectory(null, false), $output);
     // Allow chaining
     return $this;
 }
Example #28
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $files = new Filesystem();
     $files->deleteDirectory(app_path('Http/Controllers/Auth'));
     $files->delete(base_path('database/migrations/2014_10_12_000000_create_users_table.php'));
     $files->delete(base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php'));
     $this->info('Auth removed! Enjoy your fresh start.');
 }
Example #29
0
 /**
  * Clean the collections manifest entry files.
  * 
  * @param  string  $collection
  * @param  \Basset\Manifest\Entry  $entry
  * @return void
  */
 protected function cleanManifestFiles($collection, Entry $entry)
 {
     if (!$entry->hasProductionFingerprints() or !isset($this->environment[$collection])) {
         $this->deleteMatchingFiles($this->buildPath . '/' . $collection . '-*.*');
         $entry->resetProductionFingerprints();
     }
     if (!$entry->hasDevelopmentAssets() or !isset($this->environment[$collection])) {
         $this->files->deleteDirectory($this->buildPath . '/' . $collection);
         $entry->resetDevelopmentAssets();
     }
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     // Reset all database migrations.
     $this->call('migrate:reset');
     // Setup Filesystem instance.
     $files = new Filesystem();
     // Delete published assets from Laravel.
     $files->deleteDirectory(base_path('public/vendor/laraflock'));
     // Delete published views from Laravel.
     $files->deleteDirectory(base_path('resources/views/vendor/dashboard'));
     // Delete published config from Laravel.
     $files->delete(base_path('config/cartalyst.sentinel.php'));
     $files->delete(base_path('config/laraflock.dashboard.php'));
     // Delete database migrations.
     $files->delete(base_path('database/migrations/2014_07_02_230147_migration_cartalyst_sentinel.php'));
     $files->delete(base_path('database/migrations/2015_06_26_031155_create_permissions_table.php'));
     $this->info('Uninstall is successfull.');
 }