module HardCider

Constants

CLIENT_OPTIONS
DEFAULTS
VERSION

Public Class Methods

state(bundle_id:, **options) click to toggle source

@param bundle_id [String] @param options [Hash] @return [String]

# File lib/hard_cider.rb, line 36
def self.state(bundle_id:, **options)
  client = HardCider::Client.new(
    options.slice(*CLIENT_OPTIONS)
  )

  client.latest_build(bundle_id).dig(:attributes, :processing_state)
end
wait(bundle_id:, **options) click to toggle source

@param bundle_id [String] @param options [Hash] @return [Boolean]

# File lib/hard_cider.rb, line 16
def self.wait(bundle_id:, **options)
  options = DEFAULTS.merge(options)
  client = HardCider::Client.new(
    options.slice(*CLIENT_OPTIONS)
  )
  timeout_at = Time.now + options[:timeout]

  loop do
    options[:before_wait]&.call

    return true if client.latest_build_processed?(bundle_id)
    return false if Time.now > timeout_at

    sleep(options[:frequency])
  end
end