terraspace 0.5.11 → 0.5.12

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: 7ab8d16e8890ccbd14785cdc20245e47a126593337d0330bfecbb902336a32d8
4
- data.tar.gz: 51f9b735befd7ea059ff6541414e3f80631a9bc5b511fc69f4e1f489e6f9a72e
3
+ metadata.gz: 85fe397ec78c3f7aef5a84305c0a1f64bb6c8f1fe600f42b0d6595de4b5e579b
4
+ data.tar.gz: 5549151c17289da5bf06dcdbae93437cd53ec338c1e8f6649fef7f2c71eb21da
5
5
  SHA512:
6
- metadata.gz: b3d6fca3b2b9b2fcdabd48d6b093e7a3dcfafe4f53a482dc7fffb3a001bca89a743b294b12ccc92e2cb7010799e0d147e402406afaa93de48149d94fd9c894f3
7
- data.tar.gz: 5a36c2d3d9f847989f639829be9fae0b5b1a9a6e48f636478b1560a94a45fca2ff74db5800ebaa8ed97977c2b5e83a72a99292f8737c6737ebabd1ba748bd026
6
+ metadata.gz: 3155ac6e54e382836f73fa2bd3904544bbc9be86eb9a7f4a140a78062e83c320c493efc67fa92db0fa5d5a7e994d8293b674f324f70ff39b5242130883d6c28c
7
+ data.tar.gz: 368950badea2768a4221593d65eadda27c3a84eb4f2f1a9b4af0e5a53da05faa67cbfff8d99850d846c2e64aa110bd347178866e2caa05e9e084c8411489a9af
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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
+ ## [0.5.12] - 2021-02-27
7
+ - [#79](https://github.com/boltops-tools/terraspace/pull/79) Fix syntax issue
8
+ - [#85](https://github.com/boltops-tools/terraspace/pull/85) Add all.include_stacks option and fix all.ignore_stacks option when building dependency graph
9
+
6
10
  ## [0.5.11] - 2021-02-11
7
11
  - [#76](https://github.com/boltops-tools/terraspace/pull/76) dont use auto generated plan when both yes and plan options used
8
12
  - fix plan path when 2 stacks of same name run at the same time
@@ -17,7 +17,8 @@ module Terraspace
17
17
  config.all.exit_on_fail = ActiveSupport::OrderedOptions.new
18
18
  config.all.exit_on_fail.down = true
19
19
  config.all.exit_on_fail.up = true
20
- config.all.ignore_stacks = []
20
+ config.all.ignore_stacks = nil
21
+ config.all.include_stacks = nil
21
22
  config.allow = ActiveSupport::OrderedOptions.new
22
23
  config.allow.envs = nil
23
24
  config.allow.regions = nil
@@ -144,7 +144,7 @@ module Terraspace
144
144
  desc "seed STACK", "Build starer seed tfvars file."
145
145
  long_desc Help.text(:seed)
146
146
  option :yes, aliases: :y, type: :boolean, desc: "bypass prompts and force overwrite files"
147
- option :where, desc: "where to create file. either under app or seed folder structure. values: app or stack"
147
+ option :where, desc: "where to create file. either under app or seed folder structure. values: seed or stack"
148
148
  init_option.call
149
149
  instance_option.call
150
150
  def seed(mod)
@@ -26,7 +26,12 @@ module Terraspace::CLI::Build
26
26
 
27
27
  # Used by: terraspace build placeholder
28
28
  def find_stack
29
- mod_path = Dir.glob("{app,vendor}/stacks/*").last
29
+ stack_paths = Dir.glob("{app,vendor}/stacks/*")
30
+ stack_paths.select! do |path|
31
+ select = Terraspace::Compiler::Select.new(path)
32
+ select.selected?
33
+ end
34
+ mod_path = stack_paths.last
30
35
  unless mod_path
31
36
  logger.info "No stacks found."
32
37
  exit 0
@@ -23,6 +23,7 @@ module Terraspace::Compiler
23
23
  names, built = [], []
24
24
  local_paths(type_dir).each do |path|
25
25
  next unless File.directory?(path)
26
+ next unless select_stack?(type_dir, path)
26
27
  mod_name = File.basename(path)
27
28
  next if built.include?(mod_name) # ensures modules in app folder take higher precedence than vendor folder
28
29
  names << mod_name
@@ -31,6 +32,15 @@ module Terraspace::Compiler
31
32
  end
32
33
  memoize :mod_names
33
34
 
35
+ # Examples:
36
+ # type_dir stacks
37
+ # path /home/ec2-user/environment/downloads/infra/app/stacks/demo
38
+ def select_stack?(type_dir, path)
39
+ return true unless type_dir == "stacks"
40
+ select = Terraspace::Compiler::Select.new(path)
41
+ select.selected?
42
+ end
43
+
34
44
  def local_paths(type_dir)
35
45
  dirs("app/#{type_dir}/*") + dirs("vendor/#{type_dir}/*")
36
46
  end
@@ -40,7 +50,7 @@ module Terraspace::Compiler
40
50
  end
41
51
 
42
52
  def stack_names
43
- mod_names("stacks") - Terraspace.config.all.ignore_stacks
53
+ mod_names("stacks")
44
54
  end
45
55
  memoize :stack_names
46
56
  end
@@ -0,0 +1,28 @@
1
+ module Terraspace::Compiler
2
+ class Select
3
+ def initialize(path)
4
+ @path = path
5
+ @stack_name = extract_stack_name(path)
6
+ end
7
+
8
+ def selected?
9
+ all = Terraspace.config.all
10
+ # Key difference between include_stacks vs all.include_stacks option is that
11
+ # the option can be nil. The local variable is guaranteed to be an Array.
12
+ # This simplifies the logic.
13
+ include_stacks = all.include_stacks || []
14
+ ignore_stacks = all.ignore_stacks || []
15
+
16
+ if all.include_stacks.nil?
17
+ !ignore_stacks.include?(@stack_name)
18
+ else
19
+ stacks = include_stacks - ignore_stacks
20
+ stacks.include?(@stack_name)
21
+ end
22
+ end
23
+
24
+ def extract_stack_name(path)
25
+ path.sub(%r{.*(app|vendor)/stacks/}, '')
26
+ end
27
+ end
28
+ end
@@ -13,7 +13,7 @@ class Terraspace::Shell
13
13
  if reinit_required?
14
14
  Terraspace::InitRequiredError.new(@lines)
15
15
  elsif bucket_not_found?
16
- Terraspace::BucketNotFound.new(@lines)
16
+ Terraspace::BucketNotFoundError.new(@lines)
17
17
  elsif shared_cache_error?
18
18
  Terraspace::SharedCacheError.new(@lines)
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.5.11"
2
+ VERSION = "0.5.12"
3
3
  end
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: 0.5.11
4
+ version: 0.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-11 00:00:00.000000000 Z
11
+ date: 2021-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -599,6 +599,7 @@ files:
599
599
  - lib/terraspace/compiler/erb/render.rb
600
600
  - lib/terraspace/compiler/expander.rb
601
601
  - lib/terraspace/compiler/helper_extender.rb
602
+ - lib/terraspace/compiler/select.rb
602
603
  - lib/terraspace/compiler/strategy/abstract_base.rb
603
604
  - lib/terraspace/compiler/strategy/mod.rb
604
605
  - lib/terraspace/compiler/strategy/mod/base.rb