test-cmd.rb 0.12.3 → 0.12.4
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/test/cmd.rb +11 -0
- data/test/cmd_test.rb +9 -0
- data/test-cmd.rb.gemspec +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: 9543aef60b39eebdd49dcd4a1a33b9f08841cdc7ad0176402266d0236bdb483c
|
4
|
+
data.tar.gz: 44f38f751770d9cee2d734a768b07d10a67227d3841aec53648a9ecff89ca26a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be9bba3851638c04d87a114f92fc2ee28b8683e3df14b13b9a37f7a9749ea0075589def7acf65c8b554e62f6e8575b9ccde4aa9f61b024f65a6455f360686559
|
7
|
+
data.tar.gz: 04db2f4f1b84bb1ce41acfa570778bcec93d64593d58825356c1b9e48ff08b181f8c13c516bbfe70fa8065ecf18b83488df1a8ac1354632e3513765be24a47c6
|
data/lib/test/cmd.rb
CHANGED
@@ -32,6 +32,7 @@ class Test::Cmd
|
|
32
32
|
@spawned = false
|
33
33
|
@stdout = ""
|
34
34
|
@stderr = ""
|
35
|
+
@enoent = false
|
35
36
|
end
|
36
37
|
|
37
38
|
##
|
@@ -57,6 +58,7 @@ class Test::Cmd
|
|
57
58
|
@status = $?
|
58
59
|
rescue Errno::ENOENT => ex
|
59
60
|
@cmd, @argv, @stderr = "false", [], ex.message
|
61
|
+
@enoent = true
|
60
62
|
retry
|
61
63
|
end
|
62
64
|
loop do
|
@@ -154,6 +156,15 @@ class Test::Cmd
|
|
154
156
|
def spawned?
|
155
157
|
@spawned
|
156
158
|
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# @return [Boolean]
|
162
|
+
# Returns true when a command can't be found
|
163
|
+
def command_not_found?
|
164
|
+
spawn
|
165
|
+
@enoent
|
166
|
+
end
|
167
|
+
alias_method :not_found?, :command_not_found?
|
157
168
|
end
|
158
169
|
|
159
170
|
module Kernel
|
data/test/cmd_test.rb
CHANGED
@@ -105,4 +105,13 @@ class Test::Cmd
|
|
105
105
|
assert_equal true, ruby("puts 42").tap(&:spawn).spawned?
|
106
106
|
end
|
107
107
|
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Test::Cmd#command_not_found?
|
111
|
+
class CommandNotFoundTest < Test
|
112
|
+
def test_command_not_found
|
113
|
+
assert_equal true, cmd("/a/path/that/is/not/found").command_not_found?
|
114
|
+
assert_equal true, cmd("/a/path/that/is/not/found").not_found?
|
115
|
+
end
|
116
|
+
end
|
108
117
|
end
|
data/test-cmd.rb.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.authors = ["0x1eef"]
|
6
6
|
gem.email = ["0x1eef@protonmail.com"]
|
7
7
|
gem.homepage = "https://github.com/0x1eef/test-cmd.rb#readme"
|
8
|
-
gem.version = "0.12.
|
8
|
+
gem.version = "0.12.4"
|
9
9
|
gem.required_ruby_version = ">= 3.0"
|
10
10
|
gem.licenses = ["0BSD"]
|
11
11
|
gem.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-cmd.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '0x1eef'
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|