Sha256: 98d681c61c0aa3a58473d33e201dadc78824cb7316dcd60a8b1409f786044c11

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

class DeploysController < ApplicationController
  include AnsiHelper
  skip_before_filter :verify_authenticity_token


  def create
    @project = Project.find_by_slug(params[:project_id])
    unless @project
      render text: "A project with the slug '#{params[:project_id]}' could not be found", status: 404
      return
    end

    @environment = params.fetch(:environment, "").downcase

    sha = params[:commit] || params[:head_long] || params[:head]
    branch = params[:branch]
    deployer = params[:deployer] || params[:user]
    milliseconds = params[:duration]

    Deploy.create!(
      project: @project,
      environment_name: @environment,
      sha: sha,
      branch: branch,
      deployer: deployer,
      duration: milliseconds,
      completed_at: Time.now)

    head 200
  end


  def show
    @project = Project.find_by_slug! params[:project_id]
    @deploy = @project.deploys.find params[:id]

    if request.format.json?
      render json: { completed: @deploy.completed?, output: ansi_to_html(@deploy.output) }
    end
  end


end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
houston-core-0.6.0 app/controllers/deploys_controller.rb
houston-core-0.5.6 app/controllers/deploys_controller.rb
houston-core-0.5.5 app/controllers/deploys_controller.rb
houston-core-0.5.4 app/controllers/deploys_controller.rb
houston-core-0.5.3 app/controllers/deploys_controller.rb
houston-core-0.5.2 app/controllers/deploys_controller.rb
houston-core-0.5.1 app/controllers/deploys_controller.rb
houston-core-0.5.0 app/controllers/deploys_controller.rb