Browse files

make the reloader work on 1.8 and jRuby

  • Loading branch information...
1 parent f1299f2 commit 4cdc3daf6ca0b41f227e36529300abc6a52c5186 @gnandretta gnandretta committed Apr 15, 2011
Showing with 19 additions and 9 deletions.
  1. +6 −0 Gemfile
  2. +4 −0 Gemfile.lock
  3. +9 −9 lib/sinatra/reloader.rb
View
6 Gemfile
@@ -1,2 +1,8 @@
source "http://rubygems.org" unless ENV['QUICK']
gemspec
+
+group :development, :test do
+ platform :ruby_18, :jruby do
+ gem 'json'
+ end
+end
View
4 Gemfile.lock
@@ -15,6 +15,8 @@ GEM
erubis (2.6.6)
abstract (>= 1.0.0)
haml (3.0.25)
+ json (1.5.1)
+ json (1.5.1-java)
rack (1.2.2)
rack-test (0.5.7)
rack (>= 1.0)
@@ -37,11 +39,13 @@ GEM
tilt (1.2.2)
PLATFORMS
+ java
ruby
DEPENDENCIES
erubis
haml
+ json
rake
rspec (~> 2.3)
sinatra-contrib!
View
18 lib/sinatra/reloader.rb
@@ -179,15 +179,15 @@ module BaseMethods
# defined route.
def route(verb, path, options={}, &block)
source_location = block.respond_to?(:source_location) ?
- block.source_location.first : caller_files.first
- super.tap do |signature|
- Watcher::List.for(self).watch_route Route.new(
- :app => self,
- :source_location => source_location,
- :verb => verb,
- :signature => signature
- )
- end
+ block.source_location.first : caller_files[1]
+ signature = super
+ Watcher::List.for(self).watch_route Route.new(
+ :app => self,
+ :source_location => source_location,
+ :verb => verb,
+ :signature => signature
+ )
+ signature
end
# Does everything Sinatra::Base#inline_templates= does, but it

0 comments on commit 4cdc3da

Please sign in to comment.