Skip to content

Commit c95bd52

Browse files
committed
cleanup support for booting rails (2.x)
1 parent 9015f76 commit c95bd52

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
@@ -356,47 +356,6 @@ def base_path; "file://#{STUB_DIR}/rails41" end
356356

357357
end
358358

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

0 commit comments

Comments
 (0)