protected function copyBlueprint($file)
 {
     $blueprintPath = $this->getBlueprint($file);
     if ($this->file->isDirectory($blueprintPath)) {
         $this->file->copyDirectory($this->getBlueprint($file), base_path($file));
     } else {
         $this->file->copy($this->getBlueprint($file), base_path($file));
     }
 }
Example #2
0
 /**
  * Copy all assets from a given path to the publish path.
  *
  * @param  string  $name
  * @param  string  $source
  * @return bool
  *
  * @throws \RuntimeException
  */
 public function publish($name, $source)
 {
     $destination = $this->publishPath . "/packages/{$name}";
     $success = $this->files->copyDirectory($source, $destination);
     if (!$success) {
         throw new \RuntimeException("Unable to publish assets.");
     }
     return $success;
 }
 /**
  * Publish migration to the application for the specified module.
  *
  * @param $module
  */
 protected function publishMigration($module)
 {
     if ($this->module->has($module)) {
         $path = $this->getMigrationPath($module);
         $this->files->copyDirectory($path, app_path('database/migrations/'));
         $this->console->call('dump-autoload');
         return $this->console->info("Published from : " . $path);
     }
     return $this->console->error("Module [{$module}] does not exists!");
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $files = new Filesystem();
     $files->copy(__DIR__ . '/stubs/scaffold/Http/Controllers/HomeController.php', app_path('Http/Controllers/HomeController.php'));
     $files->copyDirectory(__DIR__ . '/stubs/scaffold/Http/Controllers/Auth', app_path('Http/Controllers/Auth'));
     $files->copy(__DIR__ . '/stubs/scaffold/Http/routes.php', app_path('Http/routes.php'));
     $files->copy(__DIR__ . '/stubs/scaffold/Providers/AppServiceProvider.php', app_path('Providers/AppServiceProvider.php'));
     $files->copyDirectory(__DIR__ . '/stubs/scaffold/resources/views', base_path('resources/views'));
     $this->info('Authentication scaffolding complete!');
 }
Example #5
0
 /**
  * Copy all files from a given path to the publish path.
  *
  * @param  string  $name
  * @param  string  $source
  * @return bool
  */
 public function publish($name, $source)
 {
     $destination = $this->getDestinationPath($name);
     $source = $source ?: $this->sourcePath;
     $success = $this->files->copyDirectory($source, $destination);
     if (!($success || $this->quiteFail)) {
         throw new \RuntimeException("Unable to publish files: {$source} => {$destination}.");
     }
     return $success;
 }
Example #6
0
 public function publish()
 {
     $destination = config_path('packages/' . $this->package);
     if (!$this->files->exists($this->sourcePath)) {
         return;
     }
     if (!$this->files->exists($destination)) {
         $this->files->makeDirectory($destination, 0755, true);
     }
     $this->files->copyDirectory($this->sourcePath, $destination);
 }
Example #7
0
 /**
  * Copy specific directories from elFinder to their destination
  *
  * @param $destination
  * @return bool
  */
 protected function copyElfinderFiles($destination)
 {
     $result = true;
     $directories = array('js', 'css', 'img');
     $elfinderPath = $this->getElfinderPath();
     foreach ($directories as $dir) {
         $path = $elfinderPath . '/' . $dir;
         $success = $this->files->copyDirectory($path, $destination . '/' . $dir);
         $result = $success && $result;
     }
     return $result;
 }
Example #8
0
 /**
  * Publish the assets
  */
 public function publish()
 {
     if (!$this->finder->isDirectory($sourcePath = $this->getSourcePath())) {
         $message = "Source path does not exist : {$sourcePath}";
         throw new \InvalidArgumentException($message);
     }
     if (!$this->finder->isDirectory($destinationPath = $this->getDestinationPath())) {
         $this->finder->makeDirectory($destinationPath, 0775, true);
     }
     if ($this->finder->copyDirectory($sourcePath, $destinationPath)) {
         return true;
     }
 }
