domed-city 1.1.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dome/environment.rb +11 -12
- data/lib/dome/terraform.rb +6 -4
- data/lib/dome/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67373aa5975c98fd857ea4859e44f2fe10117fca
|
4
|
+
data.tar.gz: b65e596b729abbf3c8943c033be9fc7839bc8da5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd6c4e608b28914aad3e67048452f3fd059508e419b11d5d413c0a63f8836cb952b7943c407362f69da7efc87baee84d307bd0f7895e6743787703b3ffb9450c
|
7
|
+
data.tar.gz: 2ac30edb586186cf99415900c16eaa869596ddc84aa1a262f22eea234a4603c69ea2f4daac3e5de4a4cac3355c686ca76ba44963ac6aab0af8206a6b5358f2cc
|
data/lib/dome/environment.rb
CHANGED
@@ -2,18 +2,17 @@ module Dome
|
|
2
2
|
class Environment
|
3
3
|
attr_reader :environment, :account
|
4
4
|
|
5
|
-
def initialize
|
6
|
-
directories = Dir.pwd.split('/')
|
5
|
+
def initialize(directories = Dir.pwd.split('/'))
|
7
6
|
@environment = directories[-1]
|
8
7
|
@account = directories[-2]
|
9
8
|
end
|
10
9
|
|
11
10
|
def team
|
12
|
-
@account.
|
11
|
+
@account.split('-').first
|
13
12
|
end
|
14
13
|
|
15
14
|
def accounts
|
16
|
-
%
|
15
|
+
%W(#{team}-dev #{team}-prd)
|
17
16
|
end
|
18
17
|
|
19
18
|
def non_production_environments
|
@@ -38,17 +37,17 @@ module Dome
|
|
38
37
|
ENV['AWS_DEFAULT_REGION'] = aws_credentials[:region]
|
39
38
|
end
|
40
39
|
|
41
|
-
def valid_account?(
|
42
|
-
puts "Account: #{
|
43
|
-
accounts.include?
|
40
|
+
def valid_account?(account_name)
|
41
|
+
puts "Account: #{account_name.colorize(:green)}"
|
42
|
+
accounts.include? account_name
|
44
43
|
end
|
45
44
|
|
46
|
-
def valid_environment?(
|
47
|
-
puts "Environment: #{
|
48
|
-
if
|
49
|
-
non_production_environments.include?
|
45
|
+
def valid_environment?(account_name, environment_name)
|
46
|
+
puts "Environment: #{environment_name.colorize(:green)}"
|
47
|
+
if account_name.split('-')[1] == 'dev'
|
48
|
+
non_production_environments.include? environment_name
|
50
49
|
else
|
51
|
-
production_environments.include?
|
50
|
+
production_environments.include? environment_name
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
data/lib/dome/terraform.rb
CHANGED
@@ -11,10 +11,12 @@ module Dome
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def validate_environment
|
14
|
-
|
15
|
-
|
16
|
-
@environment.invalid_account_message unless @environment.valid_account?
|
17
|
-
@environment.invalid_environment_message unless @environment.valid_environment?(
|
14
|
+
environment = @environment.environment
|
15
|
+
account = @environment.account
|
16
|
+
@environment.invalid_account_message unless @environment.valid_account? account
|
17
|
+
@environment.invalid_environment_message unless @environment.valid_environment?(account, environment)
|
18
|
+
puts "Team: #{@environment.team.colorize(:green)}"
|
19
|
+
puts '----------------------------------------------------------------'
|
18
20
|
@environment.populate_aws_access_keys
|
19
21
|
end
|
20
22
|
|
data/lib/dome/version.rb
CHANGED