class EySecrets::InstanceResolver

Public Class Methods

find!(applications, options) click to toggle source
# File lib/ey_secrets/instance_resolver.rb, line 3
def self.find!(applications, options)
  new(applications, options).find!
end

Public Instance Methods

find!() click to toggle source
# File lib/ey_secrets/instance_resolver.rb, line 7
def find!
  find_environment!.instances
end

Private Instance Methods

find_app!() click to toggle source
# File lib/ey_secrets/instance_resolver.rb, line 19
def find_app!
  find_app_by_name(options[:app]) ||
    find_app_by_remotes(options[:remotes]) ||
    raise("Could not find app with name '#{options[:name]}'.")
end
find_app_by_name(name) click to toggle source
# File lib/ey_secrets/instance_resolver.rb, line 25
def find_app_by_name(name)
  applications.find do |application|
    application.name == name
  end
end
find_app_by_remotes(remotes) click to toggle source
# File lib/ey_secrets/instance_resolver.rb, line 31
def find_app_by_remotes(remotes)
  applications.find do |application|
    remotes.include?(application.config_repository_uri)
  end
end
find_environment!() click to toggle source
# File lib/ey_secrets/instance_resolver.rb, line 13
def find_environment!
  find_app!.environments.find do |environment|
    environment.name == options[:environment]
  end || raise("Could not find environment '#{options[:environment]}' for app '#{options[:app]}'.")
end