Skip to content

Instantly share code, notes, and snippets.

@jballanc
Created July 24, 2010 01:44
Show Gist options
  • Save jballanc/488299 to your computer and use it in GitHub Desktop.
Save jballanc/488299 to your computer and use it in GitHub Desktop.
diff -r -u ./base.rb /Volumes/Data/Users/joshua1/Source/sinatra/lib/sinatra/base.rb
--- ./base.rb 2010-07-22 13:58:58.000000000 -0700
+++ /Volumes/Data/Users/joshua1/Source/sinatra/lib/sinatra/base.rb 2010-07-23 18:41:46.000000000 -0700
@@ -36,7 +36,7 @@
# Override Rack < 1.1's Request#params implementation (see lh #72 for
# more info) and add a Request#user_agent method.
# XXX remove when we require rack > 1.1
- if Rack.version < '1.1'
+ if Rack.release < '1.1'
def params
self.GET.update(self.POST)
rescue EOFError, Errno::ESPIPE
@@ -746,7 +746,7 @@
# Load embeded templates from the file; uses the caller's __FILE__
# when no file is specified.
def inline_templates=(file=nil)
- file = (file.nil? || file == true) ? (caller_files.first || File.expand_path($0)) : file
+ file = (file.nil? || file == true) ? caller_files.first : file
begin
app, data =
@@ -934,12 +934,6 @@
@prototype = nil
@middleware << [middleware, args, block]
end
-
- def quit!(server, handler_name)
- ## Use thins' hard #stop! if available, otherwise just #stop
- server.respond_to?(:stop!) ? server.stop! : server.stop
- puts "\n== Sinatra has ended his set (crowd applauds)" unless handler_name =~/cgi/i
- end
# Run the Sinatra app as a self-hosted server using
# Thin, Mongrel or WEBrick (in that order)
@@ -950,7 +944,11 @@
puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
"on #{port} for #{environment} with backup from #{handler_name}" unless handler_name =~/cgi/i
handler.run self, :Host => bind, :Port => port do |server|
- [:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
+ trap(:INT) do
+ ## Use thins' hard #stop! if available, otherwise just #stop
+ server.respond_to?(:stop!) ? server.stop! : server.stop
+ puts "\n== Sinatra has ended his set (crowd applauds)" unless handler_name =~/cgi/i
+ end
set :running, true
end
rescue Errno::EADDRINUSE => e
@@ -1016,10 +1014,10 @@
public
CALLERS_TO_IGNORE = [
/\/sinatra(\/(base|main|showexceptions))?\.rb$/, # all sinatra code
- /lib\/tilt.*\.rb$/, # all tilt code
- /\(.*\)/, # generated code
- /rubygems\/custom_require\.rb$/, # rubygems require hacks
- /active_support/, # active_support require hacks
+ /lib\/tilt.*\.rb$/, # all tilt code
+ /\(.*\)/, # generated code
+ /custom_require\.rb$/, # rubygems require hacks
+ /active_support/, # active_support require hacks
]
# add rubinius (and hopefully other VM impls) ignore patterns ...
Only in /Volumes/Data/Users/joshua1/Source/sinatra/lib/sinatra: images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment