Class: Claws::Configuration
- Inherits:
-
Object
- Object
- Claws::Configuration
- Defined in:
- lib/claws/configuration.rb
Instance Attribute Summary collapse
-
#aws ⇒ Object
Returns the value of attribute aws.
-
#capistrano ⇒ Object
Returns the value of attribute capistrano.
-
#ec2 ⇒ Object
Returns the value of attribute ec2.
-
#path ⇒ Object
Returns the value of attribute path.
-
#ssh ⇒ Object
Returns the value of attribute ssh.
Instance Method Summary collapse
-
#initialize(use_path = nil) ⇒ Configuration
constructor
A new instance of Configuration.
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
#aws ⇒ Object
Returns the value of attribute aws.
8 9 10 |
# File 'lib/claws/configuration.rb', line 8 def aws @aws end |
#capistrano ⇒ Object
Returns the value of attribute capistrano.
8 9 10 |
# File 'lib/claws/configuration.rb', line 8 def capistrano @capistrano end |
#ec2 ⇒ Object
Returns the value of attribute ec2.
8 9 10 |
# File 'lib/claws/configuration.rb', line 8 def ec2 @ec2 end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/claws/configuration.rb', line 8 def path @path end |
#ssh ⇒ Object
Returns the value of attribute ssh.
8 9 10 |
# File 'lib/claws/configuration.rb', line 8 def ssh @ssh end |