dh-proteus 0.2.7 → 0.3.2

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: 84b2b69ce04378ef96f36162ba523acd0926398dd959b8e4d13ecf888803f06c
4
- data.tar.gz: df48273ded3eab015226a485753753ce363e31826b23a63cd17e982cf0717163
3
+ metadata.gz: db62c1bb1740497f53c9a44f65f17caa5f9f87e4ae4a9de7c01feab1b5caec23
4
+ data.tar.gz: fabed14cd58cf6072f7743525c016f8c117cd83b86265e568852ba6f766a41ef
5
5
  SHA512:
6
- metadata.gz: f4f832d9e2c1578e758c961faad4da64dc0fc1c1fba84fa3f299f6984d6be781717b076122390d337dae19081821a868c1249cfa10e2e660757284c15db8f183
7
- data.tar.gz: bdcaaec5de032a8eba1e112ad6b42240a685dcdd39cb96856ed8ad2114c5cd40729c2ab9bc3fb9e779e32d37141ee7c8ede68cb408520e5cd80b5d2e860c1577
6
+ metadata.gz: '0487e5755a6407b3911004992422c40c769c9aef39aeab266bdd09a5a3c4b26d74ba5986159ff05248247595339f23545ee87891cc90ee3261c85c405742d763'
7
+ data.tar.gz: ddbb13d16550d53bafc1256408d588ffef72e691f2f863e55bfcb07c0c59f440172d588c07ea97d9148e93dde35158f369b33e017491e0e5ed0a1426e1264754
@@ -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
@@ -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
- 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.7"
2
+ VERSION = "0.3.2"
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.7
4
+ version: 0.3.2
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-06 00:00:00.000000000 Z
11
+ date: 2020-09-15 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,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubyforge_project:
202
+ rubyforge_project:
203
203
  rubygems_version: 2.7.6.2
204
- signing_key:
204
+ signing_key:
205
205
  specification_version: 4
206
206
  summary: Proteus is a Terraform wrapper application.
207
207
  test_files: []