Sha256: ffe7adf54abcd7c0b12865132497f810a5db87cd986356d974642f1dbfdccc27

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 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,
      successful: params.fetch(:successful, true),
      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

9 entries across 9 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre app/controllers/deploys_controller.rb
houston-core-0.7.0 app/controllers/deploys_controller.rb
houston-core-0.7.0.beta4 app/controllers/deploys_controller.rb
houston-core-0.7.0.beta3 app/controllers/deploys_controller.rb
houston-core-0.7.0.beta2 app/controllers/deploys_controller.rb
houston-core-0.7.0.beta app/controllers/deploys_controller.rb
houston-core-0.6.3 app/controllers/deploys_controller.rb
houston-core-0.6.2 app/controllers/deploys_controller.rb
houston-core-0.6.1 app/controllers/deploys_controller.rb