lib/spring/configuration.rb in spring-1.1.0.beta1 vs lib/spring/configuration.rb in spring-1.1.0.beta2

- old
+ new

@@ -20,18 +20,27 @@ application_root_path end def application_root_path @application_root_path ||= begin - path = Pathname.new(File.expand_path(application_root || find_project_root)) + if application_root + path = Pathname.new(File.expand_path(application_root)) + else + path = project_root_path + end + raise MissingApplication.new(path) unless path.join("config/application.rb").exist? path end end + def project_root_path + @project_root_path ||= find_project_root(Pathname.new(File.expand_path(Dir.pwd))) + end + private - def find_project_root(current_dir = Pathname.new(Dir.pwd)) + def find_project_root(current_dir) if current_dir.join(gemfile).exist? current_dir elsif current_dir.root? raise UnknownProject.new(Dir.pwd) else