kapost-bootstrapper 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kapost/bootstrapper/version.rb +1 -1
- data/lib/kapost/bootstrapper.rb +8 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bbdfc50dfe2de74b812a50bb6258856d68116d5
|
4
|
+
data.tar.gz: 5bc52349f47dbb10611ed3783076130938119d86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57280b925aea7f4e276c1ac2621efd6715e8a8bc1e4589900a7b90bb3a54352c706435a689e097e54dd781869d4445c78628b0323d402d86f2345da741b448c2
|
7
|
+
data.tar.gz: 5f198e76bf08abfafb25f13840cc5878dfa3c37d3b189ed9210be4a517c07fac346f7ad3336ff7b0ce67f82b8ef0d6e40ce5b653dd249bfe9ddd8982aba6b1e5
|
data/lib/kapost/bootstrapper.rb
CHANGED
@@ -53,7 +53,11 @@ module Kapost
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def default_check(command, version)
|
56
|
-
installed?(command)
|
56
|
+
installed?(command) or raise CommandNotFoundError, command
|
57
|
+
if version
|
58
|
+
actual_version = right_version?(command, version) or raise CommandVersionMismatchError, command, version, actual_version
|
59
|
+
end
|
60
|
+
true
|
57
61
|
end
|
58
62
|
|
59
63
|
def check(command, help = nil, version: nil)
|
@@ -82,16 +86,12 @@ module Kapost
|
|
82
86
|
|
83
87
|
def installed?(command)
|
84
88
|
_, status = cli.capture2e "bash -c 'type #{command}'"
|
85
|
-
|
86
|
-
true
|
89
|
+
status.success?
|
87
90
|
end
|
88
91
|
|
89
92
|
def right_version?(command, expected_version)
|
90
93
|
version, status = cli.capture2e "#{command} --version"
|
91
|
-
|
92
|
-
raise CommandVersionMismatchError, command, expected_version, version
|
93
|
-
end
|
94
|
-
true
|
94
|
+
status.success? && version.include?(expected_version) && version
|
95
95
|
end
|
96
96
|
|
97
97
|
def say(message)
|
@@ -110,7 +110,7 @@ module Kapost
|
|
110
110
|
def sh(*cmd)
|
111
111
|
options = (Hash === cmd.last) ? cmd.pop : {}
|
112
112
|
say(cmd.join(" ")) if options[:verbose]
|
113
|
-
result =
|
113
|
+
result = shell.system(*cmd)
|
114
114
|
status = $?
|
115
115
|
raise CommandFailedError.new(cmd.join(" "), status.exitstatus) unless result
|
116
116
|
result
|