Ryan Tomayko (rtomayko on GitHub) is managing the current releases of
sinatra, and you can find the current Sinatra code here: http://github.com/rtomayko/sinatra/tree
>
> PPS: I would have created a Lighthouse ticket, but the "Create ticket"
> button doesn't do anything when I click it with either Firefox or
> Opera.
You should contact the Lighthouse team about that. I'm afraid we can
do little for you about that here.
g, Markus
Sorry for the offtopic, but yeah, we do provide a lighthouse for
lighthosue, although it's a bit hidden =)
http://activereload.lighthouseapp.com/projects/44-lighthouse-users
But the best way to get support on lighthouse is via our support forum
(and there's a link to it in LH's footer):
http://help.lighthouseapp.com/
Best,
-foca
Sorry for not responding earlier (ML seems to have eaten my previous
message). I want to take a good look at this patch and discuss a bit
before merging it in. The use of caller is interesting. I'm not sure
using Thread to memoize the result is all that beneficial. Also,
assuming all rackup files will be named "config.ru" smells funny but I
don't have any great suggestions for how to make it better.
If anyone has time to do a quick review and commentary on Igal's patch,
I'd appreciate it.
Thanks,
Ryan
Thanks for reviewing the patch. I understand and respect your concerns.
I've reworked the code and submitted pull requests. The latest
solution reverts my earlier changes and instead uses code from
lib/ramaze.rb that determines the application path using caller. The
resulting diff against 0.3.2 is much cleaner, see below.
The downside to this lastest change is that if the user doesn't call
default_options in their config.ru file, it'll set the path wrong.
Ramaze avoids this by requiring users to call a "startup" method in
the rackup configuration file and thus has a reliable way of knowing
the caller. Is there any drawback to making the Sinatra
Application.initialize set this path? Will anything other than the
rackup configuration file ever try to initialize the Sinatra app?
Another possible alternative is to use Dir.pwd. Thin and Mongrel are
typically started from the base directory of the application, while
Passenger sets to the directory with the config.ru file, which happens
to be the base directory too. Using Dir.pwd would be simpler and less
magical, but does anyone know the drawbacks to this?
-igal
diff --git a/lib/sinatra.rb b/lib/sinatra.rb
index 65db13c..b710e46 100755
--- a/lib/sinatra.rb
+++ b/lib/sinatra.rb
@@ -923,7 +923,8 @@ module Sinatra
# file, before any DSL related functions are invoked.
def self.default_options
return @default_options unless @default_options.nil?
- root = File.expand_path(File.dirname($0))
+ app_file = File.expand_path(caller[0][/^(.*?):\d+/, 1])
+ root = File.dirname(app_file)
@default_options = {
:run => true,
:port => 4567,
@@ -934,7 +935,7 @@ module Sinatra