terraspace 2.2.4 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4703e9e81e2f5a450a6f02e790024ea326970a0055c0f351b8c1cc62f4f805c9
4
- data.tar.gz: 17496c6eb2902ccf90af84145fa88c532d4ac53afdfebb931260cd887c9080b2
3
+ metadata.gz: 3bc4c132dc418e5405d199414e9c63cb554f9d86ea8f14234fc6e34794629482
4
+ data.tar.gz: 8dfe56b38173b3edba54c66b40d09035df2e398407663b61e683c3b0ff198b9a
5
5
  SHA512:
6
- metadata.gz: fb49cea863d69660e36df977271942aff8801f518c30119697f2ca641c7257b266ec26931e790a1149e710229e5d7f988594067008cdc59584a4fb352f07a028
7
- data.tar.gz: 58e52ee22af11bef98996a01662396f3f79b2ed1f05e46a435280e296aa9f2449bfd62f9a58849dd48c5e39c692ca160bebf1a8a8e10678fcf224e83788ffae9
6
+ metadata.gz: 1f6c2413de415095b0b72a00f9aa7f26da5d712babdd839af4c02d7b7a30376a90716fa40dd2e55f704a0efe8cd408abf398dee35712167c4e05c068ae52ba75
7
+ data.tar.gz: 4f008a2506d6aa1f3b449564e92dac9a78c6be27bb4b7776000dab5a3444d232f1df4c4ed6ed2bfd9e010810977019049c7c0a780b71d2c20584c96e40859b39
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
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
+ ## [2.2.6] - 2023-05-03
7
+ - [#302](https://github.com/boltops-tools/terraspace/pull/302) update new project generator config/app.rb config.build.copy_modules
8
+
9
+ ## [2.2.5] - 2023-05-02
10
+ - [#301](https://github.com/boltops-tools/terraspace/pull/301) Speed boast copy modules
11
+
6
12
  ## [2.2.4] - 2023-04-19
7
13
  - [#293](https://github.com/boltops-tools/terraspace/pull/293) terrraspace import cli help fix
8
14
  - [#299](https://github.com/boltops-tools/terraspace/pull/299) fix expansion for the case of ENV var is not set
@@ -2,10 +2,7 @@
2
2
  Terraspace.configure do |config|
3
3
  # config.logger.level = :info
4
4
 
5
- # To enable Terraspace Cloud set config.cloud.org
6
- # config.cloud.org = "ORG" # required: replace with your org. only letters, numbers, underscore and dashes allowed
7
- # config.cloud.project = "main" # optional. main is the default project name. only letters, numbers, underscore and dashes allowed
8
-
9
- # Uncomment to enable Cost Estimation. See: http://terraspace.cloud/docs/cloud/cost-estimation/
10
- # config.cloud.cost.enabled = true
5
+ # copy_modules setting introduced 2.2.5 to speed up terraspace build
6
+ # See: https://terraspace.cloud/docs/config/reference
7
+ config.build.copy_modules = true
11
8
  end
@@ -43,6 +43,9 @@ module Terraspace
43
43
  config.build.default_pass_files = ["/files/"]
44
44
  config.build.pass_files = []
45
45
  config.build.dependency_words = []
46
+ # copy_modules = nil # => Will show a warning and default to true
47
+ # copy_modules = true # => Will be default in next major version
48
+ config.build.copy_modules = nil # speed improvement
46
49
 
47
50
  config.bundle = ActiveSupport::OrderedOptions.new
48
51
  config.bundle.logger = ts_logger
@@ -69,7 +69,7 @@ module Terraspace
69
69
  with_each_mod(type_dir) do |mod|
70
70
  is_root_module = mod.cache_dir == @mod.cache_dir
71
71
  next if is_root_module # handled by build_stacks
72
- Compiler::Perform.new(mod).compile
72
+ Compiler::Perform.new(mod, type_dir: type_dir).compile
73
73
  end
74
74
  end
75
75
 
@@ -3,8 +3,9 @@ module Terraspace::Compiler
3
3
  include CommandsConcern
4
4
  include Basename
5
5
 
6
- def initialize(mod)
7
- @mod = mod
6
+ def initialize(mod, options={})
7
+ # options for type_dir
8
+ @mod, @options = mod, options
8
9
  end
9
10
 
10
11
  def compile
@@ -60,7 +61,7 @@ module Terraspace::Compiler
60
61
  end
61
62
 
62
63
  def compile_mod_file(src_path)
63
- content = Strategy::Mod.new(@mod, src_path).run
64
+ content = Strategy::Mod.new(@mod, src_path, @options).run
64
65
  Writer.new(@mod, src_path: src_path).write(content)
65
66
  end
66
67
 
@@ -1,7 +1,8 @@
1
1
  module Terraspace::Compiler::Strategy
2
2
  class AbstractBase
3
- def initialize(mod, src_path)
4
- @mod, @src_path = mod, src_path
3
+ def initialize(mod, src_path, options={})
4
+ # options for type_dir
5
+ @mod, @src_path, @options = mod, src_path, options
5
6
  end
6
7
  end
7
8
  end
@@ -1,5 +1,7 @@
1
1
  module Terraspace::Compiler::Strategy
2
2
  class Mod < AbstractBase
3
+ include Terraspace::Util::Logging
4
+
3
5
  def run
4
6
  klass = strategy_class(@src_path)
5
7
  strategy = klass.new(@mod, @src_path) # IE: Terraspace::Compiler::Strategy::Mod::Rb.new
@@ -7,6 +9,9 @@ module Terraspace::Compiler::Strategy
7
9
  end
8
10
 
9
11
  def strategy_class(path)
12
+ # Significant speed improvement
13
+ return Mod::Pass if copy_modules?
14
+
10
15
  ext = File.extname(path).sub('.','')
11
16
  return Mod::Pass if ext.empty? # infinite loop without this
12
17
  return Mod::Pass if Terraspace.pass_file?(path) or !text_file?(path)
@@ -14,6 +19,39 @@ module Terraspace::Compiler::Strategy
14
19
  "Terraspace::Compiler::Strategy::Mod::#{ext.camelize}".constantize rescue Mod::Pass
15
20
  end
16
21
 
22
+ @@copy_modules_warned = false
23
+ def copy_modules?
24
+ return false unless @options[:type_dir] == "modules"
25
+
26
+ copy_modules = Terraspace.config.build.copy_modules
27
+ if copy_modules.nil? && @@copy_modules_warned == false
28
+ logger.info "WARN: config.build.copy_modules is not set. Defaulting to true.".color(:yellow)
29
+ logger.info <<~EOL
30
+ The terraspace building behavior is to copy modules from
31
+ the app/modules folder to the .terraspace-cache for speed.
32
+ Most do not need app/modules to be compiled.
33
+ Other files like app/stacks and tfvars files are still compiled.
34
+ This is a change from previous versions of Terraspace, where
35
+ all files were compiled.
36
+
37
+ You can turn this warning off by setting:
38
+
39
+ .terraspace/config.rb
40
+
41
+ Terraspace.configure do |config|
42
+ config.build.copy_modules = true
43
+ end
44
+
45
+ In future Terraspace versions, the default will be true.
46
+ There will be no warning message, but it will still be configurable.
47
+ EOL
48
+ copy_modules = true
49
+ @@copy_modules_warned = true
50
+ end
51
+
52
+ copy_modules
53
+ end
54
+
17
55
  private
18
56
  def text_file?(filename)
19
57
  TextFile.new(filename).check
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "2.2.4"
2
+ VERSION = "2.2.6"
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: 2.2.4
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-19 00:00:00.000000000 Z
11
+ date: 2023-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport