dh-proteus 0.2.8 → 0.3.3

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
  SHA256:
3
- metadata.gz: dfb402228b57b8c5a7c59744b70652d523b2181436f6a58ac194d425ea8b4090
4
- data.tar.gz: eb9a26f321db8b69899602af91db1d0912e5f29a9434ac4f772b3fead4dfea91
3
+ metadata.gz: 6a2fc0b898fae5d35182d34a30ee925d3b1f017514b9a5ea5bf1ef7a0f61a099
4
+ data.tar.gz: 5c2c564881da7463672c297ca56b95329f784266d8f7018850f74bc2d5936e59
5
5
  SHA512:
6
- metadata.gz: 9b597499fccf25bf0857c55e8ab204d0dfcf78855e83ed9a2989dfd33ebb5768033816ce0aaee96a8a4cf02b470eda8fc8f219e1bbefe3cc8bd45c6c04360e0c
7
- data.tar.gz: bb0035be1671fcfc50d2a1045aa5fef0673852e10ee3ebf3dc953b05d1afdaa3f80e81b8db3ff9b7a7df2dd7aa98385671f56efb3aa5973a7d5e0b6e83996f5f
6
+ metadata.gz: acf91c5fa344141e5b704a72180e9e1ef375df52ce8122819ff7c9e36e465b99d0fb485c9a3d3cab86fcbbf72455a5b0989f4bce700127c5d59e695859b27cc7
7
+ data.tar.gz: 294544ff72bc27ac86c7e4cf925d9a00a0579e16e1d37f1048482003fb28c6809b92dbabac4dea087ccfafc816b35b85ba80d27ac21ff76a56226a1617dc5bae
data/Gemfile.lock CHANGED
@@ -1,11 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dh-proteus (0.1.4)
4
+ dh-proteus (0.3.3)
5
5
  activesupport (~> 5.1.1)
6
- aws-sdk-elasticsearchservice (~> 1.4.0)
7
- aws-sdk-rds (~> 1.11.0)
8
- aws-sdk-route53 (~> 1.7.0)
9
6
  erubis (~> 2.7.0)
10
7
  thor (~> 0.20.0)
11
8
 
@@ -17,33 +14,14 @@ GEM
17
14
  i18n (>= 0.7, < 2)
18
15
  minitest (~> 5.1)
19
16
  tzinfo (~> 1.1)
20
- aws-eventstream (1.0.3)
21
- aws-partitions (1.189.0)
22
- aws-sdk-core (3.59.0)
23
- aws-eventstream (~> 1.0, >= 1.0.2)
24
- aws-partitions (~> 1.0)
25
- aws-sigv4 (~> 1.1)
26
- jmespath (~> 1.0)
27
- aws-sdk-elasticsearchservice (1.4.0)
28
- aws-sdk-core (~> 3)
29
- aws-sigv4 (~> 1.0)
30
- aws-sdk-rds (1.11.0)
31
- aws-sdk-core (~> 3)
32
- aws-sigv4 (~> 1.0)
33
- aws-sdk-route53 (1.7.0)
34
- aws-sdk-core (~> 3)
35
- aws-sigv4 (~> 1.0)
36
- aws-sigv4 (1.1.0)
37
- aws-eventstream (~> 1.0, >= 1.0.2)
38
17
  coderay (1.1.1)
39
- concurrent-ruby (1.1.5)
18
+ concurrent-ruby (1.1.8)
40
19
  diff-lcs (1.3)
41
20
  erubis (2.7.0)
42
- i18n (1.6.0)
21
+ i18n (1.8.8)
43
22
  concurrent-ruby (~> 1.0)
44
- jmespath (1.4.0)
45
23
  method_source (0.8.2)
46
- minitest (5.11.3)
24
+ minitest (5.14.3)
47
25
  pry (0.10.4)
48
26
  coderay (~> 1.1.0)
49
27
  method_source (~> 0.8.1)
@@ -65,7 +43,7 @@ GEM
65
43
  slop (3.6.0)
66
44
  thor (0.20.3)
67
45
  thread_safe (0.3.6)
68
- tzinfo (1.2.5)
46
+ tzinfo (1.2.9)
69
47
  thread_safe (~> 0.1)
70
48
 
71
49
  PLATFORMS
@@ -79,4 +57,4 @@ DEPENDENCIES
79
57
  rspec (~> 3.0)
80
58
 
81
59
  BUNDLED WITH
82
- 2.0.1
60
+ 2.2.3
@@ -13,10 +13,12 @@ module Proteus
13
13
  @context = context
14
14
  @environment = environment
15
15
 
16
- @config[:providers].select {|p| p[:name] == 'aws' }.first[:environments].each do |env|
17
- env[:match].each do |m|
18
- if @environment == m
19
- @provider_environment = env
16
+ @config[:providers].each do |provider|
17
+ provider[:environments].each do |env|
18
+ env[:match].each do |m|
19
+ if @environment == m
20
+ @provider_environment = env
21
+ end
20
22
  end
21
23
  end
22
24
  end
@@ -7,10 +7,7 @@ module Proteus
7
7
  desc 'apply', 'Applies the current terraform code'
8
8
  long_desc <<-LONGDESC
9
9
  Applies the current terraform code
10
-
11
- With --limit option, Terraform will only apply changes for the the specified resources
12
10
  LONGDESC
13
- option :limit, type: :array, aliases: "-l", required: false, default: nil
14
11
  def apply
15
12
  init(verbose: parent_options[:verbose])
16
13
 
@@ -30,7 +27,6 @@ module Proteus
30
27
  terraform apply \
31
28
  -input=true \
32
29
  -refresh=true \
33
- #{limit(options[:limit])} \
34
30
  #{plan_file(context, environment)}
35
31
  APPLY_COMMAND
36
32
 
@@ -14,8 +14,33 @@ module Proteus
14
14
  long_desc <<-LONGDESC
15
15
  Renders templates for all environments, reporting validation errors.
16
16
  LONGDESC
17
+ option :selective, type: :boolean, default: false
17
18
  def validate
19
+ # case 1: changes in root => run full validation
20
+ # case 2: no changes in root => run contexts only
21
+ status = `git --no-pager diff origin/master --stat --name-only`.split("\n")
22
+
23
+ run_full_validation = if status.map { |l| !l.include?('/') }.any? || !options[:selective]
24
+ say "Found changes in the root of the repository or --selective is not set. Running full validation.", :green
25
+ true
26
+ else
27
+ say "Running selective validation.", :green
28
+ false
29
+ end
30
+
31
+ selected_contexts = status.collect do |s|
32
+ parts = s.split("/")
33
+ parts.size > 1 ? parts[1] : nil
34
+ end.reject { |s| s.nil? }.uniq
35
+
18
36
  self.class.contexts.each do |context|
37
+ unless run_full_validation
38
+ if !selected_contexts.include?(context.name)
39
+ say "Skipping context #{context.name}.", :green
40
+ next
41
+ end
42
+ end
43
+
19
44
  context.environments.each do |environment|
20
45
  module_manager = Proteus::Modules::Manager.new(context: context.name, environment: environment)
21
46
  module_manager.render_modules
@@ -33,7 +33,15 @@ module Proteus
33
33
  end
34
34
 
35
35
  def current_user
36
- ENV['CURRENT_USER_NAME'] ? ENV['CURRENT_USER_NAME'] : Etc.getpwnam(Etc.getlogin).gecos
36
+ user = ENV['CURRENT_USER_NAME'] ? ENV['CURRENT_USER_NAME'] : Etc.getpwnam(Etc.getlogin).gecos
37
+ if user.empty?
38
+ puts "Please set your git username properly:"
39
+ puts "git config --global user.name \"FIRST_NAME LAST_NAME\""
40
+ puts "git config --global user.email \"YOUR_NAME@example.com\""
41
+ exit 1
42
+ else
43
+ user
44
+ end
37
45
  end
38
46
 
39
47
  def slack_webhook
@@ -1,5 +1,5 @@
1
1
  module Proteus
2
- VERSION = "0.2.8"
2
+ VERSION = "0.3.3"
3
3
  end
4
4
 
5
5
  if $0 == __FILE__
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dh-proteus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Albrecht
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-08 00:00:00.000000000 Z
11
+ date: 2021-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.7.0
111
- description:
111
+ description:
112
112
  email:
113
113
  - simon.albrecht@deliveryhero.com
114
114
  executables:
@@ -184,7 +184,7 @@ metadata:
184
184
  homepage_uri: https://github.com/deliveryhero/proteus
185
185
  source_code_uri: https://github.com/deliveryhero/proteus
186
186
  changelog_uri: https://github.com/deliveryhero/proteus/CHANGELOG
187
- post_install_message:
187
+ post_install_message:
188
188
  rdoc_options: []
189
189
  require_paths:
190
190
  - lib
@@ -199,9 +199,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubyforge_project:
203
- rubygems_version: 2.7.6.2
204
- signing_key:
202
+ rubygems_version: 3.2.3
203
+ signing_key:
205
204
  specification_version: 4
206
205
  summary: Proteus is a Terraform wrapper application.
207
206
  test_files: []