terraspace 1.1.4 → 1.1.5

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: 50baca1ee67aedb6160857e20b413db3e31923ee2f6bd8347723e2445d9b59ef
4
- data.tar.gz: 0ac181788709d0700c0cfcd8085c375b453e84aef6333b9c93b446ff1bb30938
3
+ metadata.gz: 91fe12476c2039a757ceb34e964609b8b5d0d922b08818f122088b5cd3989364
4
+ data.tar.gz: 01c7ec1d07c2a6be6da3d14e300c5dfb460a2b2595e511c4dc792e50530853f5
5
5
  SHA512:
6
- metadata.gz: ce1c04ca24e818cef35397bf9fb7cadb9e9b28838a0e15c3ec18e0e4d0b49d3bdfba4bb01e6d3e9788e5410e99c44dc827ec79a0432ae94d90fd4413c2c446ad
7
- data.tar.gz: 95d7c2cea1917b0e3c919a43afadf24b2970dbd87c2d46d5b5846d62c6e9cc115751a7ab63defb74ad1c79917984262a7d9987eee1134e87d2778c9edcc3a175
6
+ metadata.gz: 0fadfaa474138a8ef5f5856eb4b4cf5c3c998ecc6787c4ebbbc1c960e35b7949cf1ae6dd0b42bc0c6a8eba5b60007e57bc402c35a5ccd115a0172d1cbce67cb5
7
+ data.tar.gz: 26f8095beac1358e28c0eb516c7dafc5bf896a3076d7fb113e2bd0a97906b9ad3dfc7bd4816a7d844656fc7bf95e006f377b7b83407e4279bda614b2c4e35252
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
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.1.5] - 2022-02-21
7
+ - [#212](https://github.com/boltops-tools/terraspace/pull/212) ability to show layers for debugging
8
+ - show layers for debugging with logger level debug and TS_SHOW_ALL_LAYERS=1
9
+ - stringify_keys layer friendly names map
10
+
6
11
  ## [1.1.4] - 2022-02-21
7
12
  - [#210](https://github.com/boltops-tools/terraspace/pull/210) write files without magic conversion, fixes #209
8
13
  - cleanup argv and root
@@ -32,6 +32,7 @@ class Terraspace::Compiler::Strategy::Tfvar
32
32
  extend Memoist
33
33
  include Terraspace::Layering
34
34
  include Terraspace::Plugin::Expander::Friendly
35
+ include Terraspace::Util
35
36
 
36
37
  def initialize(mod)
37
38
  @mod = mod
@@ -40,7 +41,11 @@ class Terraspace::Compiler::Strategy::Tfvar
40
41
  def paths
41
42
  project_paths = full_paths(project_tfvars_dir)
42
43
  stack_paths = full_paths(stack_tfvars_dir)
43
- project_paths + stack_paths
44
+ paths = project_paths + stack_paths
45
+ show_layers(paths)
46
+ paths.select do |path|
47
+ File.exist?(path)
48
+ end
44
49
  end
45
50
  memoize :paths
46
51
 
@@ -51,10 +56,6 @@ class Terraspace::Compiler::Strategy::Tfvar
51
56
  "#{tfvars_dir}/#{layer}.rb",
52
57
  ]
53
58
  end.flatten
54
-
55
- layer_paths.select do |path|
56
- File.exist?(path)
57
- end
58
59
  end
59
60
 
60
61
  def full_layering
@@ -130,5 +131,18 @@ class Terraspace::Compiler::Strategy::Tfvar
130
131
  empty = Dir.glob("#{seed_dir}/*").empty?
131
132
  empty ? mod_dir : seed_dir
132
133
  end
134
+
135
+ @@shown_layers = {}
136
+ def show_layers(paths)
137
+ return unless @mod.resolved
138
+ return if @@shown_layers[@mod.name]
139
+ logger.debug "Layers for #{@mod.name}:"
140
+ paths.each do |path|
141
+ logger.debug " #{pretty_path(path)}" if File.exist?(path) || ENV['TS_SHOW_ALL_LAYERS']
142
+ end
143
+ logger.debug ""
144
+ @@shown_layers[@mod.name] = true
145
+ end
146
+
133
147
  end
134
148
  end
@@ -1,5 +1,7 @@
1
1
  module Terraspace::Compiler::Strategy
2
2
  class Tfvar
3
+ extend Memoist
4
+
3
5
  def initialize(mod)
4
6
  @mod = mod
5
7
  @order = 0
@@ -24,6 +26,7 @@ module Terraspace::Compiler::Strategy
24
26
  def layer_paths
25
27
  Layer.new(@mod).paths
26
28
  end
29
+ memoize :layer_paths
27
30
 
28
31
  # Tact on number to ensure that tfvars will be processed in desired order.
29
32
  # Also name auto.tfvars so it will automatically load
@@ -5,7 +5,8 @@ module Terraspace::Plugin::Expander
5
5
  # Terraspace::Plugin::Expander::Interface
6
6
  def friendly_name(name)
7
7
  return '' if name.nil?
8
- Terraspace.config.layering.names[name.to_sym] || name
8
+ names = Terraspace.config.layering.names.stringify_keys
9
+ names[name.to_s] || name
9
10
  end
10
11
  end
11
12
  end
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen