Example #1
0
 /**
  * Copy migration files from the migrations directory
  *
  * @access public
  * @param string $targetPath
  * @return void
  */
 public function publishAddFunctionMigration($targetPath)
 {
     // The wgs84distance migration
     $source = __DIR__ . '/../../../' . self::MIGRATION_FUNCTION_NAME . '.php';
     $target = $this->getMigrationFileName(self::MIGRATION_FUNCTION_NAME);
     $this->doNotOverwriteFile($targetPath, self::MIGRATION_FUNCTION_NAME);
     $this->file->copy($source, "{$targetPath}/{$target}");
 }
 /**
  * Publish the file to the given path.
  *
  * @param  string  $from
  * @param  string  $to
  * @return void
  */
 protected function publishFile($from, $to)
 {
     if ($this->files->exists($to) && !$this->option('force')) {
         return;
     }
     $this->createParentDirectory(dirname($to));
     $this->files->copy($from, $to);
     $this->status($from, $to, 'File');
 }
 /**
  * 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!');
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $destination = $this->laravel['path'] . '/controllers/RemindersController.php';
     if (!$this->files->exists($destination)) {
         $this->files->copy(__DIR__ . '/stubs/controller.stub', $destination);
         $this->info('Password reminders controller created successfully!');
         $this->comment("Route: Route::controller('password', 'RemindersController');");
     } else {
         $this->error('Password reminders controller already exists!');
     }
 }
 public function setUp()
 {
     $this->fileSystem = new Filesystem();
     $this->cache = new Repository(new FileStore($this->fileSystem, './cache'));
     $this->fileSystem->copy('./stubs.sqlite', './stubs-real.sqlite');
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'sqlite', 'database' => './stubs-real.sqlite', 'prefix' => '']);
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
     $this->connection = $capsule->getDatabaseManager()->connection('default');
 }
Example #6
0
 /**
  *
  */
 public function setUp()
 {
     parent::setUp();
     $this->config = App::make('Illuminate\\Contracts\\Config\\Repository');
     $module = App::make('modules');
     $this->finder = App::make('Illuminate\\Filesystem\\Filesystem');
     $this->imagy = new Imagy(new InterventionFactory(), new ThumbnailsManager($this->config, $module), $this->config);
     $this->testbenchPublicPath = __DIR__ . '/../vendor/orchestra/testbench/fixture/public/';
     $this->mediaPath = __DIR__ . '/Fixtures/';
     $this->finder->copy("{$this->mediaPath}google-map.png", "{$this->testbenchPublicPath}google-map.png");
 }
 public function CreatePowerMigration()
 {
     $des1 = $this->laravel->path . "/database/migrations/" . date('Y_m_d_His') . "_power_migration_table.php";
     $des2 = $this->laravel->path . "/database/migrations/" . date('Y_m_d_His') . "_power_soft_delete_table.php";
     $file1 = __DIR__ . '/../../../migrations/PowerMigrationTable.php';
     $file2 = __DIR__ . '/../../../migrations/PowerSoftDeleteTable.php';
     $f = new Filesystem();
     if ($f->copy($file1, $des1) && $f->copy($file2, $des2)) {
         return true;
     }
     return false;
 }
Example #8
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");
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire(Filesystem $files)
 {
     $data = [];
     $newLocale = $this->input->getOption('locale');
     foreach (app('module.loader')->getRegisteredModules() as $module) {
         if (!is_dir($module->getLocalePath())) {
             continue;
         }
         foreach ($files->directories($module->getLocalePath()) as $localeDir) {
             $locale = basename($localeDir);
             if ($locale != $this->copiedLocale) {
                 continue;
             }
             foreach ($files->allFiles($localeDir) as $localeFile) {
                 $data[strtolower($module->getName())][] = $localeFile->getRealPath();
             }
         }
     }
     $langDirectory = base_path('/resources/lang/packages');
     foreach ($data as $namespace => $locales) {
         foreach ($locales as $group => $file) {
             $filename = pathinfo($file, PATHINFO_FILENAME);
             $fileDir = $langDirectory . DIRECTORY_SEPARATOR . $newLocale . DIRECTORY_SEPARATOR . $namespace;
             if (!$files->exists($fileDir)) {
                 $files->makeDirectory($fileDir, 0755, TRUE);
             }
             $files->copy($file, $fileDir . DIRECTORY_SEPARATOR . $filename . '.php');
         }
     }
 }
