rspec-interactive 0.9.7 → 0.9.8
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 +1 -1
- data/lib/rspec-interactive/client_output.rb +7 -0
- data/lib/rspec-interactive/stdio.rb +1 -40
- data/lib/rspec-interactive/version.rb +1 -1
- data/lib/rspec-interactive.rb +64 -43
- data/runner/rspec-interactive-run +8 -4
- 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: 895c315e10777f7d94c8efdf005129bb532463b31d764af1ddd079692b3e0e62
|
4
|
+
data.tar.gz: 264d523cfc32ffab312ef3d9323611c05f00d851d755d5cf53735680eac0ce4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47ca24fe9e49e7ea070c62b3786d72232cb52eabc2faac4777b913099c515a4cb9a0eaeb2515ab204637c344824461fcfdc6e3a460082ca1384bf57d2e04e773
|
7
|
+
data.tar.gz: f7d35eb450b116bb275eac5eaf729d37af936464e18ce9015d3bea953b6204517212299c923eb9e114182b120df3ad3868112be716bd9bd20d6de2c2c8c6326d
|
data/Gemfile.lock
CHANGED
@@ -1,52 +1,13 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Interactive
|
3
3
|
class Stdio
|
4
|
-
def self.
|
4
|
+
def self.capture(stdout:, stderr:)
|
5
5
|
old_stdout, old_stderr = $stdout, $stderr
|
6
6
|
$stdout, $stderr = stdout, stderr
|
7
7
|
yield
|
8
8
|
ensure
|
9
9
|
$stdout, $stderr = old_stdout, old_stderr
|
10
10
|
end
|
11
|
-
|
12
|
-
def self.capture(stdout:, stderr:)
|
13
|
-
raise ArgumentError, 'missing block' unless block_given?
|
14
|
-
|
15
|
-
old_stdout, old_stderr = STDOUT.dup, STDERR.dup
|
16
|
-
|
17
|
-
IO.pipe do |stdout_read, stdout_write|
|
18
|
-
IO.pipe do |stderr_read, stderr_write|
|
19
|
-
STDOUT.reopen(stdout_write)
|
20
|
-
STDERR.reopen(stderr_write)
|
21
|
-
|
22
|
-
stdout_write.close
|
23
|
-
stderr_write.close
|
24
|
-
|
25
|
-
stdout_thread = Thread.new do
|
26
|
-
while line = stdout_read.gets do
|
27
|
-
stdout.print(line)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
stderr_thread = Thread.new do
|
32
|
-
while line = stderr_read.gets do
|
33
|
-
stderr.print(line)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
begin
|
38
|
-
yield
|
39
|
-
ensure
|
40
|
-
# TODO: should the threads be killed here?
|
41
|
-
STDOUT.reopen old_stdout
|
42
|
-
STDERR.reopen old_stderr
|
43
|
-
end
|
44
|
-
|
45
|
-
stdout_thread.join
|
46
|
-
stderr_thread.join
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
11
|
end
|
51
12
|
end
|
52
13
|
end
|
data/lib/rspec-interactive.rb
CHANGED
@@ -61,9 +61,6 @@ module RSpec
|
|
61
61
|
configure_pry
|
62
62
|
|
63
63
|
@startup_thread = Thread.start do
|
64
|
-
@config_cache.record_configuration { @configuration.configure_rspec.call }
|
65
|
-
start_file_watcher
|
66
|
-
|
67
64
|
if server
|
68
65
|
@server_thread = Thread.start do
|
69
66
|
server = TCPServer.new port
|
@@ -76,11 +73,15 @@ module RSpec
|
|
76
73
|
end
|
77
74
|
end
|
78
75
|
end
|
76
|
+
|
77
|
+
@config_cache.record_configuration { @configuration.configure_rspec.call }
|
78
|
+
start_file_watcher
|
79
79
|
end
|
80
80
|
|
81
81
|
Pry.start
|
82
82
|
@listener.stop if @listener
|
83
83
|
@server_thread.exit if @server_thread
|
84
|
+
@startup_thread.exit if @startup_thread
|
84
85
|
0
|
85
86
|
end
|
86
87
|
|
@@ -177,40 +178,52 @@ module RSpec
|
|
177
178
|
end
|
178
179
|
|
179
180
|
def self.rspec(args)
|
180
|
-
@
|
181
|
+
@command_mutex.synchronize do
|
182
|
+
begin
|
183
|
+
@runner = RSpec::Interactive::Runner.new(parse_args(args))
|
181
184
|
|
182
|
-
|
185
|
+
refresh
|
183
186
|
|
184
|
-
|
185
|
-
|
187
|
+
# Stop saving history in case a new Pry session is started for debugging.
|
188
|
+
Pry.config.history_save = false
|
186
189
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
190
|
+
# RSpec::Interactive-specific RSpec configuration
|
191
|
+
RSpec.configure do |config|
|
192
|
+
config.error_stream = @error_stream
|
193
|
+
config.output_stream = @output_stream
|
194
|
+
config.start_time = RSpec::Core::Time.now
|
195
|
+
end
|
193
196
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
197
|
+
# Run.
|
198
|
+
@runner.run
|
199
|
+
ensure
|
200
|
+
@runner = nil
|
198
201
|
|
199
|
-
|
200
|
-
|
202
|
+
# Reenable history
|
203
|
+
Pry.config.history_save = true
|
201
204
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
205
|
+
# Reset
|
206
|
+
RSpec.clear_examples
|
207
|
+
RSpec.reset
|
208
|
+
@config_cache.replay_configuration
|
209
|
+
end
|
210
|
+
end
|
206
211
|
end
|
207
212
|
|
208
213
|
def self.rspec_for_server(client, args)
|
209
214
|
@command_mutex.synchronize do
|
210
|
-
output = ClientOutput.new(client)
|
211
215
|
disable_pry = ENV['DISABLE_PRY']
|
216
|
+
output = ClientOutput.new(client)
|
217
|
+
|
218
|
+
ENV['TEAMCITY_RAKE_RUNNER_DEBUG_OUTPUT_CAPTURER_ENABLED'] = 'false'
|
219
|
+
Rake::TeamCity::RunnerCommon.class_variable_set(:@@original_stdout, output)
|
220
|
+
|
221
|
+
Stdio.capture(
|
222
|
+
stdout: output,
|
223
|
+
stderr: output) do
|
224
|
+
|
225
|
+
await_startup(output: output)
|
212
226
|
|
213
|
-
Stdio.capture(stdout: output, stderr: output) do
|
214
227
|
# Prevent the debugger from being used. The server isn't interactive.
|
215
228
|
ENV['DISABLE_PRY'] = 'true'
|
216
229
|
|
@@ -220,8 +233,8 @@ module RSpec
|
|
220
233
|
|
221
234
|
# RSpec::Interactive-specific RSpec configuration
|
222
235
|
RSpec.configure do |config|
|
223
|
-
config.error_stream =
|
224
|
-
config.output_stream =
|
236
|
+
config.error_stream = output
|
237
|
+
config.output_stream = output
|
225
238
|
config.start_time = RSpec::Core::Time.now
|
226
239
|
end
|
227
240
|
|
@@ -238,13 +251,17 @@ module RSpec
|
|
238
251
|
|
239
252
|
# Run.
|
240
253
|
@runner.run
|
254
|
+
rescue Errno::EPIPE => e
|
255
|
+
# Don't care.
|
241
256
|
ensure
|
242
|
-
@runner = nil
|
243
257
|
ENV['DISABLE_PRY'] = disable_pry
|
258
|
+
@runner = nil
|
244
259
|
|
245
260
|
# Reset
|
246
261
|
RSpec.clear_examples
|
247
262
|
RSpec.reset
|
263
|
+
|
264
|
+
await_startup(output: output)
|
248
265
|
@config_cache.replay_configuration
|
249
266
|
end
|
250
267
|
end
|
@@ -259,22 +276,26 @@ module RSpec
|
|
259
276
|
end
|
260
277
|
|
261
278
|
def self.eval(line, options, &block)
|
262
|
-
if line.nil?
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
279
|
+
return yield if line.nil? # EOF
|
280
|
+
return yield if line.empty? # blank line
|
281
|
+
|
282
|
+
begin
|
283
|
+
await_startup
|
284
|
+
rescue Interrupt
|
285
|
+
@output_stream.puts
|
286
|
+
return true
|
287
|
+
end
|
288
|
+
|
289
|
+
yield
|
290
|
+
end
|
291
|
+
|
292
|
+
def self.await_startup(output: @output_stream)
|
293
|
+
if @startup_thread
|
294
|
+
if @startup_thread.alive?
|
295
|
+
output.puts 'waiting for configure_rspec...'
|
277
296
|
end
|
297
|
+
@startup_thread.join
|
298
|
+
@startup_thread = nil
|
278
299
|
end
|
279
300
|
end
|
280
301
|
end
|
@@ -24,8 +24,12 @@ parser = OptionParser.new do |opts|
|
|
24
24
|
end.parse
|
25
25
|
|
26
26
|
server = TCPSocket.open(@options[:host], @options[:port])
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
begin
|
28
|
+
server.puts ARGV.map{ |arg| Shellwords.escape arg }.join(' ')
|
29
|
+
server.close_write
|
30
|
+
while response = server.gets do
|
31
|
+
puts response
|
32
|
+
end
|
33
|
+
ensure
|
34
|
+
server.close
|
30
35
|
end
|
31
|
-
server.close
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Dower
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|