test-cmd.rb 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -21
- data/lib/test-cmd.rb +4 -8
- 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: 031f9708015f5e2e10d4b9afe09db3841c2a7c8ffa9ee83717d12ff4e078cd02
|
4
|
+
data.tar.gz: e1afc91430c82bfb3e146ea3b3a8a58c9fdb047b4c25c2be7b62d2b1470fd694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 599e9bd0599c675f58b742e556b60c0d475b3a8fbe50012eddcc633eb1f09492791e88f0fbc7161a63172b96df1268a80304cd1b6dbb738ddd06d48ce9ad30ed
|
7
|
+
data.tar.gz: acc8485e9f6fde4c25e80dd354933f5750804fe0f066054b2e4cea3c4093a2020df28d86ab7f055766466658d3a69d6a53d89699bb6f0d3652b3cdd8f46eec3d
|
data/README.md
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
## About
|
2
2
|
|
3
3
|
test-cmd.rb is a library for accessing the output streams
|
4
|
-
(both stdout and stderr) of a spawned process.
|
5
|
-
first realized in a test environment, where it provided a path
|
6
|
-
for verifying that when code examples are run they produce the
|
7
|
-
expected output. The library can be generally useful outside a
|
8
|
-
test environment, too.
|
4
|
+
(both stdout and stderr) of a spawned process.
|
9
5
|
|
10
6
|
## Examples
|
11
7
|
|
@@ -53,7 +49,7 @@ require "test/cmd"
|
|
53
49
|
str = cmd("du")
|
54
50
|
.arg("-s").arg("-h")
|
55
51
|
.spawn.stdout
|
56
|
-
puts str
|
52
|
+
puts str
|
57
53
|
```
|
58
54
|
|
59
55
|
### IO#sync
|
@@ -96,30 +92,24 @@ Process.wait(pid)
|
|
96
92
|
p cmd("ruby test.rb").stdout # => "foo\nbar\n"
|
97
93
|
```
|
98
94
|
|
99
|
-
##
|
95
|
+
## Documentation
|
100
96
|
|
101
|
-
|
102
|
-
|
97
|
+
A complete API reference is available at
|
98
|
+
[0x1eef.github.io/x/test-cmd.rb](https://0x1eef.github.io/x/test-cmd.rb).
|
103
99
|
|
104
100
|
## Install
|
105
101
|
|
106
|
-
test-cmd.rb is distributed as a RubyGem through its git repositories. <br>
|
107
|
-
[GitHub](https://github.com/0x1eef/test-cmd.rb),
|
108
|
-
and
|
109
|
-
[GitLab](https://gitlab.com/0x1eef/test-cmd.rb)
|
110
|
-
are available as sources.
|
111
|
-
|
112
|
-
``` ruby
|
113
|
-
# Gemfile
|
114
|
-
gem "test-cmd.rb", github: "0x1eef/test-cmd.rb", tag: "v0.5.2"
|
115
|
-
```
|
116
|
-
|
117
102
|
**Rubygems.org**
|
118
103
|
|
119
|
-
test-cmd.rb can
|
104
|
+
test-cmd.rb can be installed via rubygems.org.
|
120
105
|
|
121
106
|
gem install test-cmd.rb
|
122
107
|
|
108
|
+
## Sources
|
109
|
+
|
110
|
+
* [GitHub](https://github.com/0x1eef/test-cmd.rb#readme)
|
111
|
+
* [GitLab](https://gitlab.com/0x1eef/test-cmd.rb#about)
|
112
|
+
|
123
113
|
## License
|
124
114
|
|
125
115
|
[BSD Zero Clause](https://choosealicense.com/licenses/0bsd/).
|
data/lib/test-cmd.rb
CHANGED
@@ -3,11 +3,7 @@ end unless defined?(Test)
|
|
3
3
|
|
4
4
|
##
|
5
5
|
# test-cmd.rb is a library for accessing the output streams
|
6
|
-
# (both stdout and stderr) of a spawned process.
|
7
|
-
# first realized in a test environment, where it provided a path
|
8
|
-
# for verifying that when code examples are run they produce the
|
9
|
-
# expected output. The library can be generally useful outside a
|
10
|
-
# test environment, too.
|
6
|
+
# (both stdout and stderr) of a spawned process.
|
11
7
|
class Test::Cmd
|
12
8
|
require "tempfile"
|
13
9
|
|
@@ -112,13 +108,13 @@ class Test::Cmd
|
|
112
108
|
# @api private
|
113
109
|
def unlink!(file)
|
114
110
|
file.tap do
|
115
|
-
File.chmod(
|
111
|
+
File.chmod(0, file.path)
|
116
112
|
file.unlink
|
117
113
|
end
|
118
114
|
end
|
119
115
|
end
|
120
116
|
|
121
|
-
module Test::
|
117
|
+
module Test::Cmd::Mixin
|
122
118
|
##
|
123
119
|
# @param [String] cmd
|
124
120
|
# A command to execute
|
@@ -132,5 +128,5 @@ module Test::CmdMixin
|
|
132
128
|
end
|
133
129
|
|
134
130
|
module Kernel
|
135
|
-
include Test::
|
131
|
+
include Test::Cmd::Mixin
|
136
132
|
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.
|
8
|
+
gem.version = "0.6.0"
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '0x1eef'
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|