Class: EY::Serverside::CLI::ServerHashExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard-serverside/cli/server_hash_extractor.rb

Overview

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, config) ⇒ ServerHashExtractor

Returns a new instance of ServerHashExtractor.


15
16
17
18
# File 'lib/engineyard-serverside/cli/server_hash_extractor.rb', line 15

def initialize(options, config)
  @options = options
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config


13
14
15
# File 'lib/engineyard-serverside/cli/server_hash_extractor.rb', line 13

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options


13
14
15
# File 'lib/engineyard-serverside/cli/server_hash_extractor.rb', line 13

def options
  @options
end

Class Method Details

.hashes(options, config) ⇒ Object


9
10
11
# File 'lib/engineyard-serverside/cli/server_hash_extractor.rb', line 9

def self.hashes(options, config)
  new(options, config).hashes
end

Instance Method Details

#hashesObject


20
21
22
23
24
25
26
27
28
29
30
31
# 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