qbash 0.5.0 → 0.6.0
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/Gemfile.lock +36 -36
- data/lib/qbash.rb +13 -2
- data/qbash.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76514b64336276e5a7a6f930cdde69aa8f92a368385e661b8b930fcf56b74269
|
|
4
|
+
data.tar.gz: 551650cc2ab252c771d99b6cf7a1e57a432d24b13b660df5c80549e1156a12c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b0b790b282910bc8730657f264042caddaf3d960933be65ef5a9541277ca8d0f7e0d1f5371643eadee77f3f9b367f67db744ad99a6edbdf2a89c55b9ec0e63df
|
|
7
|
+
data.tar.gz: 904d66cdf396205812115e1f45d90a903fe65fa9bdc9bc66c62f410beb521261f3dd830f87831996dc650ade478d0a7601e29ccb390d7dc3b29dd1b2a156a86c
|
data/Gemfile.lock
CHANGED
|
@@ -10,13 +10,13 @@ PATH
|
|
|
10
10
|
GEM
|
|
11
11
|
remote: https://rubygems.org/
|
|
12
12
|
specs:
|
|
13
|
-
addressable (2.8.
|
|
14
|
-
public_suffix (>= 2.0.2, <
|
|
13
|
+
addressable (2.8.8)
|
|
14
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
15
15
|
ansi (1.5.0)
|
|
16
16
|
ast (2.4.3)
|
|
17
17
|
backtrace (0.4.1)
|
|
18
18
|
base64 (0.3.0)
|
|
19
|
-
bigdecimal (
|
|
19
|
+
bigdecimal (4.0.1)
|
|
20
20
|
builder (3.3.0)
|
|
21
21
|
crack (1.0.1)
|
|
22
22
|
bigdecimal
|
|
@@ -33,33 +33,33 @@ GEM
|
|
|
33
33
|
mini_mime (~> 1.1)
|
|
34
34
|
multi_test (~> 1.1)
|
|
35
35
|
sys-uname (~> 1.3)
|
|
36
|
-
cucumber-ci-environment (
|
|
37
|
-
cucumber-core (
|
|
38
|
-
cucumber-gherkin (>
|
|
39
|
-
cucumber-messages (>
|
|
40
|
-
cucumber-tag-expressions (>
|
|
36
|
+
cucumber-ci-environment (11.0.0)
|
|
37
|
+
cucumber-core (16.1.1)
|
|
38
|
+
cucumber-gherkin (> 36, < 40)
|
|
39
|
+
cucumber-messages (> 31, < 33)
|
|
40
|
+
cucumber-tag-expressions (> 6, < 9)
|
|
41
41
|
cucumber-cucumber-expressions (18.0.1)
|
|
42
42
|
bigdecimal
|
|
43
|
-
cucumber-gherkin (
|
|
44
|
-
cucumber-messages (
|
|
45
|
-
cucumber-html-formatter (
|
|
46
|
-
cucumber-messages (>
|
|
47
|
-
cucumber-messages (
|
|
43
|
+
cucumber-gherkin (37.0.1)
|
|
44
|
+
cucumber-messages (>= 31, < 32)
|
|
45
|
+
cucumber-html-formatter (22.3.0)
|
|
46
|
+
cucumber-messages (> 23, < 33)
|
|
47
|
+
cucumber-messages (31.2.0)
|
|
48
48
|
cucumber-tag-expressions (8.1.0)
|
|
49
49
|
date (3.5.1)
|
|
50
50
|
diff-lcs (1.6.2)
|
|
51
51
|
docile (1.4.1)
|
|
52
|
-
elapsed (0.2.
|
|
52
|
+
elapsed (0.2.2)
|
|
53
53
|
loog (~> 0.6)
|
|
54
54
|
tago (~> 0.1)
|
|
55
55
|
erb (6.0.1)
|
|
56
|
-
ffi (1.17.
|
|
57
|
-
ffi (1.17.
|
|
58
|
-
ffi (1.17.
|
|
59
|
-
ffi (1.17.
|
|
60
|
-
ffi (1.17.
|
|
61
|
-
ffi (1.17.
|
|
62
|
-
ffi (1.17.
|
|
56
|
+
ffi (1.17.3-aarch64-linux-gnu)
|
|
57
|
+
ffi (1.17.3-arm-linux-gnu)
|
|
58
|
+
ffi (1.17.3-arm64-darwin)
|
|
59
|
+
ffi (1.17.3-x64-mingw-ucrt)
|
|
60
|
+
ffi (1.17.3-x86-linux-gnu)
|
|
61
|
+
ffi (1.17.3-x86_64-darwin)
|
|
62
|
+
ffi (1.17.3-x86_64-linux-gnu)
|
|
63
63
|
hashdiff (1.2.1)
|
|
64
64
|
json (2.18.0)
|
|
65
65
|
language_server-protocol (3.17.0.5)
|
|
@@ -79,36 +79,36 @@ GEM
|
|
|
79
79
|
ruby-progressbar
|
|
80
80
|
multi_test (1.1.0)
|
|
81
81
|
net-ping (2.0.8)
|
|
82
|
-
nokogiri (1.
|
|
82
|
+
nokogiri (1.19.0)
|
|
83
83
|
mini_portile2 (~> 2.8.2)
|
|
84
84
|
racc (~> 1.4)
|
|
85
|
-
nokogiri (1.
|
|
85
|
+
nokogiri (1.19.0-aarch64-linux-gnu)
|
|
86
86
|
racc (~> 1.4)
|
|
87
|
-
nokogiri (1.
|
|
87
|
+
nokogiri (1.19.0-arm-linux-gnu)
|
|
88
88
|
racc (~> 1.4)
|
|
89
|
-
nokogiri (1.
|
|
89
|
+
nokogiri (1.19.0-arm64-darwin)
|
|
90
90
|
racc (~> 1.4)
|
|
91
|
-
nokogiri (1.
|
|
91
|
+
nokogiri (1.19.0-x64-mingw-ucrt)
|
|
92
92
|
racc (~> 1.4)
|
|
93
|
-
nokogiri (1.
|
|
93
|
+
nokogiri (1.19.0-x86_64-darwin)
|
|
94
94
|
racc (~> 1.4)
|
|
95
|
-
nokogiri (1.
|
|
95
|
+
nokogiri (1.19.0-x86_64-linux-gnu)
|
|
96
96
|
racc (~> 1.4)
|
|
97
97
|
parallel (1.27.0)
|
|
98
|
-
parser (3.3.10.
|
|
98
|
+
parser (3.3.10.1)
|
|
99
99
|
ast (~> 2.4.1)
|
|
100
100
|
racc
|
|
101
|
-
prism (1.
|
|
101
|
+
prism (1.8.0)
|
|
102
102
|
psych (5.3.1)
|
|
103
103
|
date
|
|
104
104
|
stringio
|
|
105
|
-
public_suffix (
|
|
105
|
+
public_suffix (7.0.2)
|
|
106
106
|
racc (1.8.1)
|
|
107
107
|
rainbow (3.1.1)
|
|
108
108
|
rake (13.3.1)
|
|
109
109
|
random-port (0.7.6)
|
|
110
110
|
tago (~> 0.0)
|
|
111
|
-
rdoc (7.0
|
|
111
|
+
rdoc (7.1.0)
|
|
112
112
|
erb
|
|
113
113
|
psych (>= 4.0.0)
|
|
114
114
|
tsort
|
|
@@ -125,9 +125,9 @@ GEM
|
|
|
125
125
|
rubocop-ast (>= 1.48.0, < 2.0)
|
|
126
126
|
ruby-progressbar (~> 1.7)
|
|
127
127
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
128
|
-
rubocop-ast (1.
|
|
128
|
+
rubocop-ast (1.49.0)
|
|
129
129
|
parser (>= 3.3.7.2)
|
|
130
|
-
prism (~> 1.
|
|
130
|
+
prism (~> 1.7)
|
|
131
131
|
rubocop-minitest (0.38.2)
|
|
132
132
|
lint_roller (~> 1.1)
|
|
133
133
|
rubocop (>= 1.75.0, < 2.0)
|
|
@@ -153,11 +153,11 @@ GEM
|
|
|
153
153
|
sys-uname (1.4.1)
|
|
154
154
|
ffi (~> 1.1)
|
|
155
155
|
memoist3 (~> 1.0.0)
|
|
156
|
-
tago (0.
|
|
156
|
+
tago (0.6.0)
|
|
157
157
|
tsort (0.2.0)
|
|
158
158
|
unicode-display_width (3.2.0)
|
|
159
159
|
unicode-emoji (~> 4.1)
|
|
160
|
-
unicode-emoji (4.
|
|
160
|
+
unicode-emoji (4.2.0)
|
|
161
161
|
w3c_validators (1.3.7)
|
|
162
162
|
json (>= 1.8)
|
|
163
163
|
nokogiri (~> 1.6)
|
data/lib/qbash.rb
CHANGED
|
@@ -67,6 +67,14 @@ module Kernel
|
|
|
67
67
|
# # Process will be terminated when block exits
|
|
68
68
|
# end
|
|
69
69
|
#
|
|
70
|
+
# == Changing Working Directory
|
|
71
|
+
#
|
|
72
|
+
# # Execute command in a specific directory
|
|
73
|
+
# files = qbash('ls -la', chdir: '/tmp')
|
|
74
|
+
#
|
|
75
|
+
# # Useful for commands that operate on the current directory
|
|
76
|
+
# qbash('git status', chdir: '/path/to/repo')
|
|
77
|
+
#
|
|
70
78
|
# For command with multiple arguments, you can use +Shellwords.escape()+ to
|
|
71
79
|
# properly escape each argument. Stderr automatically merges with stdout.
|
|
72
80
|
#
|
|
@@ -80,8 +88,10 @@ module Kernel
|
|
|
80
88
|
# @param [Array] accept List of accepted exit codes (accepts all if the list is +nil+)
|
|
81
89
|
# @param [Boolean] both If set to TRUE, the function returns an array +(stdout, code)+
|
|
82
90
|
# @param [Integer] level Logging level (use +Logger::DEBUG+, +Logger::INFO+, +Logger::WARN+, or +Logger::ERROR+)
|
|
91
|
+
# @param [String] chdir Directory to change to before running the command (or +nil+ to use current directory)
|
|
83
92
|
# @return [String] Everything that was printed to the +stdout+ by the command
|
|
84
|
-
def qbash(*cmd, opts: [], stdin: '', env: {}, log: Loog::NULL, accept: [0], both: false, level: Logger::DEBUG
|
|
93
|
+
def qbash(*cmd, opts: [], stdin: '', env: {}, log: Loog::NULL, accept: [0], both: false, level: Logger::DEBUG,
|
|
94
|
+
chdir: nil)
|
|
85
95
|
env.each { |k, v| raise "env[#{k}] is nil" if v.nil? }
|
|
86
96
|
cmd = cmd.reject { |a| a.nil? || (a.is_a?(String) && a.empty?) }.join(' ')
|
|
87
97
|
logit =
|
|
@@ -112,7 +122,8 @@ module Kernel
|
|
|
112
122
|
e = 1
|
|
113
123
|
start = Time.now
|
|
114
124
|
bash = ['/bin/bash'] + opts + ['-c', cmd]
|
|
115
|
-
|
|
125
|
+
popen = chdir.nil? ? [env, *bash] : [env, *bash, { chdir: }]
|
|
126
|
+
Open3.popen2e(*popen) do |sin, sout, ctrl|
|
|
116
127
|
pid = ctrl.pid
|
|
117
128
|
logit["+ #{cmd} /##{pid}"]
|
|
118
129
|
consume =
|
data/qbash.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
|
10
10
|
s.required_ruby_version = '>=3.2'
|
|
11
11
|
s.name = 'qbash'
|
|
12
|
-
s.version = '0.
|
|
12
|
+
s.version = '0.6.0'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Quick Executor of a BASH Command'
|
|
15
15
|
s.description =
|