Skip to content

Commit

Permalink
make the reloader work on 1.8 and jRuby
Browse files Browse the repository at this point in the history
  • Loading branch information
gnandretta committed Apr 15, 2011
1 parent f1299f2 commit 4cdc3da
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Original file line Diff line number Diff line change
@@ -1,2 +1,8 @@
source "http://rubygems.org" unless ENV['QUICK'] source "http://rubygems.org" unless ENV['QUICK']
gemspec gemspec

group :development, :test do
platform :ruby_18, :jruby do
gem 'json'
end
end
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ GEM
erubis (2.6.6) erubis (2.6.6)
abstract (>= 1.0.0) abstract (>= 1.0.0)
haml (3.0.25) haml (3.0.25)
json (1.5.1)
json (1.5.1-java)
rack (1.2.2) rack (1.2.2)
rack-test (0.5.7) rack-test (0.5.7)
rack (>= 1.0) rack (>= 1.0)
Expand All @@ -37,11 +39,13 @@ GEM
tilt (1.2.2) tilt (1.2.2)


PLATFORMS PLATFORMS
java
ruby ruby


DEPENDENCIES DEPENDENCIES
erubis erubis
haml haml
json
rake rake
rspec (~> 2.3) rspec (~> 2.3)
sinatra-contrib! sinatra-contrib!
Expand Down
18 changes: 9 additions & 9 deletions lib/sinatra/reloader.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ module BaseMethods
# defined route. # defined route.
def route(verb, path, options={}, &block) def route(verb, path, options={}, &block)
source_location = block.respond_to?(:source_location) ? source_location = block.respond_to?(:source_location) ?
block.source_location.first : caller_files.first block.source_location.first : caller_files[1]
super.tap do |signature| signature = super
Watcher::List.for(self).watch_route Route.new( Watcher::List.for(self).watch_route Route.new(
:app => self, :app => self,
:source_location => source_location, :source_location => source_location,
:verb => verb, :verb => verb,
:signature => signature :signature => signature
) )
end signature
end end


# Does everything Sinatra::Base#inline_templates= does, but it # Does everything Sinatra::Base#inline_templates= does, but it
Expand Down

0 comments on commit 4cdc3da

Please sign in to comment.