/**
  * Returns whether there is user interaction available
  *
  * @return array
  */
 public function isInteractive()
 {
     if (is_null($this->command)) {
         return false;
     }
     return !(bool) $this->command->option('auto');
 }
Exemple #2
0
 /**
  * Runs the generator.
  */
 public function generate()
 {
     $this->createModulesDir();
     $this->createFolders();
     $this->createFiles();
     $this->console->info("Your module [{$this->name}] has been generated.");
 }
 /**
  * Create a new installer instance.
  *
  * @param  \Illuminate\Console\Command  $command
  * @return void
  */
 public function __construct($command)
 {
     $this->command = $command;
     $this->command->line('Installing JavaScript & Less Assets: <info>✔</info>');
     $this->command->line('Installing Language Files: <info>✔</info>');
     $this->command->line('Installing Views: <info>✔</info>');
 }
Exemple #4
0
 private function getMessage($route, $target_id, \Illuminate\Database\Eloquent\Model $user, \Illuminate\Console\Command $command)
 {
     $url = $route . '/' . $user->id . '/' . $target_id;
     $request = Request::create($url, 'GET');
     Input::initialize([]);
     if ($command->option('verbose')) {
         $command->comment('route:' . $route);
     }
     $item = $this->router->dispatch($request)->getOriginalContent();
     if ($item === null) {
         return;
     }
     $view = 'sms.' . $route;
     $message = view($view, ['item' => $item]);
     if (Config::get('sms-manager.prefix')) {
         $message = Config::get('sms-manager.prefix') . $message;
     }
     $adminPhone = Config::get('sms-manager.admin_phone');
     $receiver_number = $adminPhone ? $adminPhone : $user->phone;
     $to = $user->name;
     // HACKHACK: Needs to update the database instead
     if ($receiver_number[0] != '6') {
         $receiver_number = '6' . $receiver_number;
     }
     return (object) ['to' => $to, 'receiver_number' => $receiver_number, 'message' => $message];
 }
Exemple #5
0
 /**
  *
  *
  * @param string $class
  * @return void
  */
 public function call($class)
 {
     $this->resolve($class)->run();
     if (isset($this->command)) {
         $this->command->getOutput()->writeln("<info>Gencrud:</info> {$class}");
     }
 }
 /**
  * Run the list of enquires about the configurations
  *
  * @return array
  */
 public function run()
 {
     foreach ($this->fields as $configuration => $value) {
         $this->configurations[$configuration] = $this->origin->ask($value['question'], $value['default']);
     }
     return $this->configurations;
 }
Exemple #7
0
 /**
  * Seed the given connection from the given path.
  *
  * @param  string  $class
  * @return void
  */
 public function call($class)
 {
     $this->resolve($class)->__invoke();
     if (isset($this->command)) {
         $this->command->getOutput()->writeln("<info>Seeded:</info> {$class}");
     }
 }
 /**
  * Generate pluggable folders and files.
  *
  * @param \Aindong\Pluggables\Console\PluggableMakeCommand $console
  *
  * @return bool
  */
 public function generate(Command $console)
 {
     $this->generateFolders();
     $this->generateGitkeep();
     $this->generateFiles();
     $console->info("Pluggable [{$this->name}] has been created successfully.");
     return true;
 }
 /**
  * Seed the fixtures.
  */
 public function seed($table)
 {
     $data = $this->yamlLoader->loadYmlData($table);
     if ($this->command) {
         $this->command->getOutput()->writeln("<info>Seeded Fixture:</info> {$table}");
     }
     $this->process($data['settings'], $data['items']);
 }
Exemple #10
0
 /**
  * Fire the install script.
  *
  * @param Command $command
  *
  * @return mixed
  */
 public function fire(Command $command)
 {
     if ($command->option('verbose')) {
         $command->blockMessage('Seeds', 'Running the module seeds ...', 'comment');
     }
     $this->demoSeedCoreModules($command);
     $this->demoSeedAdditionalModules($command);
 }
 /**
  * Create the specified folder.
  *
  * @param $folder
  * @param $success
  * @param $error
  */
 protected function createFolder($folder, $success, $error)
 {
     if (!is_dir($folder)) {
         $this->files->makeDirectory($folder);
         return $this->console->info($success);
     }
     return $this->console->comment($error);
 }