Example #9
0
 /**
  * Publishes all themes files in the given package to their
  * respective themes.
  *
  * @param  string  $source
  * @return bool
  * @throws \InvalidArgumentException
  * @throws \RuntimeException
  */
 public function publish($source)
 {
     if (!$this->filesystem->isDirectory($source)) {
         throw new InvalidArgumentException("Source [{$source}] does not exist.");
     }
     $paths = $this->getThemeSourcePaths($source);
     foreach ($paths as $path) {
         $relativePath = str_replace(str_finish($source, '/'), '', $path);
         $slugs = $this->extractSlugsFromPath($relativePath);
         // If we cannot resolve a theme, the user has probably got assets
         // for a theme which isn't in this installation. Let's not punish
         // them for supporting more than the installed themes, we'll just
         // let them know we've skipped it.
         try {
             $theme = $this->getThemeForSlugs($slugs);
         } catch (RuntimeException $e) {
             $this->note(sprintf('Couln\'t load theme for slug(s) [%s] in source [%s], skipping.', implode(', ', $slugs), $source));
             continue;
         }
         $mappings = $this->getCopyMappings($path, $theme);
         foreach ($mappings as $_source => $destination) {
             $success = $this->filesystem->copyDirectory($_source, $destination);
             if (!$success) {
                 throw new RuntimeException("Failed to publish [{$_source}] to [{$destination}].");
             }
         }
     }
     return true;
 }
Example #10
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $name = $this->argument('name');
     $fileSystem = new Filesystem();
     $files = $fileSystem->allFiles(base_path('resources/themes/' . strtolower($name) . '/public'));
     foreach ($files as $file) {
         if ($file->getType() === 'file') {
             $this->line(public_path($file->getBasename()));
         }
     }
     $this->info("\n\nThese files will be overwritten\n");
     if (!$this->option('forced')) {
         $result = $this->confirm('Are you sure you want to overwrite any files of the same name?');
     } else {
         $result = true;
     }
     if ($result) {
         foreach ($files as $file) {
             $newFileName = str_replace(base_path('resources/themes/' . strtolower($name) . '/public/'), '', $file);
             $this->line('Copying ' . public_path($newFileName) . '...');
             if (is_dir($file)) {
                 $fileSystem->copyDirectory($file, public_path($newFileName));
             } else {
                 @mkdir(public_path(str_replace(basename($newFileName), '', $newFileName)), 0755, true);
                 $fileSystem->copy($file, public_path($newFileName));
             }
         }
     } else {
         $this->info("\n\nNo files were published\n");
     }
 }
 /**
  * Duplicate a template configuration
  * 
  * @param  string $existingTemplate
  * @param  string $template
  * @return $this
  */
 public function duplicate($existingTemplate, $template)
 {
     $existingTemplate = $this->first($existingTemplate);
     $this->filesystem->copyDirectory($this->getProjectPath() . $this->translateGlobalTemplate($existingTemplate['globalTemplate']) . '/restaurants/' . $existingTemplate['template'], $this->getProjectPath() . $this->translateGlobalTemplate($existingTemplate['globalTemplate']) . '/restaurants/' . $template);
     $this->filesystem->copyDirectory($this->getProjectPath() . 'public/application/views/' . $existingTemplate['template'], $this->getProjectPath() . 'public/application/views/' . $template);
     $this->add($template, $template, $existingTemplate['baseTemplate'], $existingTemplate['globalTemplate'], $existingTemplate['iconFolder']);
     return $this;
 }
Example #12
0
 /**
  * Function to copy files given in the template
  * configuration from the given source to the
  * given destination.  
  * 
  * The command will take into account if you are
  * copying files or directories and act accordingly
  * 
  * @return void
  */
 public function copy()
 {
     $key = str_replace(TemplateReader::STRUCTURE . '.', '', TemplateReader::STRUCTURE_COPY);
     $data = array_get($this->config, $key);
     foreach ($data as $cp) {
         $from = Path::absolute($cp['from'], $this->appDir);
         $to = Path::absolute($cp['to'], $this->appDir);
         $this->command->comment("Copy", "from {$from} to {$to}");
         if (!$this->filesystem->exists(dirname($to))) {
             $this->filesystem->makeDirectory(dirname($to), 0777, true);
         }
         if ($this->filesystem->isDirectory($from) && $this->filesystem->isDirectory($to)) {
             $this->filesystem->copyDirectory($from, $to);
         } else {
             $this->filesystem->copy($from, $to);
         }
     }
 }
