ufo 6.2.2 → 6.2.3
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/ufo/config/parse.rb +39 -0
- data/lib/ufo/config.rb +19 -27
- data/lib/ufo/layering/layer.rb +1 -1
- data/lib/ufo/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd574a73d9028bd0627e5c7d74b5bb516ee62aa1ae2a0d3c85f01470ef39284
|
4
|
+
data.tar.gz: 96fcdff5429e785572cff2f4face5cc2100a1ce95a912adf6bfc275343471518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11fccb6c4b62fe986f77a12e2aeb2d67ec7d2874ca1a9eed9afab32317a94e5235340896bd7fc590abf665b06bccfe4961fda78a0b77b2749cfbaffb4361dca3
|
7
|
+
data.tar.gz: 32e9654b2700f3445a2383a84e323458bc1b81368901c3d83dac7c4d809fa7c5ef5d6bf5405dbd858b95f0ff34f8939f4660ee35118a11b5fa8976868c6f9b93
|
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 *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [6.2.3] - 2022-03-20
|
7
|
+
- [#157](https://github.com/tongueroo/ufo/pull/157) layering.show_for_commands option
|
8
|
+
|
6
9
|
## [6.2.2] - 2022-03-20
|
7
10
|
- [#155](https://github.com/tongueroo/ufo/pull/155) layering.show option ability to show layers
|
8
11
|
- [#156](https://github.com/tongueroo/ufo/pull/156) extra layering support
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Some limitations:
|
2
|
+
#
|
3
|
+
# * Only parsing one file: .ufo/config.rb
|
4
|
+
# * If user is using Ruby code that cannot be parse will fallback to default
|
5
|
+
#
|
6
|
+
# Think it's worth it so user only has to configure
|
7
|
+
#
|
8
|
+
# config.layering.show = true
|
9
|
+
#
|
10
|
+
class Ufo::Config
|
11
|
+
class Parse
|
12
|
+
def for(config, type: :boolean)
|
13
|
+
lines = IO.readlines("#{Ufo.root}/.ufo/config.rb")
|
14
|
+
config_line = lines.find do |l|
|
15
|
+
# IE: Regexp.new("config\.layering.show.*=")
|
16
|
+
regexp = Regexp.new("config\.#{config}.*=")
|
17
|
+
l =~ regexp && l !~ /^\s+#/
|
18
|
+
end
|
19
|
+
return false unless config_line # default is false
|
20
|
+
config_value = config_line.gsub(/.*=/,'').strip.gsub(/["']/,'')
|
21
|
+
case type
|
22
|
+
when :boolean
|
23
|
+
config_value != "false" && config_value != "nil"
|
24
|
+
when :array
|
25
|
+
eval(config_value) # IE: '["a"]' => ["a"]
|
26
|
+
else
|
27
|
+
raise "Type #{type.inspect} not supported"
|
28
|
+
end
|
29
|
+
rescue Exception => e
|
30
|
+
# if ENV['UFO_DEBUG']
|
31
|
+
puts "#{e.class} #{e.message}".color(:yellow)
|
32
|
+
puts "WARN: Unable to parse for config.layering.show".color(:yellow)
|
33
|
+
puts "Using default: config.layering.show = false"
|
34
|
+
# end
|
35
|
+
false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
data/lib/ufo/config.rb
CHANGED
@@ -86,7 +86,8 @@ module Ufo
|
|
86
86
|
config.exec.enabled = true # EcsService EnableExecuteCommand
|
87
87
|
|
88
88
|
config.layering = ActiveSupport::OrderedOptions.new
|
89
|
-
config.layering.show =
|
89
|
+
config.layering.show = parsed_layering_show
|
90
|
+
config.layering.show_for_commands = parsed_layering_show_for
|
90
91
|
|
91
92
|
config.log = ActiveSupport::OrderedOptions.new
|
92
93
|
config.log.root = Ufo.log_root
|
@@ -165,7 +166,7 @@ module Ufo
|
|
165
166
|
end
|
166
167
|
# load_project_config gets called so early that logger is not yet configured.
|
167
168
|
# Cannot use Ufo.config yet and cannot use logger which relies on Ufo.config
|
168
|
-
# Use puts and use
|
169
|
+
# Use puts and use parsed_layering_show
|
169
170
|
show = show_layers?
|
170
171
|
puts "Config Layers" if show
|
171
172
|
layers.each do |layer|
|
@@ -180,34 +181,25 @@ module Ufo
|
|
180
181
|
end
|
181
182
|
|
182
183
|
def show_layers?
|
183
|
-
|
184
|
+
show_for = parsed_layering_show_for
|
185
|
+
command = ARGV[0]
|
186
|
+
parsed_layering_show && show_for.include?(command)
|
184
187
|
end
|
185
|
-
private :show_layers?
|
186
188
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
return false unless config_line # default is false
|
200
|
-
config_value = config_line.gsub(/.*=/,'').strip.gsub(/["']/,'')
|
201
|
-
config_value != "false" && config_value != "nil"
|
202
|
-
rescue Exception => e
|
203
|
-
if ENV['UFO_DEBUG']
|
204
|
-
puts "#{e.class} #{e.message}".color(:yellow)
|
205
|
-
puts "WARN: Unable to parse for config.layering.show".color(:yellow)
|
206
|
-
puts "Using default: config.layering.show = false"
|
207
|
-
end
|
208
|
-
false
|
189
|
+
def parsed_layering_show_for
|
190
|
+
parse.for("layering.show_for_commands", type: :array) || %w[build ship] # IE: ps exec logs are not shown
|
191
|
+
end
|
192
|
+
memoize :parsed_layering_show_for
|
193
|
+
|
194
|
+
def parsed_layering_show
|
195
|
+
ENV['UFO_LAYERS'] || parse.for("layering.show", type: :boolean)
|
196
|
+
end
|
197
|
+
private :parsed_layering_show
|
198
|
+
|
199
|
+
def parse
|
200
|
+
Parse.new
|
209
201
|
end
|
210
|
-
memoize :
|
202
|
+
memoize :parse
|
211
203
|
|
212
204
|
# Works similiar to Layering::Layer. Consider combining the logic and usin Layering::Layer
|
213
205
|
#
|
data/lib/ufo/layering/layer.rb
CHANGED
data/lib/ufo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
@@ -594,6 +594,7 @@ files:
|
|
594
594
|
- lib/ufo/config/callable_option.rb
|
595
595
|
- lib/ufo/config/callable_option/concern.rb
|
596
596
|
- lib/ufo/config/inits.rb
|
597
|
+
- lib/ufo/config/parse.rb
|
597
598
|
- lib/ufo/core.rb
|
598
599
|
- lib/ufo/docker/builder.rb
|
599
600
|
- lib/ufo/docker/cleaner.rb
|