Exemple #12
0
 /**
  * Fire the install script
  * @param  Command $command
  * @return mixed
  */
 public function fire(Command $command)
 {
     if ($command->option('verbose')) {
         $command->call('key:generate');
         return;
     }
     $command->callSilent('key:generate');
 }
 /**
  * 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;
     }
 }
Exemple #14
0
 /**
  * Create a new installer instance.
  *
  * @param  \Illuminate\Console\Command  $command
  * @return void
  */
 public function __construct($command)
 {
     $this->command = $command;
     $this->command->line('Updating Routes File: <info>✔</info>');
     $this->command->line('Updating Controllers: <info>✔</info>');
     $this->command->line('Updating Middleware: <info>✔</info>');
     $this->command->line('Updating HTTP Kernel: <info>✔</info>');
 }
 /**
  * @param Command $console
  * @return bool
  */
 protected function generate(Command $console)
 {
     $this->generateFolders();
     $this->generateFiles();
     $console->call('module:seed-make', array('module' => $this->name, 'name' => $this->Name, '--master'));
     $console->call('module:controller', array('module' => $this->name, 'controller' => $this->Name . 'Controller'));
     $console->info("Module [{$this->Name}] has been created successfully.");
     return true;
 }
 /**
  * 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}");
 }
 /**
  * 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}");
 }
Exemple #18
0
 /**
  * Fire the install script.
  *
  * @param Command $command
  *
  * @throws Exception
  *
  * @return mixed
  */
 public function fire(Command $command)
 {
     $this->command = $command;
     if ($command->option('verbose')) {
         $command->blockMessage('Requirements', 'Checking System Requirements ...', 'comment');
     }
     $this->checkPHPVersion();
     $this->checkExtensions();
     $this->showResults();
 }
 /**
  * Fire off the handler.
  *
  * @param  \Illuminate\Console\Command $console
  * @param  string                      $slug
  * @param  string                      $class
  * @return bool
  */
 public function fire(Command $console, $slug, $class)
 {
     $this->console = $console;
     $this->moduleName = Str::studly($slug);
     $this->className = studly_case($class);
     if ($this->module->exists($slug)) {
         $this->makeFile();
         return $this->console->info("Created Module Controller: [{$slug}] " . $this->getFilename());
     }
     return $this->console->info("Module [{$slug}] does not exist.");
 }
 /**
  * Fire.
  *
  * @param Command $console
  * @param $module
  * @param $name
  * @return mixed|void
  */
 public function fire(Command $console, $module, $name)
 {
     $this->console = $console;
     $this->moduleName = Str::studly($module);
     $this->name = $name;
     $this->Name = Str::studly($name);
     if ($this->module->has($this->moduleName)) {
         return $this->makeSeeder();
     }
     $console->error("Module [{$this->moduleName}] does not exists.");
 }
 /**
  * Handle the command.
  *
  * @param Filesystem  $filesystem
  * @param Application $application
  * @return string
  */
 public function handle(Filesystem $filesystem, Application $application)
 {
     $shared = $this->command->option('shared') ? 'shared' : $application->getReference();
     $path = base_path("addons/{$shared}/{$this->vendor}/{$this->slug}-{$this->type}");
     $config = "{$path}/resources/config";
     $views = "{$path}/resources/views";
     $filesystem->makeDirectory($path, 0755, true, true);
     $filesystem->makeDirectory($views, 0755, true, true);
     $filesystem->makeDirectory($config, 0755, true, true);
     return $path;
 }
 /**
  * Handle the command.
  */
 public function handle()
 {
     $this->data->put('ADMIN_USERNAME', $this->command->ask('Enter the desired username for the admin user', env('ADMIN_USERNAME', 'admin')));
     $this->data->put('ADMIN_EMAIL', $this->command->ask('Enter the desired email for the admin user', env('ADMIN_EMAIL')));
     // Validate email.
     if (!filter_var($this->data->get('ADMIN_EMAIL'), FILTER_VALIDATE_EMAIL)) {
         $this->command->error('You must provide a valid email for the admin.');
         exit;
     }
     $this->data->put('ADMIN_PASSWORD', $this->command->ask('Enter the desired password for the admin user', env('ADMIN_PASSWORD')));
 }
 public function renderCommandField(Command $command)
 {
     while (true) {
         $input = $command->choice($this->getConsoleLabel(), $this->get('choices', []), $this->get('default', null));
         $validator = $this->getValidator($input);
         if ($validator->passes()) {
             return $input;
         } else {
             $command->error($validator->errors()->first());
         }
     }
 }
 /**
  * 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);
     }
 }
 /**
  * Fire off the handler.
  *
  * @param  \Illuminate\Console\Command $console
  * @param  string                      $slug
  * @param  string                      $class
  * @return bool
  */
 public function fire(Command $console, $slug, $name, $type)
 {
     $this->console = $console;
     $this->moduleName = studly_case($slug);
     $this->emailName = snake_case($name);
     $this->type = $type;
     if ($this->module->exists($this->moduleName)) {
         $this->makeFile();
         return $this->console->info("Created Module Email View: [{$this->moduleName}] " . $this->getFilename());
     }
     return $this->console->info("Module [{$this->moduleName}] does not exist.");
 }
 public function renderCommandField(Command $command)
 {
     while (true) {
         $input = $command->secret($this->getConsoleLabel());
         $validator = $this->getValidator($input);
         if ($validator->passes()) {
             return $input;
         } else {
             $command->error($validator->errors()->first());
         }
     }
 }
 /**
  * Handle the command.
  *
  * @param  Filesystem  $filesystem
  * @param  Application $application
  * @return string
  */
 public function handle(Filesystem $filesystem, Application $application)
 {
     $destination = $application->getResourcesPath('.env');
     if (!is_dir(dirname($destination))) {
         $filesystem->makeDirectory(dirname($destination), 0777, true, true);
     }
     if (is_file($destination) && !$this->command->option('force')) {
         return $this->command->error("{$destination} already exists.");
     }
     $filesystem->put($destination, '#EXAMPLE=foo');
     $this->command->info("Published {$destination}");
 }
 /**
  * Handle the command.
  *
  * @param  Filesystem  $filesystem
  * @param  Application $application
  * @return string
  */
 public function handle(Filesystem $filesystem, Application $application)
 {
     $destination = $application->getResourcesPath('routes.php');
     if (!is_dir(dirname($destination))) {
         $filesystem->makeDirectory(dirname($destination), 0777, true, true);
     }
     if (is_file($destination) && !$this->command->option('force')) {
         return $this->command->error("{$destination} already exists.");
     }
     $content = "<?php\n\n// Route::get('/', function () {\n//     return view('welcome');\n// });\n";
     $filesystem->put($destination, $content);
     $this->command->info("Published {$destination}");
 }
 /**
  * Handle the command.
  *
  * @param Container $container
  */
 public function handle(Container $container)
 {
     $step = 1;
     $total = $this->installers->count();
     /* @var Installer $installer */
     while ($installer = $this->installers->shift()) {
         if ($this->command) {
             $this->command->info("{$step}/{$total} " . trans($installer->getMessage()));
         }
         $container->call($installer->getTask());
         $step++;
     }
 }
 /**
  * Fire off the handler.
  *
  * @param \Aindong\Pluggables\Console\PluggableMakeMigrationCommand $console
  * @param string                                                    $slug
  *
  * @return string
  */
 public function fire(Command $console, $slug, $table)
 {
     $this->console = $console;
     $this->pluggableName = Str::studly($slug);
     $this->table = strtolower($table);
     $this->migrationName = snake_case($this->table);
     $this->className = studly_case($this->migrationName);
     if ($this->pluggable->exists($this->pluggableName)) {
         $this->makeFile();
         $this->console->info("Created Pluggable Migration: [{$this->pluggableName}] " . $this->getFilename());
         return exec('composer dump-autoload');
     }
     return $this->console->info("Pluggable [{$this->pluggableName}] does not exist.");
 }