コード例 #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)];
 }
コード例 #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');
 }
コード例 #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)), 'subtitle' => $project->name, 'project' => $project, 'action' => $types[$action], 'commands' => $this->repository->getForDeployStep($project->id, $types[$action])]);
 }
コード例 #4
0
 /**
  * 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]);
 }
コード例 #5
0
 /**
  * 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 allow other branches is set, check for post data
     if ($project->allow_other_branch) {
         if (Input::has('source') && Input::has('source_' . Input::get('source'))) {
             $data['branch'] = Input::get('source_' . Input::get('source'));
         }
     }
     // Get the optional commands and typecast to integers
     if (Input::has('optional') && is_array(Input::get('optional'))) {
         $data['optional'] = array_filter(array_map(function ($value) {
             return filter_var($value, FILTER_VALIDATE_INT);
         }, Input::get('optional')));
     }
     $deployment = $this->deploymentRepository->create($data);
     return redirect()->route('deployment', ['id' => $deployment->id]);
 }