ruflet 0.0.21 → 0.0.22

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.
@@ -111,7 +111,29 @@ module Ruflet
111
111
  end
112
112
 
113
113
  def watched_files
114
- files = Dir.glob(File.join(@watch_root, "**", "*.rb")).reject { |path| excluded_path?(path) }
114
+ files = []
115
+ directories = [@watch_root]
116
+ until directories.empty?
117
+ directory = directories.pop
118
+ begin
119
+ Dir.each_child(directory) do |name|
120
+ # Prune before descending: generated Flutter/build trees can
121
+ # contain thousands of files and are never reload inputs.
122
+ next if name.start_with?(".") || EXCLUDED_DIRECTORIES.include?(name)
123
+
124
+ path = File.join(directory, name)
125
+ if File.directory?(path)
126
+ directories << path unless File.symlink?(path)
127
+ elsif name.end_with?(".rb") && File.file?(path)
128
+ files << path
129
+ end
130
+ end
131
+ rescue Errno::ENOENT, Errno::ENOTDIR, Errno::EACCES
132
+ # Editors/build tools may remove a directory during a snapshot.
133
+ next
134
+ end
135
+ end
136
+ files.sort!
115
137
  files << @script unless files.include?(@script) || !File.file?(@script)
116
138
  files
117
139
  end
@@ -158,15 +180,6 @@ module Ruflet
158
180
  $LOADED_FEATURES.reject! { |feature| watched.key?(feature) }
159
181
  end
160
182
 
161
- def excluded_path?(path)
162
- relative = path.delete_prefix("#{@watch_root}#{File::SEPARATOR}")
163
- return false if relative == path
164
-
165
- relative.split(File::SEPARATOR).any? do |component|
166
- component.start_with?(".") || EXCLUDED_DIRECTORIES.include?(component)
167
- end
168
- end
169
-
170
183
  def file_snapshot
171
184
  snapshot = {}
172
185
  watched_files.each do |path|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ruflet
4
- VERSION = "0.0.21" unless const_defined?(:VERSION)
4
+ VERSION = "0.0.22" unless const_defined?(:VERSION)
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruflet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - AdamMusa