rspec-interactive 0.9.9 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -8
- data/bin/rspec-interactive +2 -2
- data/lib/rspec-interactive/version.rb +1 -1
- data/lib/rspec-interactive.rb +58 -30
- data/rspec-interactive.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d723a8386eb4ed50df0bde9d90efacb2a8d6472f06faefa711afca46bdd87ae5
|
4
|
+
data.tar.gz: 79c582d886cc31909d7f43c46ec5f9cfffdc8d8f3f9371e85d4e15d496c9cf43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2bf91dd9111564260b331113842d0fc39991908f8e7707a91589ce6ddaee5ece21916f1aee89c70719cbb0da7854b668dca998f4caa17f488d6f8097e705d81
|
7
|
+
data.tar.gz: 3d24e2e9c3b7b17f87dd56252346b94e78da69abf023889d23b8e89258c8970ad239aebb91f6e507d0dd441a252636240147d70fcfb7a4a0fe93259be6a22fea
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-interactive (0.9.
|
5
|
-
listen
|
4
|
+
rspec-interactive (0.9.11)
|
6
5
|
pry
|
7
6
|
rspec-core
|
8
7
|
rspec-teamcity (= 1.0.0)
|
@@ -14,9 +13,6 @@ GEM
|
|
14
13
|
diff-lcs (1.4.4)
|
15
14
|
ffi (1.15.5)
|
16
15
|
ffi (1.15.5-java)
|
17
|
-
listen (3.7.1)
|
18
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
19
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
20
16
|
method_source (1.0.0)
|
21
17
|
pry (0.14.1)
|
22
18
|
coderay (~> 1.1)
|
@@ -25,9 +21,6 @@ GEM
|
|
25
21
|
coderay (~> 1.1)
|
26
22
|
method_source (~> 1.0)
|
27
23
|
spoon (~> 0.0)
|
28
|
-
rb-fsevent (0.11.1)
|
29
|
-
rb-inotify (0.10.1)
|
30
|
-
ffi (~> 1.0)
|
31
24
|
rspec (3.9.0)
|
32
25
|
rspec-core (~> 3.9.0)
|
33
26
|
rspec-expectations (~> 3.9.0)
|
data/bin/rspec-interactive
CHANGED
@@ -5,7 +5,7 @@ require 'rspec-interactive'
|
|
5
5
|
|
6
6
|
@options = {
|
7
7
|
server: true,
|
8
|
-
|
8
|
+
port: RSpec::Interactive::DEFAULT_PORT
|
9
9
|
}
|
10
10
|
|
11
11
|
parser = OptionParser.new do |opts|
|
@@ -26,4 +26,4 @@ parser = OptionParser.new do |opts|
|
|
26
26
|
|
27
27
|
end.parse!
|
28
28
|
|
29
|
-
RSpec::Interactive.start(config_file: @options[:config_file], server: @options[:server], port: @options[:
|
29
|
+
RSpec::Interactive.start(config_file: @options[:config_file], server: @options[:server], port: @options[:port])
|
data/lib/rspec-interactive.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'find'
|
1
2
|
require 'json'
|
2
|
-
require 'listen'
|
3
3
|
require 'pry'
|
4
4
|
require 'readline'
|
5
5
|
require 'rspec/core'
|
6
|
+
require 'set'
|
6
7
|
require 'shellwords'
|
7
8
|
require 'socket'
|
8
9
|
require 'teamcity/spec/runner/formatter/teamcity/formatter'
|
@@ -47,7 +48,6 @@ module RSpec
|
|
47
48
|
@history_file = history_file
|
48
49
|
@updated_files = []
|
49
50
|
@stty_save = %x`stty -g`.chomp
|
50
|
-
@file_change_mutex = Mutex.new
|
51
51
|
@rspec_mutex = Mutex.new
|
52
52
|
@output_stream = output_stream
|
53
53
|
@input_stream = input_stream
|
@@ -60,12 +60,19 @@ module RSpec
|
|
60
60
|
check_rails
|
61
61
|
maybe_trap_interrupt
|
62
62
|
configure_pry
|
63
|
+
configure_watched_files
|
63
64
|
|
64
65
|
@startup_thread = Thread.start do
|
65
66
|
Thread.current.report_on_exception = false
|
67
|
+
|
66
68
|
if server
|
67
69
|
@server_thread = Thread.start do
|
68
|
-
|
70
|
+
begin
|
71
|
+
server = TCPServer.new port
|
72
|
+
rescue StandardError => e
|
73
|
+
log_exception(@output_stream, e)
|
74
|
+
exit 1
|
75
|
+
end
|
69
76
|
|
70
77
|
while true
|
71
78
|
break unless client = server.accept
|
@@ -90,14 +97,15 @@ module RSpec
|
|
90
97
|
@startup_output = StringOutput.new
|
91
98
|
output = ThreadedOutput.new(thread_map: { Thread.current => @startup_output }, default: @output_stream)
|
92
99
|
|
100
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
93
101
|
Stdio.capture(stdout: output, stderr: output) do
|
94
102
|
@config_cache.record_configuration { @configuration.configure_rspec.call }
|
95
|
-
start_file_watcher
|
96
103
|
end
|
104
|
+
finish = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
105
|
+
@startup_duration = (finish - start).round
|
97
106
|
end
|
98
107
|
|
99
108
|
Pry.start
|
100
|
-
@listener.stop if @listener
|
101
109
|
@server_thread.exit if @server_thread
|
102
110
|
@startup_thread.exit if @startup_thread
|
103
111
|
0
|
@@ -132,18 +140,6 @@ module RSpec
|
|
132
140
|
end
|
133
141
|
end
|
134
142
|
|
135
|
-
def self.start_file_watcher
|
136
|
-
return if @configuration.watch_dirs.empty?
|
137
|
-
|
138
|
-
# Only polling seems to work in Docker.
|
139
|
-
@listener = Listen.to(*@configuration.watch_dirs, only: /\.rb$/, force_polling: true) do |modified, added|
|
140
|
-
@file_change_mutex.synchronize do
|
141
|
-
@updated_files.concat(added + modified)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
@listener.start
|
145
|
-
end
|
146
|
-
|
147
143
|
def self.configure_pry
|
148
144
|
# Set up IO.
|
149
145
|
Pry.config.input = Readline
|
@@ -158,18 +154,15 @@ module RSpec
|
|
158
154
|
end
|
159
155
|
|
160
156
|
def self.refresh(output: @output_stream)
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
@configuration.on_class_load.call(tp.self)
|
166
|
-
end
|
167
|
-
trace.enable
|
168
|
-
load filename
|
169
|
-
trace.disable
|
170
|
-
output.puts
|
157
|
+
get_updated_files.each do |filename|
|
158
|
+
output.puts "changed: #{filename}"
|
159
|
+
trace = TracePoint.new(:class) do |tp|
|
160
|
+
@configuration.on_class_load.call(tp.self)
|
171
161
|
end
|
172
|
-
|
162
|
+
trace.enable
|
163
|
+
load filename
|
164
|
+
trace.disable
|
165
|
+
output.puts
|
173
166
|
end
|
174
167
|
@configuration.refresh.call
|
175
168
|
end
|
@@ -304,13 +297,23 @@ module RSpec
|
|
304
297
|
def self.await_startup(output: @output_stream)
|
305
298
|
return true unless @startup_thread
|
306
299
|
|
300
|
+
waited = false
|
307
301
|
if @startup_thread.alive?
|
308
302
|
output.puts 'waiting for configure_rspec...'
|
303
|
+
waited = true
|
309
304
|
end
|
310
305
|
|
311
306
|
begin
|
312
307
|
@startup_thread.join
|
313
308
|
@startup_thread = nil
|
309
|
+
if waited
|
310
|
+
if @startup_duration == 1
|
311
|
+
output.puts("configure_rspec took 1 second")
|
312
|
+
else
|
313
|
+
output.puts("configure_rspec took #{@startup_duration} seconds")
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
314
317
|
print_startup_output(output: output)
|
315
318
|
true
|
316
319
|
rescue Interrupt
|
@@ -329,10 +332,35 @@ module RSpec
|
|
329
332
|
end
|
330
333
|
|
331
334
|
def self.print_startup_output(output: @output_stream)
|
332
|
-
return if @startup_output.nil?
|
335
|
+
return if @startup_output.nil?
|
333
336
|
|
334
|
-
|
337
|
+
unless @startup_output.string.empty?
|
338
|
+
output.puts(@startup_output.string)
|
339
|
+
end
|
335
340
|
@startup_output = nil
|
336
341
|
end
|
342
|
+
|
343
|
+
def self.configure_watched_files
|
344
|
+
@watched_files = get_watched_files
|
345
|
+
end
|
346
|
+
|
347
|
+
def self.get_watched_files
|
348
|
+
return Set.new if @configuration.watch_dirs.empty?
|
349
|
+
entries = Find.find(*@configuration.watch_dirs).flat_map do |file|
|
350
|
+
if FileTest.file?(file)
|
351
|
+
[[file, File.mtime(file).to_i]]
|
352
|
+
else
|
353
|
+
[]
|
354
|
+
end
|
355
|
+
end
|
356
|
+
entries.to_set
|
357
|
+
end
|
358
|
+
|
359
|
+
def self.get_updated_files
|
360
|
+
new_watched_files = get_watched_files
|
361
|
+
difference = new_watched_files - @watched_files
|
362
|
+
@watched_files = new_watched_files
|
363
|
+
difference.map(&:first)
|
364
|
+
end
|
337
365
|
end
|
338
366
|
end
|
data/rspec-interactive.gemspec
CHANGED
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.12
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.0.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: listen
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: pry
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|