Example #13
0
 /**
  * Publish assets form the specified module.
  *
  * @param $module
  */
 protected function publishFromModule($module)
 {
     if (!$this->module->has($module)) {
         $this->console->error("Module [{$module}] does not exist.");
         exit;
     }
     $this->filesystem->copyDirectory($this->getPublishingPath($module), $this->getDestinationPath($module));
     $this->console->info("Assets published from module : {$module}");
 }
 /**
  * Handle the command.
  *
  * @param  Filesystem  $filesystem
  * @param  Application $application
  * @return string
  */
 public function handle(Filesystem $filesystem, Application $application)
 {
     $destination = $application->getResourcesPath('streams/lang');
     if (is_dir($destination) && !$this->command->option('force')) {
         return $this->command->error("{$destination} already exists.");
     }
     $filesystem->copyDirectory(__DIR__ . '/../../../../resources/lang', $destination);
     $this->command->info("Published {$destination}");
 }
Example #15
0
 /**
  * Create models in main app models directory.
  *
  * @return array
  */
 public function CreatePowerModels()
 {
     $dest = $this->laravel->path . '/models';
     $dir = __DIR__ . '/../Models';
     $f = new Filesystem();
     if ($f->copyDirectory($dir, $dest)) {
         return true;
     }
     return false;
 }
 /**
  * Handle the command.
  *
  * @param Container       $container
  * @param DashboardModule $module
  * @param Filesystem      $files
  */
 public function handle(Container $container, DashboardModule $module, Filesystem $files)
 {
     $libraries = ['highcharts', 'highmaps'];
     foreach ($libraries as $library) {
         $target = $container->make('Anomaly\\Streams\\Platform\\Application\\Application')->getAssetsPath($library);
         if (!is_dir($target)) {
             $files->copyDirectory($module->getPath('resources/js/' . $library), $target);
         }
     }
 }
Example #17
0
 protected function copyThemeDirectory()
 {
     $plugin = $this->attr('plugin');
     $path = $plugin->getPath($this->attr('path'));
     if (!$this->files->copyDirectory(__DIR__ . '/stubs/theme', $path)) {
         throw new \Exception("Unable to create theme directory[{$path}]. please check permission.");
     }
     rename($path . '/info.stub', $path . '/info.php');
     unlink($path . '/theme.stub');
 }
 /**
  * Handle the command.
  *
  * @param  Filesystem  $filesystem
  * @param  Application $application
  * @return string
  */
 public function handle(Filesystem $filesystem, Application $application)
 {
     $destination = $application->getResourcesPath('addons/' . $this->addon->getVendor() . '/' . $this->addon->getSlug() . '-' . $this->addon->getType() . '/views');
     if (is_dir($destination) && !$this->command->option('force')) {
         $this->command->error("{$destination} already exists.");
         return;
     }
     $filesystem->copyDirectory($this->addon->getPath('resources/views'), $destination);
     $this->command->info("Published {$destination}");
 }
Example #19
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);
     }
 }
Example #20
0
 /**
  * 从备份文件夹恢复原文件,防止资源包更新时做多余的下载浪费时间
  * @return void
  */
 public static function restore()
 {
     $Filesystem = new Filesystem();
     $vendorDir = dirname(dirname(dirname(dirname(__DIR__))));
     $topDir = dirname($vendorDir);
     $backupDir = $topDir . '/VendorCleanerBackup';
     if ($Filesystem->exists($backupDir)) {
         // 文件恢复
         $Filesystem->copyDirectory($backupDir, $vendorDir);
         $Filesystem->deleteDirectory($backupDir);
     }
 }
Example #21
0
 /**
  * Publish a lang.
  *
  * @param  string  $localeKey
  * @param  bool    $force
  *
  * @return bool
  *
  * @throws \Arcanedev\LaravelLang\Exceptions\LangPublishException
  */
 public function publish($localeKey, $force = false)
 {
     $localeKey = trim($localeKey);
     if ($this->isDefault($localeKey)) {
         return true;
     }
     $this->checkLocale($localeKey);
     $srcPath = $this->getLocale($localeKey)->getPath();
     $destPath = $this->getDestinationPath($localeKey);
     $this->isPublishable($localeKey, $destPath, $force);
     return $this->filesystem->copyDirectory($srcPath, $destPath);
 }
