class EY::Serverside::CLI::ServerHashExtractor

ServerHashExtractor, given an options hash and a deploy configuration, generates an array of hashes that can be used to instantiate Server objects

Attributes

config[R]
options[R]

Public Class Methods

hashes(options, config) click to toggle source
# File lib/engineyard-serverside/cli/server_hash_extractor.rb, line 9
def self.hashes(options, config)
  new(options, config).hashes
end
new(options, config) click to toggle source
# File lib/engineyard-serverside/cli/server_hash_extractor.rb, line 15
def initialize(options, config)
  @options = options
  @config = config
end

Public Instance Methods

hashes() click to toggle source
# File lib/engineyard-serverside/cli/server_hash_extractor.rb, line 20
def hashes
  return [] unless instances

  instances.collect {|hostname|
    {
      :hostname => hostname,
      :roles => instance_roles[hostname].to_s.split(','),
      :name => instance_names[hostname],
      :user => config.user
    }
  }
end

Private Instance Methods

instance_names() click to toggle source
# File lib/engineyard-serverside/cli/server_hash_extractor.rb, line 42
def instance_names
  options[:instance_names]
end
instance_roles() click to toggle source
# File lib/engineyard-serverside/cli/server_hash_extractor.rb, line 38
def instance_roles
  options[:instance_roles]
end
instances() click to toggle source
# File lib/engineyard-serverside/cli/server_hash_extractor.rb, line 34
def instances
  options[:instances]
end