terraspace 2.2.4 → 2.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/terraspace/app.rb +3 -0
- data/lib/terraspace/builder.rb +1 -1
- data/lib/terraspace/compiler/perform.rb +4 -3
- data/lib/terraspace/compiler/strategy/abstract_base.rb +3 -2
- data/lib/terraspace/compiler/strategy/mod.rb +38 -0
- 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: cea629f7a076ccbe0f682b3037fda1e69fe8f7658243e502103b395ff0396351
|
4
|
+
data.tar.gz: ab8d340084aef5691796484d2942469262978ac848b8fc6f33d54b49d60609e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 421a85f27bc4fb0906de29037eba4f7e3d852b8c0ce60191e911ccd615a04897a3d631e7c742eba8006e681f893d6715097910fd71a558b0931e36d3d8a0d881
|
7
|
+
data.tar.gz: 94c6f9f9a605a8e151576efb54d0326e7a6a0d8d18736edc9607bb04b35c158040d801d58ff50cf2567db21013095a531914c501ca19609b672f35c4450f0baf
|
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
|
+
## [2.2.5] - 2023-05-02
|
7
|
+
- [#301](https://github.com/boltops-tools/terraspace/pull/301) Speed boast copy modules
|
8
|
+
|
6
9
|
## [2.2.4] - 2023-04-19
|
7
10
|
- [#293](https://github.com/boltops-tools/terraspace/pull/293) terrraspace import cli help fix
|
8
11
|
- [#299](https://github.com/boltops-tools/terraspace/pull/299) fix expansion for the case of ENV var is not set
|
data/lib/terraspace/app.rb
CHANGED
@@ -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
|
data/lib/terraspace/builder.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
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: 2.2.
|
4
|
+
version: 2.2.5
|
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-
|
11
|
+
date: 2023-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|