Sha256: 075a045bfc78f28da0498e38068929d171710621a36d58b5289fd39ef87ac690

Contents?: true

Size: 805 Bytes

Versions: 6

Compression:

Stored size: 805 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 locked?
      end
      state
    end

    def redeploy_state(bypass_safeties = false)
      state = 'allowed'
      unless bypass_safeties
        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

6 entries across 6 versions & 1 rubygems

Version Path
shipit-engine-0.20.1 app/models/shipit/undeployed_commit.rb
shipit-engine-0.20.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.19.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.18.1 app/models/shipit/undeployed_commit.rb
shipit-engine-0.18.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.17.0 app/models/shipit/undeployed_commit.rb