Example #22
0
 public function copyPreparedFiles($directory, $destination)
 {
     $fileSystem = new Filesystem();
     $files = $fileSystem->allFiles($directory);
     $fileDeployed = false;
     $fileSystem->copyDirectory($directory, $destination);
     foreach ($files as $file) {
         $fileContents = $fileSystem->get($file);
         $fileContentsPrepared = str_replace('{{App\\}}', $this->getAppNamespace(), $fileContents);
         $fileDeployed = $fileSystem->put($destination . '/' . $file->getRelativePathname(), $fileContentsPrepared);
     }
     return $fileDeployed;
 }
 /**
  * Return the path to the checked out repository for the supplied
  * manual and version.
  *
  * @param string $manual
  * @param string $version
  * @return string
  */
 private function getStoragePath($manual, $version)
 {
     $storagePath = storage_path('codex/' . $manual . '/' . $version);
     if (!file_exists($storagePath)) {
         $this->files->copyDirectory($this->storagePath . '/' . $manual, $storagePath, 0);
         $this->git->setRepository($storagePath);
         $this->git->checkout($version);
     } else {
         $this->cache->remember("{$manual}.{$version}.checkout", 10, function () use($version, $storagePath) {
             $this->git->setRepository($storagePath);
             $this->git->pull('origin', $version);
             return true;
         });
     }
     return $storagePath;
 }
Example #24
0
 private function handlePackageGroup($packagePath, $groupName, $fileList)
 {
     $this->output->writeln("<info>  Handling group: </info>{$groupName}");
     // iterating through file list
     foreach ($fileList as $fileString) {
         // removing extra space characters for nice message
         $fileString = preg_replace('/(\\ {1,})/is', '', $fileString);
         $this->output->writeln("<info>  Handling item:\n  -  </info><comment>" . $fileString . "</comment>");
         list($sourcesPath, $targetPath) = $this->extractNotation($fileString);
         // creating targetPath if it does not exist
         if (!$this->fileSystem->isDirectory($targetPath)) {
             $this->fileSystem->makeDirectory($targetPath, 0777, true, true);
         }
         // if sourcesPath contains link syntax
         if (substr_count($sourcesPath, '@') == 0) {
             // merging package path and sourcePath
             $sourcesPath = $packagePath . '/' . trim($sourcesPath, '\\/');
             // getting file/files/folder by sourcePath mask
             foreach (glob($sourcesPath) as $source) {
                 $this->output->writeln("     Copying:\n\t" . "<info>source:</info> [<comment>{$source}</comment>]" . "\n\t" . "<info>target:</info> [<comment>{$targetPath}</comment>]");
                 // if source is directory
                 if (is_dir($source)) {
                     $this->fileSystem->copyDirectory($source, $targetPath);
                 } else {
                     $this->fileSystem->copy($source, $targetPath . '/' . basename($source));
                 }
             }
         } else {
             // composing sourcePath and replacing @ character
             $sourcesPath = $packagePath . '/' . str_replace('@', '', trim($sourcesPath, '\\/'));
             // running sourcePath as mask
             foreach (glob($sourcesPath) as $source) {
                 // link target path
                 $currentSourceTarget = $targetPath . '/' . basename($source);
                 if (is_link($currentSourceTarget)) {
                     $this->output->writeln('     Removing old symlynk at ' . $currentSourceTarget);
                     unlink($currentSourceTarget);
                 }
                 $this->output->writeln("     Linking:\n\t" . "<info>source:</info> [<comment>{$source}</comment>]" . "\n\t" . "<info>target:</info> [<comment>{$targetPath}</comment>]");
                 symlink($source, $currentSourceTarget);
             }
         }
         $this->output->writeln("");
     }
 }
