/**
  * Handle the command.
  *
  * @param Markdown $markdown
  */
 public function handle(Markdown $markdown)
 {
     $this->command->info(strip_tags($markdown->transform(file_get_contents(base_path('LICENSE.md')))));
     if (!$this->command->confirm('Do you agree to the provided license and terms of service?')) {
         $this->command->error('You must agree to the license and terms of service before continuing.');
         exit;
     }
 }
 public function check($release)
 {
     $this->command->line('Lastest version found is <info>' . $release . '</info> 
     Current version is <info>' . $this->getSparkVersion() . '</info>' . PHP_EOL);
     if ($this->supported($release)) {
         $this->command->line('Release ' . $release . ' is Hexavel compatible: <info>✔</info>');
         return true;
     }
     $this->command->line('<error>Version ' . $release . ' is not yet considered Hexavel compatible</error>' . PHP_EOL);
     $this->command->line('This <fg=red;options=bold;>might break your application</> but you can continue at your own risk. If you have not already, try updating Hexavel-Spark via \'composer update\'.');
     if (!$this->command->confirm('Do you wish to still continue? [y|N]')) {
         return false;
     }
     return true;
 }
Example #3
0
 /**
  * Confirm a question with the user.
  *
  * @param string $message
  *
  * @return string
  */
 public function confirm($message)
 {
     if ($this->console->option('no-question')) {
         return true;
     }
     return $this->console->confirm($message);
 }
Example #4
0
 public function confirm($question, $default = false)
 {
     if ($this->option('no-input')) {
         return true;
     }
     return parent::confirm($question, $default);
 }
Example #5
0
 public function confirm($question, $default = true)
 {
     if ($this->option('yes')) {
         return true;
     }
     return parent::confirm($question, $default);
 }
 /**
  * Called after the user has finished registering new services.
  * @return void
  */
 public function afterRegistration()
 {
     $register = $this->command->confirm('Would you like to register system hooks?', true);
     if ($register) {
         $hookRegister = new HookRegister($this->gitlabManager);
         $hookRegister->registerSystemHooksOnInstances();
     }
 }
Example #7
0
 /**
  * @param string $fileName
  * @param string $fileContents
  * @param bool $overwrite
  */
 public function createFile($fileName, $fileContents, $overwrite = false)
 {
     if (\File::exists($fileName) && !$overwrite) {
         $overwrite = $this->fromFile ? true : $this->command->confirm("{$fileName} already exists! Overwrite it? ", true);
         if ($overwrite) {
             \File::put($fileName, $fileContents);
         }
     } else {
         \File::put($fileName, $fileContents);
     }
 }
Example #8
0
 /**
  * Fire the install script.
  *
  * @param Command $command
  *
  * @return mixed
  */
 public function fire(Command $command)
 {
     $gitignorePath = base_path('.gitignore');
     if (!$this->gitignoreContainsComposerLock($gitignorePath)) {
         return;
     }
     $removeComposerLock = $command->confirm('Do you want to remove composer.lock from .gitignore ?', true);
     if ($removeComposerLock) {
         $out = $this->getGitignoreLinesButComposerLock($gitignorePath);
         $this->writeNewGitignore($gitignorePath, $out);
     }
 }
 public function renderCommandField(Command $command)
 {
     while (true) {
         $input = $command->confirm($this->getConsoleLabel());
         $validator = $this->getValidator($input);
         if ($validator->passes()) {
             return $input;
         } else {
             $command->error($validator->errors()->first());
         }
     }
 }
Example #10
0
 /**
  * Fire the install script.
  *
  * @param Command $command
  *
  * @throws Exception
  *
  * @return mixed
  */
 public function fire(Command $command)
 {
     if (!$this->finder->isFile('.env')) {
         throw new Exception('SocietyCMS is not installed. Please run "php artisan society:install" first.');
     }
     if ($command->option('refresh') && !App::environment('demo')) {
         throw new Exception('Refresh option is only available in demo mode.');
     }
     if (!$command->option('force') && !$command->option('refresh')) {
         if (!$command->confirm('Are you sure you want to start Demo Mode?')) {
             throw new Exception('Demo Mode cancelled');
         }
     }
 }
 public function generateLayoutFiles()
 {
     $makeLayout = $this->fromFile ? true : $this->command->confirm('Create default layout file [y/n]? (specify css/js files in config) ', true);
     if ($makeLayout) {
         $layoutPath = $this->configSettings['pathTo']['layout'];
         $layoutDir = substr($layoutPath, 0, strrpos($layoutPath, "/"));
         $next_to_last = strrpos($layoutPath, "/", strrpos($layoutPath, "/") - strlen($layoutPath) - 1) + 1;
         $layoutName = str_replace("/", ".", substr($layoutPath, $next_to_last, strpos($layoutPath, ".") - $next_to_last));
         $directoriesToCreate = array($layoutDir, 'public/js', 'public/css', 'public/img');
         foreach ($directoriesToCreate as $dir) {
             $this->fileCreator->createDirectory($dir);
         }
         $content = \File::get($this->configSettings['pathTo']['controllers'] . 'Controller.php');
         if (strpos($content, "\$layout") === false) {
             $content = preg_replace("/Controller {/", "Controller {\n\tprotected \$layout = '{$layoutName}';", $content);
             \File::put($this->configSettings['pathTo']['controllers'] . 'Controller.php', $content);
         }
         $overwrite = false;
         if (\File::exists($layoutPath)) {
             $overwrite = $this->command->confirm('Layout file exists. Overwrite? [y/n]? ', true);
         }
         if (!\File::exists($layoutPath) || $overwrite) {
             $this->fileContents = \File::get($this->configSettings['pathTo']['templates'] . 'layout.txt');
             $this->fileContents = str_replace("<!--[appName]-->", $this->configSettings['appName'], $this->fileContents);
             $this->downloadAsset("jquery", "http://code.jquery.com/jquery-1.11.0.min.js");
             $this->downloadCSSFramework();
             $this->downloadAsset("underscore", "http://underscorejs.org/underscore-min.js");
             $this->downloadAsset("handlebars", "http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js");
             $this->downloadAsset("angular", "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js");
             $this->downloadAsset("ember", "http://builds.emberjs.com/tags/v1.5.0/ember.min.js");
             $this->downloadAsset("backbone", "http://backbonejs.org/backbone-min.js");
             \File::put($layoutPath, $this->fileContents);
         } else {
             $this->command->error('Layout file already exists!');
         }
     }
 }
 /**
  *  Prompt user to run the migrations
  */
 private function runMigrations()
 {
     if (!$this->fromFile) {
         $editMigrations = $this->command->confirm('Would you like to edit your migrations file before running it [y/n]? ', true);
         if ($editMigrations) {
             $this->command->info('Remember to run "php artisan migrate" after editing your migration file');
             $this->command->info('And "php artisan db:seed" after editing your seed file');
         } else {
             while (true) {
                 try {
                     $this->command->call('migrate');
                     $this->command->call('db:seed');
                     break;
                 } catch (\Exception $e) {
                     $this->command->info('Error: ' . $e->getMessage());
                     $this->command->error('This table already exists and/or you have duplicate migration files.');
                     $this->command->confirm('Fix the error and enter "yes" ', true);
                 }
             }
         }
     }
 }
Example #13
0
 /**
  * Confirm a question with the user.
  *
  * @param  string $question
  * @param  bool   $default
  * @return bool
  */
 public function confirm($question, $default = true)
 {
     $question .= $default ? ' [Yn]' : ' [yN]';
     return parent::confirm($question, $default);
 }