Example #10
0
 /**
  * Backup config file
  */
 protected function backup()
 {
     $from = $this->configFile;
     $pathinfo = pathinfo($from);
     $to = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename'] . '.bak.php';
     $this->file->copy($from, $to);
 }
 public function fire()
 {
     $environment = $this->config->get('app.env');
     $gitSnifferEnv = $this->config->get('git-sniffer.env');
     if ($environment !== $gitSnifferEnv) {
         return;
     }
     $hooksDir = base_path('.git/hooks');
     if (!$this->files->isDirectory($hooksDir)) {
         $this->files->makeDirectory($hooksDir, 0755);
     }
     $preCommitHook = $hooksDir . '/pre-commit';
     $preCommitResource = $this->files->dirname(__DIR__) . '/resources/pre-commit';
     if ($this->files->exists($preCommitResource)) {
         $this->files->copy($preCommitResource, $preCommitHook);
     }
 }
 /**
  * Create Anonymizer class.
  *
  * @param string $dir
  *
  * @return void
  */
 protected function createAnonymizer($dir, $class)
 {
     $path = "{$dir}/{$class}.php";
     if ($this->files->exists($path)) {
         $this->error("File {$path} already exists");
         return;
     }
     $this->files->copy(__DIR__ . '/stubs/' . $class . '.stub', $path);
 }
Example #13
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 #14
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // 確認是否有 api key
     if (null === $this->apiPublicKey) {
         $this->error('Invalid VirusTotal api public key.');
         return;
     }
     if (!$this->filesystem->isFile($file = $this->argument('file'))) {
         $this->error('File not exists.');
         return;
     }
     // 取得欲儲存的 Model
     if (null === ($model = $this->option('model'))) {
         $model = $this->ask('The Eloquent ORM Model');
     }
     // 取得欲儲存的欄位
     if (null === ($column = $this->option('column'))) {
         $column = $this->ask('The table\'s column to store the result');
     }
     // 取得欲儲存的欄位
     if (null === ($index = $this->option('index'))) {
         $index = $this->ask('The primary key\'s value to specific row');
     }
     // 檢查 Model 是否存在
     if (!class_exists($model)) {
         $this->error('Model not exists.');
         return;
     }
     $model = (new $model())->find($index);
     // 檢查該比資料是否存在
     if (null === $model) {
         $this->error('Model not exists');
         return;
     }
     // 檢查欄位是否存在
     if (!Schema::hasColumn($model->getTableName(), $column)) {
         $this->error('Column not exists.');
         return;
     }
     // 檢查是否有替代檔名
     if (null !== ($fakeName = $this->option('fakeName')) && strlen($fakeName) > 0) {
         $fakePath = temp_path($fakeName);
         $this->filesystem->copy($file, $fakePath);
         $file = $fakePath;
     }
     $virusTotal = new File($this->apiPublicKey);
     $report = $virusTotal->scan($file);
     $model->{$column} = $report['permalink'];
     $model->save();
     if (isset($fakePath)) {
         $this->filesystem->delete($fakePath);
     }
     $this->info('File scan successfully!');
 }
 /**
  * Get the key file and contents.
  *
  * @return array
  */
 public function getKeyFileArray()
 {
     $path = $this->getKeyFilePath();
     $defaultEnvFile = dirname(__FILE__) . "/../Files/.env.default.php";
     if (!$this->files->exists($path)) {
         $this->files->copy($defaultEnvFile, $path);
         // copy default file
     }
     $envConfig = $this->files->includeFile($path);
     return $envConfig;
 }
Example #16
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $filesystem = new Filesystem();
     $filesystem->makeDirectory($this->projectPath . $this->viewsPath, 0775, false, true);
     $filesystem->makeDirectory($this->projectPath . $this->viewsPath . $this->layoutPath, 0775, false, true);
     $filesystem->makeDirectory($this->projectPath . $this->viewsPath . $this->partialsPath, 0775, false, true);
     $filesystem->makeDirectory($this->projectPath . $this->cachePath, 0775, false, true);
     $filesystem->makeDirectory($this->projectPath . $this->outputPath, 0775, false, true);
     $filesystem->makeDirectory($this->projectPath . $this->publicPath, 0775, false, true);
     $filesystem->copy(__DIR__ . '/../index.php', $this->projectPath . $this->publicPath . '/index.php');
     $output->writeln("Initialization complete!");
 }
