terraspace 0.6.21 → 0.6.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/terraspace/compiler/strategy/mod/text_file.rb +35 -0
- data/lib/terraspace/compiler/strategy/mod.rb +2 -5
- data/lib/terraspace/version.rb +1 -1
- data/terraspace.gemspec +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a4ab50a302acfb8803dd00d42b67bee179e0524dc425866c6ed56d9a0ad2be5
|
4
|
+
data.tar.gz: d59bcf8434474bbbea0352cbcaf253b04112c3bdc8cb18b032fe56619dabf445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f658972433c8e00ee3363beebfa0d55940d0febba4e00562fa77f3bfede938a5fa851cb261f9879ab340348d65aee57c0d324e25b41a1ddaa86478eb7ff2923
|
7
|
+
data.tar.gz: 30f54a4f76034c01ed607564acdc4bcaac8f63adf85f120779dc212ec4e7615479a1a71a705f89deecc25dff38fd8e265fe9d8eb5e2b3f6347a4007b8f9e27ca
|
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.6.22] - 2021-12-16
|
7
|
+
- [#165](https://github.com/boltops-tools/terraspace/pull/165) check if file command is installed
|
8
|
+
- [#166](https://github.com/boltops-tools/terraspace/pull/166) add bundler as a dependency
|
9
|
+
|
6
10
|
## [0.6.21] - 2021-12-16
|
7
11
|
- [#164](https://github.com/boltops-tools/terraspace/pull/164) Use Activesupport All
|
8
12
|
|
@@ -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
|
-
|
17
|
+
private
|
20
18
|
def text_file?(filename)
|
21
|
-
|
22
|
-
status.success? && file_type.include?("text")
|
19
|
+
TextFile.new(filename).check
|
23
20
|
end
|
24
21
|
end
|
25
22
|
end
|
data/lib/terraspace/version.rb
CHANGED
data/terraspace.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
@@ -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
|