Permalink
Browse files

Support for partials inside partials

  • Loading branch information...
1 parent d6e5a71 commit f4ae7347328e8cb024a19bfd05c7a37b4d0d9076 @dmfrancisco committed Jul 28, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 watch
View
11 watch
@@ -83,7 +83,8 @@ module Builder
puts "LOADED : #{name}.partial"
f = File.open(filename, 'rb')
# _partial_ is the var where the result is stored, since we're inside a ERB.new already!
- page = ERB.new(f.read, nil, nil, '_partial_')
+ # The rand() was added in case partials contain partials themselves too
+ page = ERB.new(f.read, nil, nil, "_partial_#{rand(2010)}") # TODO add collision detection
f.close
else
puts "ERROR : #{filename}"
@@ -204,6 +205,10 @@ define_singleton_method(:partial) { |name| Builder::partial(name) }
# Check if the specified options are valid
exit unless Options::valid_options?
+puts ">>> Watching #{$settings[:root]}/#{$settings[:watched_files]}"
+puts ">>> Check your slideshow at http://#{$settings[:binding]}:#{$settings[:port]}/index.html"
+puts ">>> Your slideshow will be built and refreshed automagically\n\n"
+
# Launch the watcher
Thread.new do
script = Watchr::Script.new
@@ -215,10 +220,6 @@ Thread.new do
controller.run
end
-puts ">>> Watching #{$settings[:root]}/#{$settings[:watched_files]}"
-puts ">>> Check your slideshow at http://#{$settings[:binding]}:#{$settings[:port]}/index.html"
-puts ">>> Your slideshow will be built and refreshed automagically\n\n"
-
# Run the thin server
Thin::Server.start($settings[:binding], $settings[:port]) do
run Rack::Directory.new("#{$settings[:root]}")

0 comments on commit f4ae734

Please sign in to comment.