terraspace 1.1.1 → 1.1.2

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: c07e843df9e61e62be834feba56f4d5fa058f3dbb130ed7e15edca66ef23e22d
4
- data.tar.gz: a7d7c3946e2485ccb369a5d76d413118aed14592750880a48990ca83cdca5bca
3
+ metadata.gz: 6ad5587827bc4c9dcbae4cd2a42904e69ccf930bfa1a04c7e65d753178ff94f7
4
+ data.tar.gz: 122e5fb3135447e92bf12e7f5947ee665f5f77e024e6aea5499ad63a184eceea
5
5
  SHA512:
6
- metadata.gz: 026aa5128ce2bea7deb3e5b0fdb6e99c7cf50297c20f5292bbe6896dabb0ba995e62ecd14526ea2ea7e8e1a4be3895e29021620a89b26df49ad34ee0b95ffd1d
7
- data.tar.gz: c2df058d2fe9848834fc4e166c1382ccb0e782170fb52f8fd264e4e948a1032916cc9d77662eac1969f4d2101e66b3655e07d944b217e5749581ac0d3ec04916
6
+ metadata.gz: 0b6a0f432037f072acad01d60efb86d6e06314cea7ff75556dfb0de4ec077fe2479b215867702c8c6a615358a17c4568f30cfcf4a45011233f03b9c595a258ec
7
+ data.tar.gz: ed255135382340d2a44cd04f863f8fc9d8bb6562b413e04024a13f6e4bb31c2b19f837dbb7c05ee1220210ee4bf0bd6ce4a5d4e5628fb23eab61dd8a338c6b5b
data/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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.2] - 2022-02-17
7
+ - [#200](https://github.com/boltops-tools/terraspace/pull/200) fix terraspace typos
8
+ - [#202](https://github.com/boltops-tools/terraspace/pull/202) Windows support: fix include_dir for windows
9
+ - [#203](https://github.com/boltops-tools/terraspace/pull/203) Fix ERB for windows
10
+ - [#204](https://github.com/boltops-tools/terraspace/pull/204) improve file check
11
+ - setup check terraform_bin windows support
12
+ - slight layering improvement strip trailing slash, helps with custom layering
13
+
6
14
  ## [1.1.1] - 2022-02-02
7
15
  - [#199](https://github.com/boltops-tools/terraspace/pull/199) build required dependent stacks as part of terraspace up
8
16
 
@@ -1,9 +1,9 @@
1
1
  ## Example
2
2
 
3
3
  $ terraspace check_setup
4
- Detected Terrspace version: 0.3.3
4
+ Detected Terraspace version: 0.3.3
5
5
  Detected Terraform bin: /home/ec2-user/.tfenv/bin/terraform
6
6
  Detected Terraform v0.13.2
7
7
  Terraspace requires Terraform v0.12.x and above
8
8
  You're all set!
9
- $
9
+ $
@@ -50,7 +50,7 @@ class Terraspace::CLI::New
50
50
 
51
51
  private
52
52
  def switch_ruby_version_line
53
- rbenv_installed = system("type rbenv 2>&1 > /dev/null")
53
+ rbenv_installed = system("type rbenv > /dev/null 2>&1")
54
54
  if rbenv_installed
55
55
  'eval "$(rbenv init -)"'
56
56
  end
@@ -11,7 +11,7 @@ class Terraspace::CLI::Setup
11
11
 
12
12
  # Used for the CLI
13
13
  def run
14
- puts "Detected Terrspace version: #{Terraspace::VERSION}"
14
+ puts "Detected Terraspace version: #{Terraspace::VERSION}"
15
15
  if terraform_bin
16
16
  puts "Detected Terraform bin: #{terraform_bin}"
17
17
  puts "Detected #{terraform_version_message}"
@@ -65,8 +65,12 @@ class Terraspace::CLI::Setup
65
65
  end
66
66
 
67
67
  def terraform_bin
68
- out = `type terraform 2>&1`.strip
69
- return unless $?.success?
68
+ if Gem.win_platform?
69
+ out = "is terraform.exe".strip
70
+ else
71
+ out = `type terraform 2>&1`.strip
72
+ return unless $?.success?
73
+ end
70
74
  md = out.match(/is (.*)/)
71
75
  md[1] if md
72
76
  end
@@ -30,7 +30,7 @@ module Terraspace
30
30
  include Terraspace::Util::Logging
31
31
 
32
32
  def dispatch(m, args, options, config)
33
- # Terraspace.argv provides consistency when terraspace is being called by rspec-terrspace test harness
33
+ # Terraspace.argv provides consistency when terraspace is being called by rspec-terraspace test harness
34
34
  Terraspace.argv = args.clone # important to clone since Thor removes the first argv
35
35
 
36
36
  check_standalone_install!
@@ -8,28 +8,29 @@ class Terraspace::Compiler::Strategy::Mod
8
8
  @filename = filename
9
9
  end
10
10
 
11
- @@already_reported = false
12
11
  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.
12
+ return true if Gem.win_platform? # assume text file if on windows
13
+ return true unless file_installed?
19
14
 
20
- Please install the file command to remove this warning message.
21
- EOL
22
- @@already_reported = true
23
- return true
24
- end
25
15
  # Thanks: https://stackoverflow.com/questions/2355866/ruby-how-to-determine-if-file-being-read-is-binary-or-text
26
16
  file_type, status = Open3.capture2e("file", @filename)
27
17
  status.success? && file_type.include?("text")
28
18
  end
29
19
 
30
20
  private
21
+ @@has_file = nil
31
22
  def file_installed?
32
- system("type file > /dev/null 2>&1")
23
+ return @@has_file unless @@has_file.nil?
24
+ @@has_file = system("type file > /dev/null 2>&1")
25
+ unless @@has_file
26
+ logger.warn <<~EOL.color(:yellow)
27
+ WARN: The command 'file' is not installed.
28
+ Unable to check if files are text or binary files as a part of the Terraspace compile processing.
29
+ Assuming all files are not binary file.
30
+ Please install the file command to remove this warning message.
31
+ EOL
32
+ end
33
+ @@has_file
33
34
  end
34
35
  end
35
36
  end
@@ -58,8 +58,9 @@ class Terraspace::Compiler::Strategy::Tfvar
58
58
  end
59
59
 
60
60
  def full_layering
61
- # layers is defined in Terraspace::Layering module
62
- layers.inject([]) do |sum, layer|
61
+ # layers defined in Terraspace::Layering module
62
+ all = layers.map { |layer| layer.sub(/\/$/,'') } # strip trailing slash
63
+ all.inject([]) do |sum, layer|
63
64
  sum += layer_levels(layer) unless layer.nil?
64
65
  sum
65
66
  end
@@ -59,7 +59,7 @@ module Terraspace
59
59
  end
60
60
  end
61
61
 
62
- # Terraspace.argv provides consistency when terraspace is being called by rspec-terrspace test harness
62
+ # Terraspace.argv provides consistency when terraspace is being called by rspec-terraspace test harness
63
63
  # So use Terraspace.argv instead of ARGV constant
64
64
  def argv=(argv)
65
65
  @@argv = argv
@@ -5,8 +5,15 @@ class Module
5
5
  # include Provider
6
6
  # # etc
7
7
  #
8
+ # Caller lines are different for OSes:
9
+ #
10
+ # windows: "C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/terraspace-1.1.1/lib/terraspace/builder.rb:34:in `build'"
11
+ # linux: "/home/ec2-user/.rvm/gems/ruby-3.0.3/gems/terraspace-1.1.1//lib/terraspace/compiler/dsl/syntax/mod.rb:4:in `<module:Mod>'"
12
+ #
8
13
  def include_dir(dir)
9
- calling_file = caller[0].split(':').first # IE: /home/ec2-user/environment/terraspace/lib/terraspace/compiler/dsl/syntax/mod.rb
14
+ caller_line = caller[0]
15
+ parts = caller_line.split(':')
16
+ calling_file = caller_line.match(/^[a-zA-Z]:/) ? parts[1] : parts[0]
10
17
  parent_dir = File.dirname(calling_file)
11
18
 
12
19
  full_dir = "#{parent_dir}/#{dir}"
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
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: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-02 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport