qbash 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/actionlint.yml +1 -0
- data/.github/workflows/codecov.yml +3 -1
- data/.github/workflows/copyrights.yml +1 -0
- data/.github/workflows/markdown-lint.yml +1 -0
- data/.github/workflows/pdd.yml +2 -1
- data/.github/workflows/rake.yml +2 -2
- data/.github/workflows/xcop.yml +1 -0
- data/.github/workflows/yamllint.yml +1 -0
- data/.gitignore +1 -1
- data/.rubocop.yml +6 -0
- data/Gemfile +5 -3
- data/Gemfile.lock +85 -65
- data/Rakefile +1 -10
- data/lib/qbash.rb +18 -0
- data/qbash.gemspec +1 -1
- data/test/test_qbash.rb +25 -6
- 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: 591a7745f928f69d9111510c29aad5f71640b9ee143f0d61ae56c194563b47a8
|
4
|
+
data.tar.gz: 54f4ed6e09f65e51d308f09692be14e1b11046c25b9b16960ee82f75e813b239
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99461451f3a2461088d8b4fd396f28c61b1ad255b3118b77e11b8117dc31f19cc9802a225d286e16e3a0de8d12e8e37983290b788bc5a7b0da8b34fca8ded52f
|
7
|
+
data.tar.gz: 3d45686b23e8cbd75efd5041af8767fc059c82cde1a088a29ed6b7a1a0ab0591eb55897f9cb9e478d097645ff69af7cf42ac481e28de1aa173d1cf3951e32f98
|
@@ -25,6 +25,7 @@ name: codecov
|
|
25
25
|
- master
|
26
26
|
jobs:
|
27
27
|
codecov:
|
28
|
+
timeout-minutes: 15
|
28
29
|
runs-on: ubuntu-24.04
|
29
30
|
steps:
|
30
31
|
- uses: actions/checkout@v4
|
@@ -32,8 +33,9 @@ jobs:
|
|
32
33
|
with:
|
33
34
|
ruby-version: 3.3
|
34
35
|
bundler-cache: true
|
36
|
+
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
35
37
|
- run: bundle install
|
36
38
|
- run: bundle exec rake
|
37
|
-
- uses: codecov/codecov-action@
|
39
|
+
- uses: codecov/codecov-action@v5
|
38
40
|
with:
|
39
41
|
token: ${{ secrets.CODECOV_TOKEN }}
|
data/.github/workflows/pdd.yml
CHANGED
data/.github/workflows/rake.yml
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
# SOFTWARE.
|
20
20
|
---
|
21
21
|
name: rake
|
22
|
-
on:
|
22
|
+
'on':
|
23
23
|
push:
|
24
24
|
branches:
|
25
25
|
- master
|
@@ -28,7 +28,6 @@ on:
|
|
28
28
|
- master
|
29
29
|
jobs:
|
30
30
|
rake:
|
31
|
-
name: test
|
32
31
|
strategy:
|
33
32
|
matrix:
|
34
33
|
os: [ubuntu-24.04, macos-15]
|
@@ -40,5 +39,6 @@ jobs:
|
|
40
39
|
with:
|
41
40
|
ruby-version: ${{ matrix.ruby }}
|
42
41
|
bundler-cache: true
|
42
|
+
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
43
43
|
- run: bundle install
|
44
44
|
- run: bundle exec rake
|
data/.github/workflows/xcop.yml
CHANGED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -27,7 +27,13 @@ AllCops:
|
|
27
27
|
TargetRubyVersion: 3.2
|
28
28
|
SuggestExtensions: false
|
29
29
|
NewCops: enable
|
30
|
+
require:
|
31
|
+
- rubocop-minitest
|
32
|
+
- rubocop-performance
|
33
|
+
- rubocop-rake
|
30
34
|
|
35
|
+
Minitest/EmptyLineBeforeAssertionMethods:
|
36
|
+
Enabled: false
|
31
37
|
Metrics/ParameterLists:
|
32
38
|
Enabled: false
|
33
39
|
Style/GlobalVars:
|
data/Gemfile
CHANGED
@@ -23,16 +23,18 @@
|
|
23
23
|
source 'https://rubygems.org'
|
24
24
|
gemspec
|
25
25
|
|
26
|
-
gem 'cucumber', '9.2.
|
26
|
+
gem 'cucumber', '9.2.1', require: false
|
27
27
|
gem 'minitest', '5.25.4', require: false
|
28
28
|
gem 'minitest-reporters', '1.7.1', require: false
|
29
29
|
gem 'net-ping', '2.0.8', require: false
|
30
30
|
gem 'rake', '13.2.1', require: false
|
31
31
|
gem 'random-port', '~>0.0', require: false
|
32
32
|
gem 'rspec-rails', '7.1.0', require: false
|
33
|
-
gem 'rubocop', '1.
|
33
|
+
gem 'rubocop', '1.71.2', require: false
|
34
|
+
gem 'rubocop-minitest', '0.36.0', require: false
|
34
35
|
gem 'rubocop-performance', '1.23.1', require: false
|
35
|
-
gem 'rubocop-
|
36
|
+
gem 'rubocop-rake', '0.6.0', require: false
|
37
|
+
gem 'rubocop-rspec', '3.4.0', require: false
|
36
38
|
gem 'simplecov', '0.22.0', require: false
|
37
39
|
gem 'simplecov-cobertura', '2.1.0', require: false
|
38
40
|
gem 'w3c_validators', '1.3.7', require: false
|
data/Gemfile.lock
CHANGED
@@ -10,24 +10,23 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actionpack (
|
14
|
-
actionview (=
|
15
|
-
activesupport (=
|
13
|
+
actionpack (8.0.1)
|
14
|
+
actionview (= 8.0.1)
|
15
|
+
activesupport (= 8.0.1)
|
16
16
|
nokogiri (>= 1.8.5)
|
17
|
-
|
18
|
-
rack (>= 2.2.4, < 3.2)
|
17
|
+
rack (>= 2.2.4)
|
19
18
|
rack-session (>= 1.0.1)
|
20
19
|
rack-test (>= 0.6.3)
|
21
20
|
rails-dom-testing (~> 2.2)
|
22
21
|
rails-html-sanitizer (~> 1.6)
|
23
22
|
useragent (~> 0.16)
|
24
|
-
actionview (
|
25
|
-
activesupport (=
|
23
|
+
actionview (8.0.1)
|
24
|
+
activesupport (= 8.0.1)
|
26
25
|
builder (~> 3.1)
|
27
26
|
erubi (~> 1.11)
|
28
27
|
rails-dom-testing (~> 2.2)
|
29
28
|
rails-html-sanitizer (~> 1.6)
|
30
|
-
activesupport (
|
29
|
+
activesupport (8.0.1)
|
31
30
|
base64
|
32
31
|
benchmark (>= 0.3)
|
33
32
|
bigdecimal
|
@@ -39,6 +38,7 @@ GEM
|
|
39
38
|
minitest (>= 5.1)
|
40
39
|
securerandom (>= 0.3)
|
41
40
|
tzinfo (~> 2.0, >= 2.0.5)
|
41
|
+
uri (>= 0.13.1)
|
42
42
|
addressable (2.8.7)
|
43
43
|
public_suffix (>= 2.0.2, < 7.0)
|
44
44
|
ansi (1.5.0)
|
@@ -46,15 +46,15 @@ GEM
|
|
46
46
|
backtrace (0.4.0)
|
47
47
|
base64 (0.2.0)
|
48
48
|
benchmark (0.4.0)
|
49
|
-
bigdecimal (3.1.
|
49
|
+
bigdecimal (3.1.9)
|
50
50
|
builder (3.3.0)
|
51
|
-
concurrent-ruby (1.3.
|
52
|
-
connection_pool (2.
|
51
|
+
concurrent-ruby (1.3.5)
|
52
|
+
connection_pool (2.5.0)
|
53
53
|
crack (1.0.0)
|
54
54
|
bigdecimal
|
55
55
|
rexml
|
56
56
|
crass (1.0.6)
|
57
|
-
cucumber (9.2.
|
57
|
+
cucumber (9.2.1)
|
58
58
|
builder (~> 3.2)
|
59
59
|
cucumber-ci-environment (> 9, < 11)
|
60
60
|
cucumber-core (> 13, < 14)
|
@@ -75,39 +75,42 @@ GEM
|
|
75
75
|
bigdecimal
|
76
76
|
cucumber-gherkin (27.0.0)
|
77
77
|
cucumber-messages (>= 19.1.4, < 23)
|
78
|
-
cucumber-html-formatter (21.
|
79
|
-
cucumber-messages (> 19, <
|
78
|
+
cucumber-html-formatter (21.9.0)
|
79
|
+
cucumber-messages (> 19, < 28)
|
80
80
|
cucumber-messages (22.0.0)
|
81
|
-
cucumber-tag-expressions (6.1.
|
81
|
+
cucumber-tag-expressions (6.1.2)
|
82
|
+
date (3.4.1)
|
82
83
|
diff-lcs (1.5.1)
|
83
84
|
docile (1.4.1)
|
84
85
|
drb (2.2.1)
|
85
86
|
elapsed (0.0.1)
|
86
87
|
loog (> 0)
|
87
88
|
tago (> 0)
|
88
|
-
erubi (1.13.
|
89
|
-
ffi (1.17.
|
90
|
-
ffi (1.17.
|
91
|
-
ffi (1.17.
|
92
|
-
ffi (1.17.
|
93
|
-
ffi (1.17.
|
94
|
-
ffi (1.17.
|
95
|
-
ffi (1.17.
|
96
|
-
hashdiff (1.1.
|
97
|
-
i18n (1.14.
|
89
|
+
erubi (1.13.1)
|
90
|
+
ffi (1.17.1-aarch64-linux-gnu)
|
91
|
+
ffi (1.17.1-arm-linux-gnu)
|
92
|
+
ffi (1.17.1-arm64-darwin)
|
93
|
+
ffi (1.17.1-x64-mingw-ucrt)
|
94
|
+
ffi (1.17.1-x86-linux-gnu)
|
95
|
+
ffi (1.17.1-x86_64-darwin)
|
96
|
+
ffi (1.17.1-x86_64-linux-gnu)
|
97
|
+
hashdiff (1.1.2)
|
98
|
+
i18n (1.14.7)
|
98
99
|
concurrent-ruby (~> 1.0)
|
99
|
-
io-console (0.
|
100
|
-
irb (1.
|
100
|
+
io-console (0.8.0)
|
101
|
+
irb (1.15.1)
|
102
|
+
pp (>= 0.6.0)
|
101
103
|
rdoc (>= 4.0.0)
|
102
104
|
reline (>= 0.4.2)
|
103
105
|
json (2.9.1)
|
104
|
-
language_server-protocol (3.17.0.
|
105
|
-
logger (1.6.
|
106
|
-
loofah (2.
|
106
|
+
language_server-protocol (3.17.0.4)
|
107
|
+
logger (1.6.5)
|
108
|
+
loofah (2.24.0)
|
107
109
|
crass (~> 1.0.2)
|
108
110
|
nokogiri (>= 1.12.0)
|
109
111
|
loog (0.6.0)
|
110
112
|
mini_mime (1.1.5)
|
113
|
+
mini_portile2 (2.8.8)
|
111
114
|
minitest (5.25.4)
|
112
115
|
minitest-reporters (1.7.1)
|
113
116
|
ansi
|
@@ -116,45 +119,51 @@ GEM
|
|
116
119
|
ruby-progressbar
|
117
120
|
multi_test (1.1.0)
|
118
121
|
net-ping (2.0.8)
|
119
|
-
nokogiri (1.
|
122
|
+
nokogiri (1.18.2)
|
123
|
+
mini_portile2 (~> 2.8.2)
|
120
124
|
racc (~> 1.4)
|
121
|
-
nokogiri (1.
|
125
|
+
nokogiri (1.18.2-aarch64-linux-gnu)
|
122
126
|
racc (~> 1.4)
|
123
|
-
nokogiri (1.
|
127
|
+
nokogiri (1.18.2-arm-linux-gnu)
|
124
128
|
racc (~> 1.4)
|
125
|
-
nokogiri (1.
|
129
|
+
nokogiri (1.18.2-arm64-darwin)
|
126
130
|
racc (~> 1.4)
|
127
|
-
nokogiri (1.
|
131
|
+
nokogiri (1.18.2-x64-mingw-ucrt)
|
128
132
|
racc (~> 1.4)
|
129
|
-
nokogiri (1.
|
133
|
+
nokogiri (1.18.2-x86_64-darwin)
|
130
134
|
racc (~> 1.4)
|
131
|
-
nokogiri (1.
|
135
|
+
nokogiri (1.18.2-x86_64-linux-gnu)
|
132
136
|
racc (~> 1.4)
|
133
137
|
parallel (1.26.3)
|
134
|
-
parser (3.3.
|
138
|
+
parser (3.3.7.0)
|
135
139
|
ast (~> 2.4.1)
|
136
140
|
racc
|
137
|
-
|
141
|
+
pp (0.6.2)
|
142
|
+
prettyprint
|
143
|
+
prettyprint (0.2.0)
|
144
|
+
psych (5.2.3)
|
145
|
+
date
|
138
146
|
stringio
|
139
147
|
public_suffix (6.0.1)
|
140
148
|
racc (1.8.1)
|
141
|
-
rack (3.1.
|
142
|
-
rack-session (2.
|
149
|
+
rack (3.1.9)
|
150
|
+
rack-session (2.1.0)
|
151
|
+
base64 (>= 0.1.0)
|
143
152
|
rack (>= 3.0.0)
|
144
|
-
rack-test (2.
|
153
|
+
rack-test (2.2.0)
|
145
154
|
rack (>= 1.3)
|
146
|
-
rackup (2.2.
|
155
|
+
rackup (2.2.1)
|
147
156
|
rack (>= 3)
|
148
157
|
rails-dom-testing (2.2.0)
|
149
158
|
activesupport (>= 5.0.0)
|
150
159
|
minitest
|
151
160
|
nokogiri (>= 1.6)
|
152
|
-
rails-html-sanitizer (1.6.
|
161
|
+
rails-html-sanitizer (1.6.2)
|
153
162
|
loofah (~> 2.21)
|
154
|
-
nokogiri (
|
155
|
-
railties (
|
156
|
-
actionpack (=
|
157
|
-
activesupport (=
|
163
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
164
|
+
railties (8.0.1)
|
165
|
+
actionpack (= 8.0.1)
|
166
|
+
activesupport (= 8.0.1)
|
158
167
|
irb (~> 1.13)
|
159
168
|
rackup (>= 1.0.0)
|
160
169
|
rake (>= 12.2)
|
@@ -162,14 +171,14 @@ GEM
|
|
162
171
|
zeitwerk (~> 2.6)
|
163
172
|
rainbow (3.1.1)
|
164
173
|
rake (13.2.1)
|
165
|
-
random-port (0.7.
|
174
|
+
random-port (0.7.5)
|
166
175
|
tago (> 0)
|
167
|
-
rdoc (6.
|
176
|
+
rdoc (6.11.0)
|
168
177
|
psych (>= 4.0.0)
|
169
|
-
regexp_parser (2.
|
170
|
-
reline (0.
|
178
|
+
regexp_parser (2.10.0)
|
179
|
+
reline (0.6.0)
|
171
180
|
io-console (~> 0.5)
|
172
|
-
rexml (3.
|
181
|
+
rexml (3.4.0)
|
173
182
|
rspec-core (3.13.2)
|
174
183
|
rspec-support (~> 3.13.0)
|
175
184
|
rspec-expectations (3.13.3)
|
@@ -186,26 +195,31 @@ GEM
|
|
186
195
|
rspec-expectations (~> 3.13)
|
187
196
|
rspec-mocks (~> 3.13)
|
188
197
|
rspec-support (~> 3.13)
|
189
|
-
rspec-support (3.13.
|
190
|
-
rubocop (1.
|
198
|
+
rspec-support (3.13.2)
|
199
|
+
rubocop (1.71.2)
|
191
200
|
json (~> 2.3)
|
192
201
|
language_server-protocol (>= 3.17.0)
|
193
202
|
parallel (~> 1.10)
|
194
203
|
parser (>= 3.3.0.2)
|
195
204
|
rainbow (>= 2.2.2, < 4.0)
|
196
205
|
regexp_parser (>= 2.9.3, < 3.0)
|
197
|
-
rubocop-ast (>= 1.
|
206
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
198
207
|
ruby-progressbar (~> 1.7)
|
199
208
|
unicode-display_width (>= 2.4.0, < 4.0)
|
200
|
-
rubocop-ast (1.
|
209
|
+
rubocop-ast (1.38.0)
|
201
210
|
parser (>= 3.3.1.0)
|
211
|
+
rubocop-minitest (0.36.0)
|
212
|
+
rubocop (>= 1.61, < 2.0)
|
213
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
202
214
|
rubocop-performance (1.23.1)
|
203
215
|
rubocop (>= 1.48.1, < 2.0)
|
204
216
|
rubocop-ast (>= 1.31.1, < 2.0)
|
205
|
-
rubocop-
|
217
|
+
rubocop-rake (0.6.0)
|
218
|
+
rubocop (~> 1.0)
|
219
|
+
rubocop-rspec (3.4.0)
|
206
220
|
rubocop (~> 1.61)
|
207
221
|
ruby-progressbar (1.13.0)
|
208
|
-
securerandom (0.
|
222
|
+
securerandom (0.4.1)
|
209
223
|
simplecov (0.22.0)
|
210
224
|
docile (~> 1.1)
|
211
225
|
simplecov-html (~> 0.11)
|
@@ -216,14 +230,17 @@ GEM
|
|
216
230
|
simplecov-html (0.13.1)
|
217
231
|
simplecov_json_formatter (0.1.4)
|
218
232
|
stringio (3.1.2)
|
219
|
-
sys-uname (1.3.
|
233
|
+
sys-uname (1.3.1)
|
220
234
|
ffi (~> 1.1)
|
221
235
|
tago (0.0.2)
|
222
236
|
thor (1.3.2)
|
223
237
|
tzinfo (2.0.6)
|
224
238
|
concurrent-ruby (~> 1.0)
|
225
|
-
unicode-display_width (
|
226
|
-
|
239
|
+
unicode-display_width (3.1.4)
|
240
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
241
|
+
unicode-emoji (4.0.4)
|
242
|
+
uri (1.0.2)
|
243
|
+
useragent (0.16.11)
|
227
244
|
w3c_validators (1.3.7)
|
228
245
|
json (>= 1.8)
|
229
246
|
nokogiri (~> 1.6)
|
@@ -239,13 +256,14 @@ PLATFORMS
|
|
239
256
|
aarch64-linux
|
240
257
|
arm-linux
|
241
258
|
arm64-darwin
|
259
|
+
arm64-darwin-23
|
242
260
|
x64-mingw-ucrt
|
243
261
|
x86-linux
|
244
262
|
x86_64-darwin
|
245
263
|
x86_64-linux
|
246
264
|
|
247
265
|
DEPENDENCIES
|
248
|
-
cucumber (= 9.2.
|
266
|
+
cucumber (= 9.2.1)
|
249
267
|
minitest (= 5.25.4)
|
250
268
|
minitest-reporters (= 1.7.1)
|
251
269
|
net-ping (= 2.0.8)
|
@@ -253,9 +271,11 @@ DEPENDENCIES
|
|
253
271
|
rake (= 13.2.1)
|
254
272
|
random-port (~> 0.0)
|
255
273
|
rspec-rails (= 7.1.0)
|
256
|
-
rubocop (= 1.
|
274
|
+
rubocop (= 1.71.2)
|
275
|
+
rubocop-minitest (= 0.36.0)
|
257
276
|
rubocop-performance (= 1.23.1)
|
258
|
-
rubocop-
|
277
|
+
rubocop-rake (= 0.6.0)
|
278
|
+
rubocop-rspec (= 3.4.0)
|
259
279
|
simplecov (= 0.22.0)
|
260
280
|
simplecov-cobertura (= 2.1.0)
|
261
281
|
w3c_validators (= 1.3.7)
|
data/Rakefile
CHANGED
@@ -35,7 +35,7 @@ end
|
|
35
35
|
|
36
36
|
ENV['RACK_ENV'] = 'test'
|
37
37
|
|
38
|
-
task default: %i[clean test rubocop yard
|
38
|
+
task default: %i[clean test rubocop yard]
|
39
39
|
|
40
40
|
require 'rake/testtask'
|
41
41
|
desc 'Run all unit tests'
|
@@ -59,12 +59,3 @@ RuboCop::RakeTask.new(:rubocop) do |task|
|
|
59
59
|
task.fail_on_error = true
|
60
60
|
task.requires << 'rubocop-rspec'
|
61
61
|
end
|
62
|
-
|
63
|
-
task :copyright do
|
64
|
-
sh "grep -q -r '#{Date.today.strftime('%Y')}' \
|
65
|
-
--include '*.rb' \
|
66
|
-
--include '*.yml' \
|
67
|
-
--include '*.txt' \
|
68
|
-
--include 'Rakefile' \
|
69
|
-
."
|
70
|
-
end
|
data/lib/qbash.rb
CHANGED
@@ -89,6 +89,24 @@ module Kernel
|
|
89
89
|
sin.write(stdin)
|
90
90
|
sin.close
|
91
91
|
if block_given?
|
92
|
+
Thread.new do
|
93
|
+
until sout.closed?
|
94
|
+
begin
|
95
|
+
ln = sout.gets
|
96
|
+
rescue IOError => e
|
97
|
+
ln = Backtrace.new(e).to_s
|
98
|
+
end
|
99
|
+
ln = "##{thr.pid}: #{ln}"
|
100
|
+
if log.nil?
|
101
|
+
# no logging
|
102
|
+
elsif log.respond_to?(mtd)
|
103
|
+
log.__send__(mtd, ln)
|
104
|
+
else
|
105
|
+
log.print("#{ln}\n")
|
106
|
+
end
|
107
|
+
buf += ln
|
108
|
+
end
|
109
|
+
end
|
92
110
|
yield thr.pid
|
93
111
|
else
|
94
112
|
until sout.eof?
|
data/qbash.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
27
27
|
s.required_ruby_version = '>=3.2'
|
28
28
|
s.name = 'qbash'
|
29
|
-
s.version = '0.3.
|
29
|
+
s.version = '0.3.1'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Quick Executor of a BASH Command'
|
32
32
|
s.description =
|
data/test/test_qbash.rb
CHANGED
@@ -36,7 +36,7 @@ class TestQbash < Minitest::Test
|
|
36
36
|
def test_basic_run
|
37
37
|
Dir.mktmpdir do |home|
|
38
38
|
qbash("cd #{Shellwords.escape(home)}; echo $FOO | cat > a.txt", env: { 'FOO' => '42' })
|
39
|
-
|
39
|
+
assert_path_exists(File.join(home, 'a.txt'))
|
40
40
|
assert_equal("42\n", File.read(File.join(home, 'a.txt')))
|
41
41
|
end
|
42
42
|
end
|
@@ -71,7 +71,7 @@ class TestQbash < Minitest::Test
|
|
71
71
|
Dir.mktmpdir do |home|
|
72
72
|
f = File.join(home, 'a b c.txt')
|
73
73
|
qbash("cat > #{Shellwords.escape(f)}", stdin: 'hello')
|
74
|
-
|
74
|
+
assert_path_exists(f)
|
75
75
|
assert_equal('hello', File.read(f))
|
76
76
|
end
|
77
77
|
end
|
@@ -82,12 +82,12 @@ class TestQbash < Minitest::Test
|
|
82
82
|
|
83
83
|
def test_with_error
|
84
84
|
Dir.mktmpdir do |home|
|
85
|
-
assert_raises { qbash("cat #{Shellwords.escape(File.join(home, 'b.txt'))}") }
|
85
|
+
assert_raises(StandardError) { qbash("cat #{Shellwords.escape(File.join(home, 'b.txt'))}") }
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
def test_fails_when_nil_env
|
90
|
-
assert_raises { qbash('echo hi', env: { a: nil }) }
|
90
|
+
assert_raises(StandardError) { qbash('echo hi', env: { a: nil }) }
|
91
91
|
end
|
92
92
|
|
93
93
|
def test_ignore_errors
|
@@ -104,11 +104,30 @@ class TestQbash < Minitest::Test
|
|
104
104
|
end.join
|
105
105
|
end
|
106
106
|
|
107
|
+
def test_logs_in_background
|
108
|
+
stdout = nil
|
109
|
+
buf = Loog::Buffer.new
|
110
|
+
Dir.mktmpdir do |home|
|
111
|
+
flag = File.join(home, 'started.txt')
|
112
|
+
Thread.new do
|
113
|
+
stdout =
|
114
|
+
qbash("while true; do date; touch #{Shellwords.escape(flag)}; sleep 0.001; done", log: buf) do |pid|
|
115
|
+
loop { break if File.exist?(flag) }
|
116
|
+
Process.kill('KILL', pid)
|
117
|
+
end
|
118
|
+
end.join
|
119
|
+
end
|
120
|
+
refute_empty(buf.to_s)
|
121
|
+
refute_empty(stdout)
|
122
|
+
refute_includes(stdout, "\n\n")
|
123
|
+
refute_includes(buf.to_s, "\n\n")
|
124
|
+
end
|
125
|
+
|
107
126
|
def test_with_both
|
108
127
|
Dir.mktmpdir do |home|
|
109
128
|
stdout, code = qbash("cat #{Shellwords.escape(File.join(home, 'foo.txt'))}", accept: nil, both: true)
|
110
|
-
|
111
|
-
|
129
|
+
assert_predicate(code, :positive?)
|
130
|
+
refute_empty(stdout)
|
112
131
|
end
|
113
132
|
end
|
114
133
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qbash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|