Example #17
0
 /**
  * Erstellt die module.json Datei
  * 
  * @param string $module
  * @return void
  */
 private function createFile($module)
 {
     $module = $this->modules[$module];
     if($this->files->isWritable($module))
     {
         $this->files->copy(__DIR__.'/../templates/module.json', $module.'/module.json');
     }
     else
     {
         return App::abort('403', "Please set writable permissions to " . $module . "\n");
     }
 }
 /**
  * Publish file to application.
  *
  * @author Morten Rugaard <*****@*****.**>
  *
  * @param string $from
  * @param string $to
  *
  * @return void
  */
 protected final function publishFile($from, $to)
 {
     // If destination directory doesn't exist,
     // we'll create before copying the config files
     $directoryDestination = dirname($to);
     if (!$this->files->isDirectory($directoryDestination)) {
         $this->files->makeDirectory($directoryDestination, 0755, true);
     }
     // Copy file to application
     $this->files->copy($from, $to);
     // Output status message
     $this->getCommand()->line(sprintf('<info>Copied %s</info> <comment>[%s]</comment> <info>To</info> <comment>[%s]</comment>', 'File', str_replace(base_path(), '', realpath($from)), str_replace(base_path(), '', realpath($to))));
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $destination = $this->getPath('views') . '/braintreeTestView.blade.php';
     if (!$this->files->exists($destination)) {
         $this->files->copy(__DIR__ . '/stubs/testView.stub', $destination);
         $this->info('BraintreeTestView.blade.php created successfully!');
     } else {
         $this->error('BraintreeTestView.blade.php already exists!');
     }
     $destination = $this->getPath('controllers') . '/BraintreeController.php';
     if (!$this->files->exists($destination)) {
         $this->files->copy(__DIR__ . '/stubs/controller.stub', $destination);
         $this->info('BraintreeController.php created successfully!');
         $this->comment("");
         $this->comment("Add in your routes:");
         $this->comment("Route::controller('braintree', 'BraintreeController');");
         $this->info("");
         $this->info("To access the test view, navigate to /braintree/test-view");
     } else {
         $this->error('BraintreeController.php already exists!');
     }
 }
Example #20
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->file->makeDirectory($this->module_path, 0777, false, true);
     $moduleName = $this->argument('Module Name');
     $modulePath = $this->module_path . "/" . $moduleName;
     $existModules = array_map('strtolower', $this->file->directories($this->module_path));
     if (in_array(strtolower($modulePath), $existModules)) {
         $this->error("Module is exist");
     }
     foreach (['', '/configs', '/forms', '/filters', '/views', '/models'] as $sub) {
         $this->file->makeDirectory($modulePath . $sub, 0777, true, true);
     }
     $actionContent = str_replace('{MODULE}', $moduleName, file_get_contents(__DIR__ . '/template/Actions.php.raw'));
     $formContent = str_replace('{MODULE}', $moduleName, file_get_contents(__DIR__ . '/template/Form.php.raw'));
     $filterContent = str_replace('{MODULE}', $moduleName, file_get_contents(__DIR__ . '/template/Filter.php.raw'));
     $modelContent = str_replace('{MODULE}', $moduleName, file_get_contents(__DIR__ . '/template/Model.php.raw'));
     $this->file->put($modulePath . "/{$moduleName}Actions.php", $actionContent);
     $this->file->put($modulePath . "/forms/{$moduleName}Form.php", $formContent);
     $this->file->put($modulePath . "/filters/{$moduleName}Filter.php", $filterContent);
     $this->file->put($modulePath . "/models/{$moduleName}.php", $modelContent);
     $this->file->copy(__DIR__ . "/../skeleton/module/config/default.php", $modulePath . "/configs/config.php");
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function createControllers()
 {
     $stubs = ['ConversationsController' => __DIR__ . '/../stubs/ConversationsController.php'];
     foreach ($stubs as $name => $stub) {
         $destination = app_path() . "/controllers/{$name}.php";
         if ($this->filesystem->exists($destination)) {
             if ($this->confirm("\"app/controllers/{$name}.php\" already exists do you wish to overwrite it? [yes|no]")) {
                 $this->filesystem->copy($stub, $destination);
                 $this->info("Created \"app/controllers/{$name}.php\"");
             }
         } else {
             $this->filesystem->copy($stub, $destination);
             $this->info("Created \"app/controllers/{$name}.php\"");
         }
     }
 }
