diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/gem_dependency.rb | 31 | ||||
-rw-r--r-- | railties/lib/rails/plugin.rb | 10 | ||||
-rw-r--r-- | railties/lib/webrick_server.rb | 13 |
3 files changed, 26 insertions, 28 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 30bdf416fc..4cac7f725a 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -98,27 +98,26 @@ module Rails self.name == other.name && self.requirement == other.requirement end -private ################################################################### - def specification @spec ||= Gem.source_index.search(Gem::Dependency.new(@name, @requirement)).sort_by { |s| s.version }.last end - def gem_command - RUBY_PLATFORM =~ /win32/ ? 'gem.bat' : 'gem' - end + private + def gem_command + RUBY_PLATFORM =~ /win32/ ? 'gem.bat' : 'gem' + end - def install_command - cmd = %w(install) << @name - cmd << "--version" << %("#{@requirement.to_s}") if @requirement - cmd << "--source" << @source if @source - cmd - end + def install_command + cmd = %w(install) << @name + cmd << "--version" << %("#{@requirement.to_s}") if @requirement + cmd << "--source" << @source if @source + cmd + end - def unpack_command - cmd = %w(unpack) << @name - cmd << "--version" << %("#{@requirement.to_s}") if @requirement - cmd - end + def unpack_command + cmd = %w(unpack) << @name + cmd << "--version" << %("#{@requirement.to_s}") if @requirement + cmd + end end end diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 256f4b0132..a54ab85dbe 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -74,10 +74,18 @@ module Rails File.join(directory, 'lib') end - def init_path + def classic_init_path File.join(directory, 'init.rb') end + def gem_init_path + File.join(directory, 'rails', 'init.rb') + end + + def init_path + File.file?(gem_init_path) ? gem_init_path : classic_init_path + end + def has_lib_directory? File.directory?(lib_path) end diff --git a/railties/lib/webrick_server.rb b/railties/lib/webrick_server.rb index ad4ca926ba..2f60151b22 100644 --- a/railties/lib/webrick_server.rb +++ b/railties/lib/webrick_server.rb @@ -43,8 +43,6 @@ end # can change this behavior by setting ActionController::Base.allow_concurrency # to true. class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet - REQUEST_MUTEX = Mutex.new - # Start the WEBrick server with the given options, mounting the # DispatchServlet at <tt>/</tt>. def self.dispatch(options = {}) @@ -73,15 +71,8 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet def service(req, res) #:nodoc: unless handle_file(req, res) - begin - REQUEST_MUTEX.lock unless ActionController::Base.allow_concurrency - unless handle_dispatch(req, res) - raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found." - end - ensure - unless ActionController::Base.allow_concurrency - REQUEST_MUTEX.unlock if REQUEST_MUTEX.locked? - end + unless handle_dispatch(req, res) + raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found." end end end |