dh-proteus 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 263b0afd288fa51a29ea54621b191dd8cb86a4337456226694bf8c8047dd2534
4
- data.tar.gz: 202ba99d158dabcfb19db4bc583f9a7fe4657697f38f0f0923b240232f50524b
3
+ metadata.gz: 8fb5e638db16f99a0788b308916d6788599591155e71f0b3112ba14efa899c03
4
+ data.tar.gz: 5b76029b2b37a7db6c28ffef458514f84eee2a3a08f05376d7f5e199de2ce96d
5
5
  SHA512:
6
- metadata.gz: '09320cdfeb939b664384449b04496fd649886df20adab89c947b1c89b82cc94b91d2f9afd8c4749de3c9c93202b9aa71bb403e3f0f2e36d7bada77d41fb9c8ff'
7
- data.tar.gz: c2c3c0d51070d4db497cf14e1f3a1b00d8df9efc3e555c2f1feba7776e088436b066eca4f650615d02b44102a4a080b457610ba40814153b3aba45dae21b1cd9
6
+ metadata.gz: 27daef8b98d42b544611c2f411cd7b454b4e4706b4acbf263e0cd716c6d46ce37927ec86aa61acba8aa8923dc6e5eea9d382ddc812737e49d393c4c212faa7de
7
+ data.tar.gz: aca86a828d979fff964167e593a74d1e0eb416feeb10a8391b1c4fe6e340cd57d4c32fc3e7f0a6a50eb8e352ff9606599dad228440b3770215b94fc969ed159f
@@ -14,8 +14,29 @@ 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
+ selected_contexts = status.map { |s| s.scan(/contexts\/([a-zA-Z0-9_]+)\/((.+)\/)?/).flatten.first }.reject { |s| s.nil? }.uniq!
31
+
18
32
  self.class.contexts.each do |context|
33
+ unless run_full_validation
34
+ if !selected_contexts.include?(context.name)
35
+ say "Skipping context #{context.name}.", :green
36
+ next
37
+ end
38
+ end
39
+
19
40
  context.environments.each do |environment|
20
41
  module_manager = Proteus::Modules::Manager.new(context: context.name, environment: environment)
21
42
  module_manager.render_modules
@@ -1,5 +1,5 @@
1
1
  module Proteus
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Albrecht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-02 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