Skip to content

Commit c464485

Browse files
kareschadlwilson
authored andcommitted
cleanup support for booting rails (2.x)
(cherry picked from commit c95bd52)
1 parent 442a29f commit c464485

File tree

15 files changed

+4
-542
lines changed

15 files changed

+4
-542
lines changed

src/main/ruby/jruby/rack/rails/environment3.rb renamed to src/main/ruby/jruby/rack/rails/environment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# Rails 3.x specific booter behavior.
1111
# @see JRuby::Rack::Railtie
12-
module JRuby::Rack::RailsBooter::Rails3Environment
12+
module JRuby::Rack::RailsBooter::RailsEnvironment
1313

1414
# @return [Rails::Application] the (loaded) application instance
1515
def to_app
@@ -23,7 +23,7 @@ def load_environment
2323
require expand_path('config/boot.rb')
2424
require 'jruby/rack/rails/railtie'
2525
require expand_path('config/environment.rb')
26-
require 'jruby/rack/rails/extensions3'
26+
require 'jruby/rack/rails/extensions'
2727
end
2828

2929
protected

src/main/ruby/jruby/rack/rails/environment2.rb

Lines changed: 0 additions & 141 deletions
This file was deleted.

src/main/ruby/jruby/rack/rails/extensions2.rb

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/main/ruby/jruby/rack/rails/extensions3.rb

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/main/ruby/jruby/rack/rails_booter.rb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,8 @@ def boot!
2727
ENV['RAILS_ROOT'] = app_path
2828
ENV['RAILS_ENV'] = rails_env
2929

30-
if rails2?
31-
require 'jruby/rack/rails/environment2'
32-
extend Rails2Environment
33-
else
34-
require 'jruby/rack/rails/environment3'
35-
extend Rails3Environment
36-
end
30+
require 'jruby/rack/rails/environment'
31+
extend RailsEnvironment
3732

3833
set_public_root
3934
self
@@ -71,11 +66,6 @@ def run_boot_hooks
7166

7267
private
7368

74-
def rails2?
75-
app_path = real_path File.join(layout.app_uri, 'config/application.rb')
76-
! ( app_path && File.exist?(app_path) )
77-
end
78-
7969
class << self
8070

8171
# @see #RailsRackApplicationFactory
@@ -96,6 +86,5 @@ def rails_booter
9686
end
9787

9888
end
99-
10089
end
10190
end

src/spec/ruby/jruby/rack/integration_spec.rb

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -361,47 +361,6 @@ def base_path; "file://#{STUB_DIR}/rails41" end
361361

362362
end
363363

364-
describe 'rails 2.3', :lib => :rails23 do
365-
366-
before(:all) do
367-
copy_gemfile('rails23')
368-
path = File.join(STUB_DIR, 'rails23/WEB-INF/init.rb') # hard-coded RAILS_GEM_VERSION
369-
File.open(path, 'w') { |f| f << "RAILS_GEM_VERSION = '#{Rails::VERSION::STRING}'\n" }
370-
end
371-
372-
let(:base_path) { "file://#{STUB_DIR}/rails23" }
373-
374-
it_should_behave_like 'a rails app'
375-
376-
context "initialized" do
377-
378-
before(:all) { initialize_rails 'production', base_path }
379-
after(:all) { restore_rails }
380-
381-
it "loaded rack ~> 1.1" do
382-
@runtime = @rack_factory.getApplication.getRuntime
383-
should_eval_as_not_nil "defined?(Rack.release)"
384-
should_eval_as_eql_to "Rack.release.to_s[0, 3]", '1.1'
385-
end
386-
387-
it "booted with a servlet logger" do
388-
@runtime = @rack_factory.getApplication.getRuntime
389-
should_eval_as_not_nil "defined?(Rails)"
390-
should_eval_as_not_nil "defined?(Rails.logger)"
391-
392-
should_eval_as_not_nil "defined?(ActiveSupport::BufferedLogger) && Rails.logger.is_a?(ActiveSupport::BufferedLogger)"
393-
should_eval_as_not_nil "Rails.logger.send(:instance_variable_get, '@log')"
394-
should_eval_as_eql_to "log = Rails.logger.send(:instance_variable_get, '@log');" +
395-
"log.class.name", 'JRuby::Rack::ServletLog'
396-
should_eval_as_eql_to "Rails.logger.level", Logger::INFO
397-
398-
@runtime.evalScriptlet "Rails.logger.debug 'logging works'"
399-
end
400-
401-
end
402-
403-
end
404-
405364
def expect_to_have_monkey_patched_chunked
406365
@runtime.evalScriptlet "require 'rack/chunked'"
407366
script = %{

0 commit comments

Comments
 (0)