backticks 1.0.0 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -0
- data/README.md +1 -1
- data/backticks.gemspec +2 -2
- data/lib/backticks/command.rb +3 -1
- data/lib/backticks/runner.rb +14 -4
- data/lib/backticks/version.rb +1 -1
- metadata +13 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7ebaa9c7d316ac561c6e012a0e8b2c6917660e84db75ef76f0b2d8fba17b062b
|
4
|
+
data.tar.gz: 6628e6912a8cffa9f392729c26e7895e7b1fda2b236d51fc8745ae1df1c64c65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 803ded04638dea802b8bdf9b902e040823cbde99396a922b6db42e11e09c23f0bc1f88c9a487e1c5ce604afa64b996640b48287043e184ab10dafaf1e790242e
|
7
|
+
data.tar.gz: e24c52b66231cad8d3f42ac3eb25c4c4cc515e9e12bd89c7191c29ba72d436e907f9f6a9e37f26e288715d23b09ea45421d1f0a83bf134e6f93ac0331c94aeca
|
data/.rspec
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -13,7 +13,7 @@ or record/playback applications:
|
|
13
13
|
"Intuitive" comes from a DSL that lets you provide command-line arguments as if they were
|
14
14
|
Ruby method arguments:
|
15
15
|
|
16
|
-
```
|
16
|
+
```ruby
|
17
17
|
Backticks.run 'ls', R:true, ignore_backups:true, hide:'.git'
|
18
18
|
Backticks.run 'cp' {f:true}, '*.rb', '/mnt/awesome'
|
19
19
|
```
|
data/backticks.gemspec
CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.required_ruby_version = Gem::Requirement.new(
|
22
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.0', '< 4.0')
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler', '~>
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'rspec'
|
27
27
|
end
|
data/lib/backticks/command.rb
CHANGED
@@ -43,6 +43,8 @@ module Backticks
|
|
43
43
|
@stdout = stdout
|
44
44
|
@stderr = stderr
|
45
45
|
@interactive = !!interactive
|
46
|
+
@tap = nil
|
47
|
+
@status = nil
|
46
48
|
|
47
49
|
@captured_input = String.new.force_encoding(Encoding::BINARY)
|
48
50
|
@captured_output = String.new.force_encoding(Encoding::BINARY)
|
@@ -118,7 +120,7 @@ module Backticks
|
|
118
120
|
# @return [String,nil] fresh bytes from stdout/stderr, or nil if no output
|
119
121
|
def capture(limit=nil)
|
120
122
|
streams = [@stdout, @stderr]
|
121
|
-
streams << STDIN if interactive?
|
123
|
+
streams << STDIN if STDIN.tty? && interactive?
|
122
124
|
|
123
125
|
ready, _, _ = IO.select(streams, [], [], limit)
|
124
126
|
|
data/lib/backticks/runner.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'pty'
|
3
|
+
rescue LoadError
|
4
|
+
# for Windows support, tolerate a missing PTY module
|
5
|
+
end
|
6
|
+
|
2
7
|
require 'open3'
|
3
8
|
|
4
9
|
module Backticks
|
@@ -55,6 +60,7 @@ module Backticks
|
|
55
60
|
}.merge(options)
|
56
61
|
|
57
62
|
@cli = options[:cli]
|
63
|
+
@chdir = nil
|
58
64
|
self.buffered = options[:buffered]
|
59
65
|
self.interactive = options[:interactive]
|
60
66
|
end
|
@@ -104,17 +110,21 @@ module Backticks
|
|
104
110
|
# remaining elements are parameters and flags
|
105
111
|
# @return [Command] the running command
|
106
112
|
def run_without_sugar(argv)
|
107
|
-
|
113
|
+
nopty = !defined?(PTY)
|
114
|
+
|
115
|
+
stdin_r, stdin = if nopty || (buffered.include?(:stdin) && !interactive)
|
108
116
|
IO.pipe
|
109
117
|
else
|
110
118
|
PTY.open
|
111
119
|
end
|
112
|
-
|
120
|
+
|
121
|
+
stdout, stdout_w = if nopty || (buffered.include?(:stdout) && !interactive)
|
113
122
|
IO.pipe
|
114
123
|
else
|
115
124
|
PTY.open
|
116
125
|
end
|
117
|
-
|
126
|
+
|
127
|
+
stderr, stderr_w = if nopty || buffered.include?(:stderr)
|
118
128
|
IO.pipe
|
119
129
|
else
|
120
130
|
PTY.open
|
data/lib/backticks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backticks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Spataro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
63
|
- ".rspec"
|
64
|
+
- ".ruby-version"
|
64
65
|
- ".travis.yml"
|
65
66
|
- CHANGELOG.md
|
66
67
|
- CODE_OF_CONDUCT.md
|
@@ -80,24 +81,26 @@ homepage: https://github.com/xeger/backticks
|
|
80
81
|
licenses:
|
81
82
|
- MIT
|
82
83
|
metadata: {}
|
83
|
-
post_install_message:
|
84
|
+
post_install_message:
|
84
85
|
rdoc_options: []
|
85
86
|
require_paths:
|
86
87
|
- lib
|
87
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
89
|
requirements:
|
89
|
-
- - "
|
90
|
+
- - ">="
|
90
91
|
- !ruby/object:Gem::Version
|
91
92
|
version: '2.0'
|
93
|
+
- - "<"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '4.0'
|
92
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
97
|
requirements:
|
94
98
|
- - ">="
|
95
99
|
- !ruby/object:Gem::Version
|
96
100
|
version: '0'
|
97
101
|
requirements: []
|
98
|
-
|
99
|
-
|
100
|
-
signing_key:
|
102
|
+
rubygems_version: 3.2.3
|
103
|
+
signing_key:
|
101
104
|
specification_version: 4
|
102
105
|
summary: Intuitive OOP wrapper for command-line processes
|
103
106
|
test_files: []
|