terraspace 0.6.19 → 0.6.23

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: 2fc510d1165404c449bcc9e3fe0af371d979aa5babc28e8531097f3ccd50c6eb
4
- data.tar.gz: 95a69d72a293c58ff9435a162dbb20383dc8ee6dea8e681a5b8ab672cf90bbd2
3
+ metadata.gz: d9ff791ca3b7b100a8f60caa7a8f8a81e97d45e10317b39643b924cfad6696f6
4
+ data.tar.gz: bd57524893eb19164b38bb8e4495a1577e5784094dd03329565c99200551fe56
5
5
  SHA512:
6
- metadata.gz: c143d467df63cffe80862bec7ed0d06bc6edec50485b8a885d04a19f9f8d5a7a699dd494ff4daf074e303b50a1fc0f788340e6cd00bb42c875c834a05262b864
7
- data.tar.gz: 90e43491736d1f3e43081d51bd9b0100a1641a3aaed71bac5eff71492a19298d0e56da762f79c07ff679e420509ce37e638974a643cc0633cde581c860e051fb
6
+ metadata.gz: 80ea2622c03f16a05450b2616a32988c128146cb91319e48bacba6a6ee04c2c6eeae9d006d2f446a5ab91bc1f44fc40e4cdef7ad25ca1b2ff8b42fc8c1703b72
7
+ data.tar.gz: 6c6ac8a06236ce3dfd827028f1681da5e9f7197c564c85cbf9d9188dd8940e9cdfe810663d33c505b01d05d68fa74fc6be475fb6ea329a21971a384bc094c261
data/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
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.6.23] - 2021-12-18
7
+ - [#167](https://github.com/boltops-tools/terraspace/pull/167) require active_support properly
8
+
9
+ ## [0.6.22] - 2021-12-16
10
+ - [#165](https://github.com/boltops-tools/terraspace/pull/165) check if file command is installed
11
+ - [#166](https://github.com/boltops-tools/terraspace/pull/166) add bundler as a dependency
12
+
13
+ ## [0.6.21] - 2021-12-16
14
+ - [#164](https://github.com/boltops-tools/terraspace/pull/164) Use Activesupport All
15
+
16
+ ## [0.6.20] - 2021-12-14
17
+ - [#162](https://github.com/boltops-tools/terraspace/pull/162) expand_string? interface method so plugins can decide whether or not to expand the string
18
+ - improve seed generator column spacing
19
+
6
20
  ## [0.6.19] - 2021-11-24
7
21
  - [#149](https://github.com/boltops-tools/terraspace/pull/149) change default fallback mod strategy to Mod::Tf instead of Mod::Pass for ERB support
8
22
  - [#152](https://github.com/boltops-tools/terraspace/pull/152) fix naming typo in cli help
@@ -0,0 +1,35 @@
1
+ require "open3"
2
+
3
+ class Terraspace::Compiler::Strategy::Mod
4
+ class TextFile
5
+ include Terraspace::Util::Logging
6
+
7
+ def initialize(filename)
8
+ @filename = filename
9
+ end
10
+
11
+ @@already_reported = false
12
+ def check
13
+ unless file_installed?
14
+ return true if @@already_reported
15
+ logger.warn <<~EOL.color(:yellow)
16
+ WARN: The command 'file' is not installed.
17
+ Unable to check if files are text or binary files as a part of the Terraspace compile processing.
18
+ Assuming all files are not binary file.
19
+
20
+ Please install the file command to remove this warning message.
21
+ EOL
22
+ @@already_reported = true
23
+ return true
24
+ end
25
+ # Thanks: https://stackoverflow.com/questions/2355866/ruby-how-to-determine-if-file-being-read-is-binary-or-text
26
+ file_type, status = Open3.capture2e("file", @filename)
27
+ status.success? && file_type.include?("text")
28
+ end
29
+
30
+ private
31
+ def file_installed?
32
+ system("type file > /dev/null 2>&1")
33
+ end
34
+ end
35
+ end
@@ -1,5 +1,3 @@
1
- require "open3"
2
-
3
1
  module Terraspace::Compiler::Strategy
4
2
  class Mod < AbstractBase
5
3
  def run
@@ -16,10 +14,9 @@ module Terraspace::Compiler::Strategy
16
14
  "Terraspace::Compiler::Strategy::Mod::#{ext.camelize}".constantize rescue Mod::Pass
17
15
  end
18
16
 
19
- # Thanks: https://stackoverflow.com/questions/2355866/ruby-how-to-determine-if-file-being-read-is-binary-or-text
17
+ private
20
18
  def text_file?(filename)
21
- file_type, status = Open3.capture2e("file", filename)
22
- status.success? && file_type.include?("text")
19
+ TextFile.new(filename).check
23
20
  end
24
21
  end
25
22
  end
@@ -34,6 +34,7 @@ module Terraspace::Plugin::Expander
34
34
  #
35
35
  def expansion(string)
36
36
  return string unless string.is_a?(String) # in case of nil
37
+ return string unless expand_string?(string)
37
38
 
38
39
  string = string.dup
39
40
  vars = string.scan(/:\w+/) # => [":ENV", ":BUILD_DIR"]
@@ -43,6 +44,11 @@ module Terraspace::Plugin::Expander
43
44
  strip(string)
44
45
  end
45
46
 
47
+ # interface method
48
+ def expand_string?(string)
49
+ true
50
+ end
51
+
46
52
  # remove leading and trailing common separators.
47
53
  #
48
54
  # This is useful for when INSTANCE is not set.
@@ -49,7 +49,7 @@ class Terraspace::Seeder
49
49
  end
50
50
 
51
51
  def rpad
52
- all_vars.keys.map(&:size).max
52
+ all_vars.keys.map(&:size).max + 2
53
53
  end
54
54
  memoize :rpad
55
55
 
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.6.19"
2
+ VERSION = "0.6.23"
3
3
  end
data/lib/terraspace.rb CHANGED
@@ -5,6 +5,7 @@ $:.unshift(File.expand_path("../", __FILE__))
5
5
  require "terraspace/autoloader"
6
6
  Terraspace::Autoloader.setup
7
7
 
8
+ require "active_support"
8
9
  require "active_support/concern"
9
10
  require "active_support/core_ext/class"
10
11
  require "active_support/core_ext/hash"
@@ -37,8 +37,8 @@ describe Terraspace::Seeder::Content do
37
37
  result = content.build
38
38
  expected =<<~EOL
39
39
  # Required variables:
40
- name = "string"
41
- azs = [...] # list(string)
40
+ name = "string"
41
+ azs = [...] # list(string)
42
42
 
43
43
  # Optional variables:
44
44
  # project = "project-name"
data/terraspace.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "activesupport"
22
+ spec.add_dependency "bundler"
22
23
  spec.add_dependency "cli-format"
23
24
  spec.add_dependency "deep_merge"
24
25
  spec.add_dependency "dsl_evaluator"
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.6.19
4
+ version: 0.6.23
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-11-24 00:00:00.000000000 Z
11
+ date: 2021-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: cli-format
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -614,6 +628,7 @@ files:
614
628
  - lib/terraspace/compiler/strategy/mod/base.rb
615
629
  - lib/terraspace/compiler/strategy/mod/pass.rb
616
630
  - lib/terraspace/compiler/strategy/mod/rb.rb
631
+ - lib/terraspace/compiler/strategy/mod/text_file.rb
617
632
  - lib/terraspace/compiler/strategy/mod/tf.rb
618
633
  - lib/terraspace/compiler/strategy/mod/tfvars.rb
619
634
  - lib/terraspace/compiler/strategy/tfvar.rb
@@ -852,7 +867,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
852
867
  - !ruby/object:Gem::Version
853
868
  version: '0'
854
869
  requirements: []
855
- rubygems_version: 3.1.6
870
+ rubygems_version: 3.2.32
856
871
  signing_key:
857
872
  specification_version: 4
858
873
  summary: 'Terraspace: The Terraspace Framework'