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.
- checksums.yaml +4 -4
- data/README.md +30 -2
- data/lib/ruflet/cli/build_command.rb +1482 -86
- data/lib/ruflet/cli/new_command.rb +81 -17
- data/lib/ruflet/cli/run_command.rb +279 -39
- data/lib/ruflet/cli.rb +7 -2
- data/lib/ruflet/hot_reload.rb +23 -10
- data/lib/ruflet/version.rb +1 -1
- metadata +1 -1
data/lib/ruflet/hot_reload.rb
CHANGED
|
@@ -111,7 +111,29 @@ module Ruflet
|
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
def watched_files
|
|
114
|
-
files =
|
|
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|
|
data/lib/ruflet/version.rb
CHANGED