Example #25
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $name = $this->argument('name');
     $fileSystem = new Filesystem();
     $files = $fileSystem->allFiles(__DIR__ . '/../PublishedAssets/Theme');
     $this->line("\n");
     foreach ($files as $file) {
         $this->line(str_replace(__DIR__ . '/../PublishedAssets/Theme/', '', str_replace('themeTemplate', strtolower($name), $file)));
     }
     $this->info("\n\nThese files will be generated\n");
     $result = $this->confirm('Are you sure you want to generate this theme?');
     if ($result) {
         foreach ($files as $file) {
             $newFileName = str_replace(__DIR__ . '/../PublishedAssets/Theme', '', $file);
             $newFileName = str_replace('themeTemplate', strtolower($name), $newFileName);
             $this->line('Copying ' . $newFileName . '...');
             if (is_dir($file)) {
                 $fileSystem->copyDirectory($file, base_path($newFileName));
             } else {
                 @mkdir(base_path(str_replace(basename($newFileName), '', $newFileName)), 0755, true);
                 $fileSystem->copy($file, base_path($newFileName));
             }
         }
         $sass = file_get_contents(base_path('resources/themes/' . strtolower($name) . '/assets/sass/_theme.scss'));
         $sassRepairs = str_replace('themeTemplate', strtolower($name), $sass);
         file_put_contents(base_path('resources/themes/' . strtolower($name) . '/assets/sass/_theme.scss'), $sassRepairs);
         $layout = file_get_contents(base_path('resources/themes/' . strtolower($name) . '/layout/master.blade.php'));
         $layoutRepairs = str_replace('themeTemplate', strtolower($name), $layout);
         file_put_contents(base_path('resources/themes/' . strtolower($name) . '/layout/master.blade.php'), $layoutRepairs);
         $this->info('Finished generating your theme');
         $this->line("\n");
         $this->info('Please add this to your gulpfile.js in the scripts elixir:');
         $this->comment('../../themes/' . strtolower($name) . '/assets/js/theme.js');
         $this->line("\n");
         $this->info('Please add this to your app.scss:');
         $this->comment('@import "resources/themes/' . strtolower($name) . '/assets/sass/_theme.scss"');
     } else {
         $this->info('Nothing has been changed or added');
     }
 }
Example #26
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (is_dir(base_path(Config::get('quarx.module-directory')) . '/' . ucfirst($this->argument('module')) . '/Publishes')) {
         $fileSystem = new Filesystem();
         $files = $fileSystem->allFiles(base_path(Config::get('quarx.module-directory')) . '/' . ucfirst($this->argument('module')) . '/Publishes');
         $this->line("\n");
         foreach ($files as $file) {
             if ($file->getType() == 'file') {
                 $this->line(str_replace(base_path(Config::get('quarx.module-directory')) . '/' . ucfirst($this->argument('module')) . '/Publishes/', '', $file));
             }
         }
         $this->info("\n\nThese files will be published\n");
         $result = $this->confirm('Are you sure you want to overwrite any files of the same name?');
         if ($result) {
             foreach ($files as $file) {
                 $newFileName = str_replace(base_path('quarx/modules/' . ucfirst($this->argument('module')) . '/Publishes/'), '', $file);
                 if (strstr($newFileName, 'resources/themes/')) {
                     $newFileName = str_replace('/default/', '/' . Config::get('quarx.frontend-theme') . '/', $newFileName);
                     $this->line('Copying ' . $newFileName . ' using current Quarx theme...');
                 } else {
                     $this->line('Copying ' . $newFileName . '...');
                 }
                 if (is_dir($file)) {
                     $fileSystem->copyDirectory($file, base_path($newFileName));
                 } else {
                     @mkdir(base_path(str_replace(basename($newFileName), '', $newFileName)), 0755, true);
                     $fileSystem->copy($file, base_path($newFileName));
                 }
             }
             $this->info('Finished publishing this module.');
         } else {
             $this->info('You cancelled publishing this module');
         }
     } else {
         $this->line('This module may have been installed via composer, if so please run:');
         $this->info('php artisan vendor:publish');
         $this->line('You will need to ensure that you copy the published views of this module in the default theme into your custom themes.');
     }
 }
Example #27
0
 /**
  * Copy a directory from one location to another.
  *
  * @param string $directory
  * @param string $destination
  * @param int $options
  * @return bool 
  * @static 
  */
 public static function copyDirectory($directory, $destination, $options = null)
 {
     return \Illuminate\Filesystem\Filesystem::copyDirectory($directory, $destination, $options);
 }
Example #28
0
 /**
  * Copy the assets from an extension's assets directory into public view.
  *
  * @param string $extension
  */
 protected function publishAssets($extension)
 {
     $this->filesystem->copyDirectory($this->app->basePath() . '/extensions/' . $extension . '/assets', $this->app->basePath() . '/assets/extensions/' . $extension);
 }
Example #29
0
 /**
  * Publish configuration files from a given path.
  *
  * @param  string  $package
  * @param  string  $source
  * @return bool
  */
 public function publish($package, $source)
 {
     $destination = $this->publishPath . "/packages/{$package}";
     $this->makeDestination($destination);
     return $this->files->copyDirectory($source, $destination);
 }
Example #30
0
 /**
  * @param Filesystem $fileSystem
  * @param $source
  * @param $destination
  */
 public function copyUml(Filesystem $fileSystem, $source, $destination)
 {
     $fileSystem->copyDirectory($source, $destination);
 }