Class: Claws::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/claws/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(use_path = nil) ⇒ Configuration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/claws/configuration.rb', line 10

def initialize(use_path = nil)
  self.path = use_path || File.join(ENV['HOME'], '.claws.yml')

  begin
    yaml = YAML.load_file(path)
  rescue Exception
    raise ConfigurationError, "Unable to locate configuration file: #{self.path}"
  end

  self.capistrano = OpenStruct.new( yaml['capistrano'] )
  self.ssh = OpenStruct.new( yaml['ssh'] )
  self.aws = yaml['aws']
  self.ec2 = OpenStruct.new(
    {
      :fields => yaml['ec2']['fields'],
      :regions => yaml['ec2']['regions'],
    }
  )
end

Instance Attribute Details

#awsObject

Returns the value of attribute aws.



8
9
10
# File 'lib/claws/configuration.rb', line 8

def aws
  @aws
end

#capistranoObject

Returns the value of attribute capistrano.



8
9
10
# File 'lib/claws/configuration.rb', line 8

def capistrano
  @capistrano
end

#ec2Object

Returns the value of attribute ec2.



8
9
10
# File 'lib/claws/configuration.rb', line 8

def ec2
  @ec2
end

#pathObject

Returns the value of attribute path.



8
9
10
# File 'lib/claws/configuration.rb', line 8

def path
  @path
end

#sshObject

Returns the value of attribute ssh.



8
9
10
# File 'lib/claws/configuration.rb', line 8

def ssh
  @ssh
end