Sha256: 2118816d30f4c5a0f653e4cf33bb1fb5692fc08e4b5fc883368f3421bf7abada

Contents?: true

Size: 853 Bytes

Versions: 7

Compression:

Stored size: 853 Bytes

Contents

module Shipit
  class UndeployedCommit < DelegateClass(Commit)
    attr_reader :index

    def initialize(commit, index)
      super(commit)
      @index = index
    end

    def deploy_state(bypass_safeties = false)
      state = deployable? ? 'allowed' : status.state
      unless bypass_safeties
        state = 'deploying' if stack.active_task?
        state = 'locked' if stack.locked?
      end
      state
    end

    def redeploy_state(bypass_safeties = false)
      state = 'allowed'
      unless bypass_safeties
        state = 'locked' if stack.locked?
        state = 'deploying' if stack.active_task?
      end
      state
    end

    def deploy_disallowed?
      !deployable? || !stack.deployable?
    end

    def deploy_discouraged?
      stack.maximum_commits_per_deploy && index >= stack.maximum_commits_per_deploy
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shipit-engine-0.16.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.15.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.14.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.13.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.12.1 app/models/shipit/undeployed_commit.rb
shipit-engine-0.12.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.11.0 app/models/shipit/undeployed_commit.rb