Skip to content

Commit 8f5e73e

Browse files
committed
chore: update gitignore, gemfile.lock, and watcher exclude handling
- Add tmp/ to .gitignore - Update Gemfile.lock to v0.0.33 - Apply exclude patterns to watcher file discovery - Refactor find_trb_files and find_rb_files to use common helper
1 parent b0ea2c2 commit 8f5e73e

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ editors/vscode/*.vsix
2323
.env*
2424

2525
ignore/
26+
27+
tmp/
28+
!tmp/.keep
29+
2630
*.gem
2731

2832
# WASM package build artifacts

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
t-ruby (0.0.11)
4+
t-ruby (0.0.33)
55
listen (~> 3.8)
66

77
GEM

lib/t_ruby/watcher.rb

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def watch_directories
9191
end
9292

9393
def handle_changes(modified, added, removed)
94-
changed_files = (modified + added).select { |f| f.end_with?(".trb") || f.end_with?(".rb") }
94+
changed_files = (modified + added)
95+
.select { |f| f.end_with?(".trb") || f.end_with?(".rb") }
96+
.reject { |f| @config.excluded?(f) }
9597
return if changed_files.empty? && removed.empty?
9698

9799
puts
@@ -231,26 +233,34 @@ def compile_file(file)
231233
end
232234

233235
def find_trb_files
234-
files = []
235-
@paths.each do |path|
236-
if File.directory?(path)
237-
files.concat(Dir.glob(File.join(path, "**", "*.trb")))
238-
elsif File.file?(path) && path.end_with?(".trb")
239-
files << path
240-
end
241-
end
242-
files.uniq
236+
find_source_files_by_extension(".trb")
243237
end
244238

245239
def find_rb_files
240+
find_source_files_by_extension(".rb")
241+
end
242+
243+
def find_source_files_by_extension(ext)
246244
files = []
247-
@paths.each do |path|
248-
if File.directory?(path)
249-
files.concat(Dir.glob(File.join(path, "**", "*.rb")))
250-
elsif File.file?(path) && path.end_with?(".rb")
251-
files << path
245+
246+
# If watching specific paths, use those paths
247+
# Otherwise, use Config's find_source_files which respects include/exclude patterns
248+
if @paths == [File.expand_path(".")]
249+
# Default case: use config's src_dir with include/exclude patterns
250+
files = @config.find_source_files.select { |f| f.end_with?(ext) }
251+
else
252+
# Specific paths provided: search in those paths but still apply exclude patterns
253+
@paths.each do |path|
254+
if File.directory?(path)
255+
Dir.glob(File.join(path, "**", "*#{ext}")).each do |file|
256+
files << file unless @config.excluded?(file)
257+
end
258+
elsif File.file?(path) && path.end_with?(ext) && !@config.excluded?(path)
259+
files << path
260+
end
252261
end
253262
end
263+
254264
files.uniq
255265
end
256266

0 commit comments

Comments
 (0)