Class: StartingConfiguration

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

Class Method Summary collapse

Class Method Details

.configObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/configuration.rb', line 3

def self.config

  # Setting the Config file Location
  config_file = "#{Dir.home}/.aws-config.yml"

  unless File.file?(config_file)
    begin
      entry = Hash.new

      say("Configuration Details:")

      entry[:access_key_id] = ask("Access Key:  ")
      entry[:secret_access_key] = ask("Secret Key:  ")
      entry[:path_to_keypairs] = ask("Path to keypairs(/path/to/keypairs/):  ")

    end

    File.open("#{config_file}", "w") { |file| YAML.dump(entry, file) }

  end

  AWS.config(YAML.load(File.read(config_file)))

end

.path_to_keypairObject



28
29
30
31
32
33
# File 'lib/configuration.rb', line 28

def self.path_to_keypair
  
  hash = YAML.load(File.read("#{Dir.home}/.aws-config.yml"))
  @path_to_keypairs = hash[:path_to_keypairs]
  
end