terraspace 1.0.3 → 1.0.4
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/terraspace/compiler/select.rb +66 -10
- data/lib/terraspace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f265061c3973d32dcbea50e12b291ee22041dc2e5bc2cf2521907dd4d74b0703
|
4
|
+
data.tar.gz: 97e6064b47fe37f11660fe05512e1750b23f96cd7bc7ea1bef0aa512884922de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb0ccae4efe36fae839a755561e9b6829b998c4ec653f7a9a24c8a67a6e9da9ff9e5b81ad1134018edceed75b5859e12cce280819e2792a203da7a65f4997087
|
7
|
+
data.tar.gz: '0269f857a01274f4c9b64b051c724fff030582e2d62b9222da04ae0828e7770160645a4dee01a0a0c791921197d08ce87f420e5fa24678e961e76fb267c9377b'
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.0.4] - 2022-01-21
|
7
|
+
- [#193](https://github.com/boltops-tools/terraspace/pull/193) improve all include_stacks and exclude_stacks option
|
8
|
+
|
6
9
|
## [1.0.3] - 2022-01-20
|
7
10
|
- [#192](https://github.com/boltops-tools/terraspace/pull/192) run super-early boot hooks before dotenv load
|
8
11
|
|
@@ -1,28 +1,84 @@
|
|
1
1
|
module Terraspace::Compiler
|
2
2
|
class Select
|
3
|
+
include Terraspace::Util::Logging
|
4
|
+
|
3
5
|
def initialize(path)
|
4
6
|
@path = path
|
5
7
|
@stack_name = extract_stack_name(path)
|
6
8
|
end
|
7
9
|
|
8
10
|
def selected?
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
if all.include_stacks.nil?
|
17
|
-
!ignore_stacks.include?(@stack_name)
|
11
|
+
ignore_stacks_deprecation_warning
|
12
|
+
if include_stacks.nil? && exclude_stacks.nil?
|
13
|
+
true
|
14
|
+
elsif include_stacks.nil?
|
15
|
+
!exclude_stacks.include?(@stack_name)
|
16
|
+
elsif exclude_stacks.nil?
|
17
|
+
include_stacks.include?(@stack_name)
|
18
18
|
else
|
19
|
-
stacks = include_stacks -
|
19
|
+
stacks = include_stacks - exclude_stacks
|
20
20
|
stacks.include?(@stack_name)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def include_stacks
|
25
|
+
include_option(:include_stacks)
|
26
|
+
end
|
27
|
+
|
28
|
+
def exclude_stacks
|
29
|
+
include_option(:exclude_stacks)
|
30
|
+
end
|
31
|
+
|
32
|
+
def include_option(name)
|
33
|
+
option = all[name] # IE: include_stacks or exclude_stacks
|
34
|
+
option ||= all[:ignore_stacks] if name == :exclude_stacks
|
35
|
+
case option
|
36
|
+
when nil
|
37
|
+
return nil
|
38
|
+
when Array
|
39
|
+
return option
|
40
|
+
when -> (c) { c.respond_to?(:public_instance_methods) && c.public_instance_methods.include?(:call) }
|
41
|
+
object= option.new
|
42
|
+
when -> (c) { c.respond_to?(:call) }
|
43
|
+
object = option
|
44
|
+
else
|
45
|
+
raise "Invalid option for config.all.#{name}"
|
46
|
+
end
|
47
|
+
|
48
|
+
if object
|
49
|
+
result = object.call(@stack_name)
|
50
|
+
unless result.is_a?(Array) || result.is_a?(NilClass)
|
51
|
+
message = "ERROR: The config.all.#{name} needs to return an Array or nil"
|
52
|
+
logger.info message.color(:yellow)
|
53
|
+
logger.info <<~EOL
|
54
|
+
The config.all.#{name} when assigned a class, object, or proc must implement
|
55
|
+
the call method and return an Array or nil.
|
56
|
+
The current return value is a #{result.class}
|
57
|
+
EOL
|
58
|
+
raise message
|
59
|
+
end
|
60
|
+
end
|
61
|
+
result
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
def all
|
66
|
+
Terraspace.config.all
|
67
|
+
end
|
68
|
+
|
24
69
|
def extract_stack_name(path)
|
25
70
|
path.sub(%r{.*(app|vendor)/stacks/}, '')
|
26
71
|
end
|
72
|
+
|
73
|
+
@@ignore_stacks_deprecation_warning = nil
|
74
|
+
def ignore_stacks_deprecation_warning
|
75
|
+
return unless all.ignore_stacks
|
76
|
+
return if @@ignore_stacks_deprecation_warning
|
77
|
+
puts <<~EOL.color(:yellow)
|
78
|
+
DEPRECATED: config.all.ignore_stacks
|
79
|
+
Instead use: config.all.exclude_stacks
|
80
|
+
EOL
|
81
|
+
@@ignore_stacks_deprecation_warning = true
|
82
|
+
end
|
27
83
|
end
|
28
84
|
end
|
data/lib/terraspace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|