Skip to content

Commit cae1658

Browse files
committed
make watch fail early
1 parent 9533144 commit cae1658

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**v1.4.7** Bump up to processing-3.3.7
1+
**v1.4.7** Bump up to processing-3.3.7, make watch fail early if too many ruby files to watch
22

33
**v1.4.6** Bump up to JRubyComplete-9.1.16.0
44

lib/jruby_art/runners/watch.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ class Watcher
1313
WATCH_MESSAGE ||= <<-EOS.freeze
1414
Warning:
1515
To protect you from running watch mode in a top level
16-
directory with lots of nested ruby or GLSL files we
16+
directory with lots of nested ruby files we
1717
limit the number of files to watch to %d.
1818
If you really want to watch %d files you should
1919
increase MAX_WATCH in ~/.jruby_art/config.yml
2020
2121
EOS
2222
SLEEP_TIME = 0.2
2323
def initialize
24+
count = Dir["**.*rb"].length
25+
max_watch = RP_CONFIG.fetch('MAX_WATCH', 30).to_i
26+
return warn format(WATCH_MESSAGE, max_watch, count) if count > max_watch
2427
reload_files_to_watch
2528
@time = Time.now
2629
start_watching
@@ -71,11 +74,6 @@ def start_runner
7174

7275
def reload_files_to_watch
7376
@files = Dir.glob(File.join(SKETCH_ROOT, '**/*.{rb,glsl}'))
74-
count = @files.length
75-
max_watch = RP_CONFIG.fetch('MAX_WATCH', 32)
76-
return unless count > max_watch.to_i
77-
warn format(WATCH_MESSAGE, max_watch, count)
78-
abort
7977
end
8078
end
8179
end

0 commit comments

Comments
 (0)