Example #22
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 #23
0
 protected function copyFilesToDestination($force = false)
 {
     $filesPublished = 0;
     $files = $this->files();
     foreach ($files as $f) {
         $filename = basename($f);
         $destination = $this->destination($f);
         if (is_file($destination)) {
             if (!$force) {
                 $this->container->command()->line("<fg=yellow>Skipping</fg=yellow> <info>{$filename}</info>: file already exists in destination");
                 continue;
             }
             $this->backup($destination);
         }
         $this->filesystem->copy($f, $destination);
         $filesPublished++;
     }
     return $filesPublished;
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle(Filesystem $filesystem, AddonEnvironment $env)
 {
     // make addons/
     $addonsDirectory = $env->path();
     if (!$filesystem->exists($addonsDirectory)) {
         $filesystem->makeDirectory($addonsDirectory);
     }
     // copy app/config/addon.php
     $addonConfigSourceFile = __DIR__ . '/../../config/addon.php';
     $addonConfigFile = $this->laravel['path.config'] . '/addon.php';
     if (!$filesystem->exists($addonConfigFile)) {
         $filesystem->copy($addonConfigSourceFile, $addonConfigFile);
         $this->info('make config: ' . $addonConfigFile);
     }
     // show lists
     $addons = $env->addons();
     foreach ($addons as $addon) {
         $this->dump($addon);
     }
 }
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.');
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire(Filesystem $files)
 {
     $data = [];
     if (is_null($fromLocale = $this->input->getOption('from'))) {
         $fromLocale = 'ru';
     }
     $newLocale = $this->input->getOption('locale');
     foreach (ModulesLoader::getRegisteredModules() as $module) {
         if (!is_dir($module->getLocalePath()) or !$module->isPublishable()) {
             continue;
         }
         foreach ($files->directories($module->getLocalePath()) as $localeDir) {
             $locale = basename($localeDir);
             if ($locale != $fromLocale) {
                 continue;
             }
             foreach ($files->allFiles($localeDir) as $localeFile) {
                 $data[$module->getKey()][] = $localeFile->getRealPath();
             }
         }
     }
     $langDirectory = base_path('/resources/lang/vendor');
     foreach ($data as $namespace => $locales) {
         foreach ($locales as $group => $file) {
             $filename = pathinfo($file, PATHINFO_FILENAME);
             $fileDir = $langDirectory . DIRECTORY_SEPARATOR . $namespace . DIRECTORY_SEPARATOR . $newLocale;
             if (!$files->exists($fileDir)) {
                 $files->makeDirectory($fileDir, 0755, true);
             }
             $to = $fileDir . DIRECTORY_SEPARATOR . $filename . '.php';
             $files->copy($file, $fileDir . DIRECTORY_SEPARATOR . $filename . '.php');
             $this->line("<info>Copied {$namespace}:{$filename}</info> <comment>[{$file}]</comment> <info>To</info> <comment>[{$to}]</comment>");
         }
     }
     $this->info('Publishing Complete!');
 }
Example #28
0
 /**
  * Copy a file to a new location.
  *
  * @param string $path
  * @param string $target
  * @return bool 
  * @static 
  */
 public static function copy($path, $target)
 {
     return \Illuminate\Filesystem\Filesystem::copy($path, $target);
 }
Example #29
0
 /**
  * Write the stub .gitignore file for the package.
  *
  * @param  \Illuminate\Workbench\Package  $package
  * @param  string  $directory
  * @param  bool    $plain
  * @return void
  */
 public function writeIgnoreFile(Package $package, $directory, $plain)
 {
     $this->files->copy(__DIR__ . '/stubs/gitignore.txt', $directory . '/.gitignore');
 }
 /**
  * Copy a file to a new location.
  * @param  string  $path
  * @param  string  $target
  * @return bool
  */
 public function copy($path, $target)
 {
     $result = parent::copy($path, $target);
     $this->chmod($target);
     return $result;
 }