Sha256: af61a7201cafdff828bf81e9549a4189cb1464fd9de6f050444f88c7f72d9dd4

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 Bytes

Contents

require 'aptible/api'

module Aptible
  module CLI
    module Helpers
      module Operation
        POLL_INTERVAL = 1

        def poll_for_success(operation)
          puts 'Updating configuration and restarting app...'
          wait_for_completion operation
          unless operation.status == 'succeeded'
            fail Thor::Error, 'Operation failed: please check logs'
          end
        end

        def wait_for_completion(operation)
          while %w(queued running).include? operation.status
            sleep 1
            operation.get
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aptible-cli-0.3.2 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.3.1 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.3.0 lib/aptible/cli/helpers/operation.rb
aptible-cli-0.2.0 lib/aptible/cli/helpers/operation.rb