Ejemplo n.º 1
0
 /**
  * Generates a new webhook URL.
  *
  * @param  int      $project_id
  * @return Response
  */
 public function refresh($project_id)
 {
     $project = $this->projectRepository->getById($project_id);
     $project->generateHash();
     $project->save();
     return ['url' => route('webhook', $project->hash)];
 }
Ejemplo n.º 2
0
 /**
  * Generates an XML file for CCTray.
  *
  * @param  ProjectRepositoryInterface $projectRepository
  * @return Response
  */
 public function cctray(ProjectRepositoryInterface $projectRepository)
 {
     $projects = $projectRepository->getAll();
     foreach ($projects as $project) {
         $project->latest_deployment = $project->deployments->first();
     }
     return Response::view('cctray', ['projects' => $projects])->header('Content-Type', 'application/xml');
 }
Ejemplo n.º 3
0
 /**
  * Display a listing of before/after commands for the supplied stage.
  *
  * @param  int      $project_id
  * @param  string   $action     Either clone, install, activate or purge
  * @return Response
  */
 public function listing($project_id, $action)
 {
     $types = ['clone' => Command::DO_CLONE, 'install' => Command::DO_INSTALL, 'activate' => Command::DO_ACTIVATE, 'purge' => Command::DO_PURGE];
     $project = $this->projectRepository->getById($project_id);
     $breadcrumb = [['url' => url('projects', $project->id), 'label' => $project->name]];
     if ($project->is_template) {
         $breadcrumb = [['url' => url('admin/templates'), 'label' => Lang::get('templates.label')], ['url' => url('admin/templates', $project->id), 'label' => $project->name]];
     }
     return view('commands.listing', ['breadcrumb' => $breadcrumb, 'title' => Lang::get('commands.' . strtolower($action)), 'project' => $project, 'action' => $types[$action], 'commands' => $this->repository->getForDeployStep($project->id, $types[$action])]);
 }
 /**
  * Adds a deployment for the specified project to the queue.
  *
  * @param  int      $project
  * @return Response
  */
 public function deploy($project_id)
 {
     $project = $this->projectRepository->getById($project_id);
     if ($project->servers->where('deploy_code', true)->count() === 0) {
         return redirect()->url('projects', $project->id);
     }
     $data = ['reason' => Input::get('reason'), 'project_id' => $project->id, 'branch' => $project->branch, 'optional' => []];
     if (Input::has('source') && Input::has('source_' . Input::get('source'))) {
         $data['branch'] = Input::get('source_' . Input::get('source'));
     }
     if (Input::has('optional')) {
         $data['optional'] = Input::get('optional');
     }
     $deployment = $this->deploymentRepository->create($data);
     return redirect()->route('deployment', ['id' => $deployment->id]);
 }