public function run() { $laravel = Template::create(['name' => 'Laravel']); Template::create(['name' => 'Wordpress']); Command::create(['name' => 'Down', 'script' => 'php artisan down', 'user' => 'deploy', 'step' => Command::BEFORE_ACTIVATE, 'target_type' => 'template', 'target_id' => $laravel->id]); Command::create(['name' => 'Run Migrations', 'script' => 'php artisan migrate --force', 'user' => 'deploy', 'step' => Command::BEFORE_ACTIVATE, 'target_type' => 'template', 'target_id' => $laravel->id]); Command::create(['name' => 'Up', 'script' => 'php artisan up', 'user' => 'deploy', 'step' => Command::BEFORE_ACTIVATE, 'target_type' => 'template', 'target_id' => $laravel->id]); }
public function run() { $laravel = Project::create(['name' => 'Laravel', 'is_template' => true, 'group_id' => 1]); Project::create(['name' => 'Wordpress', 'is_template' => true, 'group_id' => 1]); Command::create(['name' => 'Down', 'script' => 'php artisan down', 'project_id' => $laravel->id, 'user' => 'deploy', 'step' => Command::BEFORE_ACTIVATE]); Command::create(['name' => 'Run Migrations', 'script' => 'php artisan migrate --force', 'project_id' => $laravel->id, 'user' => 'deploy', 'step' => Command::BEFORE_ACTIVATE]); Command::create(['name' => 'Up', 'script' => 'php artisan up', 'project_id' => $laravel->id, 'user' => 'deploy', 'step' => Command::BEFORE_ACTIVATE]); }
public function run() { DB::table('commands')->delete(); Command::create(['name' => 'Before Clone', 'script' => $this->getScript(), 'project_id' => 1, 'user' => 'deploy', 'step' => Command::BEFORE_CLONE])->servers()->attach([1, 2]); Command::create(['name' => 'After Clone', 'script' => $this->getScript(), 'project_id' => 1, 'user' => 'deploy', 'step' => Command::AFTER_CLONE])->servers()->attach([1, 2]); Command::create(['name' => 'Before Install', 'script' => $this->getScript(), 'project_id' => 1, 'user' => 'deploy', 'step' => Command::BEFORE_INSTALL])->servers()->attach([1, 2]); Command::create(['name' => 'After Install', 'script' => $this->getScript(), 'project_id' => 1, 'user' => 'deploy', 'step' => Command::AFTER_INSTALL])->servers()->attach([1, 2]); Command::create(['name' => 'Before Activate', 'script' => $this->getScript(), 'project_id' => 1, 'user' => 'deploy', 'step' => Command::BEFORE_ACTIVATE])->servers()->attach([1, 2]); Command::create(['name' => 'After Activate', 'script' => $this->getScript(), 'project_id' => 1, 'user' => 'deploy', 'step' => Command::AFTER_ACTIVATE])->servers()->attach([1, 2]); Command::create(['name' => 'Before Purge', 'script' => $this->getScript(), 'project_id' => 1, 'user' => 'deploy', 'step' => Command::BEFORE_PURGE])->servers()->attach([1, 2]); Command::create(['name' => 'After Purge', 'script' => $this->getScript(), 'project_id' => 1, 'user' => 'deploy', 'step' => Command::AFTER_PURGE])->servers()->attach([1, 2]); }
public function run() { DB::table('commands')->delete(); Command::create(['name' => 'Before Create New Release', 'script' => $this->getScript(), 'user' => '', 'step' => Command::BEFORE_CLONE, 'optional' => true, 'target_type' => 'project', 'target_id' => 1])->servers()->attach([1, 2]); Command::create(['name' => 'After Create New Release', 'script' => $this->getScript(), 'user' => '', 'step' => Command::AFTER_CLONE, 'target_type' => 'project', 'target_id' => 1])->servers()->attach([1, 2]); Command::create(['name' => 'Before Install', 'script' => $this->getScript(), 'user' => 'deploy', 'step' => Command::BEFORE_INSTALL, 'target_type' => 'project', 'target_id' => 1])->servers()->attach([1, 2]); Command::create(['name' => 'After Install', 'script' => $this->getScript(), 'user' => 'deploy', 'step' => Command::AFTER_INSTALL, 'target_type' => 'project', 'target_id' => 1])->servers()->attach([1, 2]); Command::create(['name' => 'Before Activate', 'script' => $this->getScript(), 'user' => 'deploy', 'step' => Command::BEFORE_ACTIVATE, 'target_type' => 'project', 'target_id' => 1])->servers()->attach([1, 2]); Command::create(['name' => 'After Activate', 'script' => $this->getScript(), 'user' => 'deploy', 'step' => Command::AFTER_ACTIVATE, 'target_type' => 'project', 'target_id' => 1])->servers()->attach([1, 2]); Command::create(['name' => 'Before Purge', 'script' => $this->getScript(), 'user' => 'deploy', 'step' => Command::BEFORE_PURGE, 'target_type' => 'project', 'target_id' => 1])->servers()->attach([1, 2]); Command::create(['name' => 'After Purge', 'script' => $this->getScript(), 'user' => 'deploy', 'step' => Command::AFTER_PURGE, 'optional' => true, 'target_type' => 'project', 'target_id' => 1])->servers()->attach([1, 2]); }
/** * Execute the command. * * @return void */ public function handle() { $template = Project::findOrFail($this->template_id); foreach ($template->commands as $command) { $data = $command->toArray(); $data['project_id'] = $this->project->id; Command::create($data); } foreach ($template->sharedFiles as $file) { $data = $file->toArray(); $data['project_id'] = $this->project->id; SharedFile::create($data); } foreach ($template->projectFiles as $file) { $data = $file->toArray(); $data['project_id'] = $this->project->id; ProjectFile::create($data); } }
public function run() { DB::table('commands')->delete(); Command::create(['name' => 'Welcome', 'script' => 'echo "Before Clone {{ release }}"', 'project_id' => 1, 'user' => 'deploy', 'step' => Command::BEFORE_CLONE])->servers()->attach([1, 2]); Command::create(['name' => 'Goodbye', 'script' => 'echo "After Purge {{ release }}"', 'project_id' => 1, 'user' => 'deploy', 'step' => Command::AFTER_PURGE])->servers()->attach([1, 2]); }
/** * Query the DB and load the HasMany relationship for commands. * * @return $this */ private function loadCommands() { $collection = Command::join('deploy_steps', 'commands.id', '=', 'deploy_steps.command_id')->where('deploy_steps.deployment_id', $this->getKey())->distinct()->orderBy('step')->orderBy('order')->get(['commands.*', 'deployment_id']); $hasMany = new HasMany(Command::query(), $this, 'deployment_id', 'id'); $hasMany->matchMany([$this], $collection, 'commands'); return $this; }