15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/configuration.rb', line 15
def self.create_configuration
settings = {}
continue = true
puts "Let's set things up"
while continue
puts 'Stack Name (can be anything):'
name = gets.chomp
puts 'Region (e.g. eu-central-1):'
region = gets.chomp
puts 'IAM User key:'
iam_user = gets.chomp
puts 'IAM User secret:'
iam_secret = gets.chomp
puts 'OpsWorks Stack ID:'
stack_id = gets.chomp
settings[name] = { 'region' => region,
'iam_user' => iam_user,
'iam_secret' => iam_secret,
'stack_id' => stack_id }
puts 'Insert other Stack? (Y/n)'
continue = gets.chomp != 'n'
end
File.write(File.join(ENV['HOME'], '.opswatch.yml'), settings.to_yaml)
settings
end
|