Sha256: 2312c3c8114836e5efaa417a6f159a6eec63e3965566fa2affe99caba2d143f3

Contents?: true

Size: 985 Bytes

Versions: 10

Compression:

Stored size: 985 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
        if blocked?
          state = 'blocked'
        elsif locked?
          state = 'locked'
        elsif stack.active_task?
          state = 'deploying'
        end
      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

    def blocked?
      return @blocked if defined?(@blocked)
      @blocked = super
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.27.1 app/models/shipit/undeployed_commit.rb
shipit-engine-0.27.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.26.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.25.1 app/models/shipit/undeployed_commit.rb
shipit-engine-0.25.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.24.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.23.1 app/models/shipit/undeployed_commit.rb
shipit-engine-0.23.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.22.0 app/models/shipit/undeployed_commit.rb
shipit-engine-0.21.0 app/models/shipit/undeployed_commit.rb