rspec-interactive 0.9.9 → 0.9.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c87a284feb4bf76bac68cda8cbe5703a66f04a856c8e2aed9e27d30b89e2654e
4
- data.tar.gz: 9336d2bff3ba1973921f8d7ba6a36d88bc11d4acd1c2b2ee86d7c47cb58d0356
3
+ metadata.gz: 1e00d8b9955bf056a3967733d54b89fdece90829b006b7d831de803670e33295
4
+ data.tar.gz: a5494e1160b97aa0b6c3e883e8457c5a6e6c2c54df1f26cd4d96c1ef15a4bbee
5
5
  SHA512:
6
- metadata.gz: 36afe559f97bc7cdee9e6833655f23e6092004b800e53beed28099afb8db6ce5511bc8177c9cc648ffc0a558bd221ca2ff13c5ff44e76132c20af99b30281fda
7
- data.tar.gz: '097084b7f1fec026f08433a8d12d56997b83a8deb8852026fc04dc1f3e7ec5410433e0758b374724cb2b5450f7b5be4e4db2d9953241a7bbd703f610f032e6ef'
6
+ metadata.gz: be9f403faf9fbfa42e38b0a07c70a4a338bc45cc6d9dc679e262653d3bc0a72d4ee1e15341b1693db3b51b0d2436da71b54525d22066fddd02d71a658c3ffb04
7
+ data.tar.gz: 0f9c77f7d09b008164bf802fa5507b46d6bb43de0d37e5b8aadc414751d919dc9347bf37262b65503e617259e9414a41d6c2e8fa082f77c8328790177b21fad0
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-interactive (0.9.8)
5
- listen
4
+ rspec-interactive (0.9.9)
6
5
  pry
7
6
  rspec-core
8
7
  rspec-teamcity (= 1.0.0)
@@ -12,11 +11,7 @@ GEM
12
11
  specs:
13
12
  coderay (1.1.3)
14
13
  diff-lcs (1.4.4)
15
- ffi (1.15.5)
16
14
  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
15
  method_source (1.0.0)
21
16
  pry (0.14.1)
22
17
  coderay (~> 1.1)
@@ -25,9 +20,6 @@ GEM
25
20
  coderay (~> 1.1)
26
21
  method_source (~> 1.0)
27
22
  spoon (~> 0.0)
28
- rb-fsevent (0.11.1)
29
- rb-inotify (0.10.1)
30
- ffi (~> 1.0)
31
23
  rspec (3.9.0)
32
24
  rspec-core (~> 3.9.0)
33
25
  rspec-expectations (~> 3.9.0)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Interactive
5
- VERSION = "0.9.9"
5
+ VERSION = "0.9.10"
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
+ require 'find'
1
2
  require 'json'
2
- require 'listen'
3
3
  require 'pry'
4
4
  require 'readline'
5
5
  require 'rspec/core'
@@ -47,7 +47,6 @@ module RSpec
47
47
  @history_file = history_file
48
48
  @updated_files = []
49
49
  @stty_save = %x`stty -g`.chomp
50
- @file_change_mutex = Mutex.new
51
50
  @rspec_mutex = Mutex.new
52
51
  @output_stream = output_stream
53
52
  @input_stream = input_stream
@@ -60,6 +59,7 @@ module RSpec
60
59
  check_rails
61
60
  maybe_trap_interrupt
62
61
  configure_pry
62
+ configure_watched_files
63
63
 
64
64
  @startup_thread = Thread.start do
65
65
  Thread.current.report_on_exception = false
@@ -92,12 +92,10 @@ module RSpec
92
92
 
93
93
  Stdio.capture(stdout: output, stderr: output) do
94
94
  @config_cache.record_configuration { @configuration.configure_rspec.call }
95
- start_file_watcher
96
95
  end
97
96
  end
98
97
 
99
98
  Pry.start
100
- @listener.stop if @listener
101
99
  @server_thread.exit if @server_thread
102
100
  @startup_thread.exit if @startup_thread
103
101
  0
@@ -132,18 +130,6 @@ module RSpec
132
130
  end
133
131
  end
134
132
 
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
133
  def self.configure_pry
148
134
  # Set up IO.
149
135
  Pry.config.input = Readline
@@ -158,18 +144,15 @@ module RSpec
158
144
  end
159
145
 
160
146
  def self.refresh(output: @output_stream)
161
- @file_change_mutex.synchronize do
162
- @updated_files.uniq.each do |filename|
163
- output.puts "changed: #{filename}"
164
- trace = TracePoint.new(:class) do |tp|
165
- @configuration.on_class_load.call(tp.self)
166
- end
167
- trace.enable
168
- load filename
169
- trace.disable
170
- output.puts
147
+ get_updated_files.each do |filename|
148
+ output.puts "changed: #{filename}"
149
+ trace = TracePoint.new(:class) do |tp|
150
+ @configuration.on_class_load.call(tp.self)
171
151
  end
172
- @updated_files.clear
152
+ trace.enable
153
+ load filename
154
+ trace.disable
155
+ output.puts
173
156
  end
174
157
  @configuration.refresh.call
175
158
  end
@@ -334,5 +317,28 @@ module RSpec
334
317
  output.puts(@startup_output.string)
335
318
  @startup_output = nil
336
319
  end
320
+
321
+ def self.configure_watched_files
322
+ @watched_files = get_watched_files
323
+ end
324
+
325
+ def self.get_watched_files
326
+ return Set.new if @configuration.watch_dirs.empty?
327
+ entries = Find.find(*@configuration.watch_dirs).flat_map do |file|
328
+ if FileTest.file?(file)
329
+ [[file, File.mtime(file).to_i]]
330
+ else
331
+ []
332
+ end
333
+ end
334
+ entries.to_set
335
+ end
336
+
337
+ def self.get_updated_files
338
+ new_watched_files = get_watched_files
339
+ difference = new_watched_files - @watched_files
340
+ @watched_files = new_watched_files
341
+ difference.map(&:first)
342
+ end
337
343
  end
338
344
  end
@@ -27,6 +27,5 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_dependency 'rspec-core'
29
29
  spec.add_dependency 'rspec-teamcity', '1.0.0'
30
- spec.add_dependency 'listen'
31
30
  spec.add_dependency 'pry'
32
31
  end
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.9
4
+ version: 0.9.10
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-27 00:00:00.000000000 Z
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