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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7efabd99d90f998c7b6d2ad165fbd90322eea5f
4
- data.tar.gz: 09504559d427ebb0a2a79e0477778a0dfdff1878
3
+ metadata.gz: 67373aa5975c98fd857ea4859e44f2fe10117fca
4
+ data.tar.gz: b65e596b729abbf3c8943c033be9fc7839bc8da5
5
5
  SHA512:
6
- metadata.gz: f9634171a656f5fc75030a519b9b8c5ddedd2453cb002b596ea8c527e533ce0e23cc09753bd2159df7c304ac536f8632bb84500d1a4cdd688ec4c9570f861452
7
- data.tar.gz: 8e45508db4ea0260baab44e97eec4958e4d96bc855b93057948d22cce8952337883f2d166dfbf39e131c6b2f4f2caab93e0b757e54346be04f4ea721191edb8a
6
+ metadata.gz: bd6c4e608b28914aad3e67048452f3fd059508e419b11d5d413c0a63f8836cb952b7943c407362f69da7efc87baee84d307bd0f7895e6743787703b3ffb9450c
7
+ data.tar.gz: 2ac30edb586186cf99415900c16eaa869596ddc84aa1a262f22eea234a4603c69ea2f4daac3e5de4a4cac3355c686ca76ba44963ac6aab0af8206a6b5358f2cc
@@ -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.match(/(\w+)-\w+\z/)[1]
11
+ @account.split('-').first
13
12
  end
14
13
 
15
14
  def accounts
16
- %w(deirdre-dev deirdre-prd)
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?(account)
42
- puts "Account: #{account.colorize(:green)}"
43
- accounts.include? account
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?(account, environment)
47
- puts "Environment: #{environment.colorize(:green)}"
48
- if account[-4..-1] == '-dev'
49
- non_production_environments.include? environment
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? environment
50
+ production_environments.include? environment_name
52
51
  end
53
52
  end
54
53
 
@@ -11,10 +11,12 @@ module Dome
11
11
  end
12
12
 
13
13
  def validate_environment
14
- environment_name = @environment.environment
15
- account_name = @environment.account
16
- @environment.invalid_account_message unless @environment.valid_account? account_name
17
- @environment.invalid_environment_message unless @environment.valid_environment?(account_name, environment_name)
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
 
@@ -1,3 +1,3 @@
1
1
  module Dome
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domed-city
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Snape