Sha256: 624c32023222693887c02b0611ad9f8fa3d260c88f77df1eaa4086b463b2dbf9

Contents?: true

Size: 992 Bytes

Versions: 24

Compression:

Stored size: 992 Bytes

Contents

module SimpleDeploy
  class Status

    def initialize(args)
      @name = args[:name]
      @config = SimpleDeploy.config
      @logger = SimpleDeploy.logger
    end

    def complete?
      /_COMPLETE$/ === current
    end

    def failed?
      /_FAILED$/ === current
    end

    def cleanup_in_progress?
      /_CLEANUP_IN_PROGRESS$/ === current
    end

    def in_progress?
      /_IN_PROGRESS$/ === current && !cleanup_in_progress?
    end

    def create_failed?
      'CREATE_FAILED' == current
    end

    def stable?
      (complete? || failed?) && (! create_failed?)
    end

    def wait_for_stable(count=25)
      1.upto(count).each do |c|
        break if stable?
        @logger.info ("#{@name} not stable (#{current}).  Sleeping #{c * c} second(s).")
        Kernel.sleep (c * c)
      end
      stable?
    end

    private

    def current
      stack_reader.status
    end

    def stack_reader
      @stack_reader ||= StackReader.new :name   => @name
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
simple_deploy-0.10.2 lib/simple_deploy/stack/status.rb
simple_deploy-0.10.1 lib/simple_deploy/stack/status.rb
simple_deploy-0.10.0 lib/simple_deploy/stack/status.rb
simple_deploy-0.10.0.beta.3 lib/simple_deploy/stack/status.rb
simple_deploy-0.10.0.beta.2 lib/simple_deploy/stack/status.rb
simple_deploy-0.10.0.beta.1 lib/simple_deploy/stack/status.rb
simple_deploy-0.9.2 lib/simple_deploy/stack/status.rb
simple_deploy-0.9.1 lib/simple_deploy/stack/status.rb
simple_deploy-0.9.0 lib/simple_deploy/stack/status.rb
simple_deploy-0.8.2 lib/simple_deploy/stack/status.rb
simple_deploy-0.8.2.beta1 lib/simple_deploy/stack/status.rb
simple_deploy-0.8.1.beta1 lib/simple_deploy/stack/status.rb
simple_deploy-0.8.0 lib/simple_deploy/stack/status.rb
simple_deploy-0.7.8 lib/simple_deploy/stack/status.rb
simple_deploy-0.7.7 lib/simple_deploy/stack/status.rb
simple_deploy-0.7.7.beta.1 lib/simple_deploy/stack/status.rb
simple_deploy-0.7.6 lib/simple_deploy/stack/status.rb
simple_deploy-0.7.6.beta.6 lib/simple_deploy/stack/status.rb
simple_deploy-0.7.6.beta.5 lib/simple_deploy/stack/status.rb
simple_deploy-0.7.6.beta.3 lib/simple_deploy/stack/status.rb