Permalink
Browse files

Remove more deprecated behavior from plugins.

  • Loading branch information...
1 parent 6f194bb commit f9c21ce6580601109a6c4ac55c63bdea031f3203 @josevalim josevalim committed Sep 3, 2010
Showing with 3 additions and 46 deletions.
  1. +3 −19 railties/lib/rails/plugin.rb
  2. +0 −27 railties/test/railties/plugin_test.rb
@@ -52,19 +52,6 @@ def railtie_name
name.to_s
end
- def load_tasks
- super
- load_deprecated_tasks
- end
-
- def load_deprecated_tasks
- tasks = Dir["#{root}/{tasks,rails/tasks}/**/*.rake"].sort
- if tasks.any?
- ActiveSupport::Deprecation.warn "Rake tasks in #{tasks.to_sentence} are deprecated. Use lib/tasks instead"
- tasks.each { |ext| load(ext) }
- end
- end
-
def initialize(root)
@name = File.basename(root).to_sym
config.root = root
@@ -85,15 +72,12 @@ def config
end
initializer :load_init_rb, :before => :load_config_initializers do |app|
- files = %w(rails/init.rb init.rb).map { |path| File.expand_path path, root }
- if initrb = files.find { |path| File.file? path }
- if initrb == files.first
- ActiveSupport::Deprecation.warn "Use toplevel init.rb; rails/init.rb is deprecated: #{initrb}"
- end
+ init_rb = File.expand_path("init.rb", root)
+ if File.file?(init_rb)
config = app.config
# TODO: think about evaling initrb in context of Engine (currently it's
# always evaled in context of Rails::Application)
- eval(File.read(initrb), binding, initrb)
+ eval(File.read(init_rb), binding, init_rb)
end
end
@@ -115,32 +115,5 @@ class Engine < Rails::Engine
assert rescued, "Expected boot rails to fail"
end
-
- test "loads deprecated rails/init.rb" do
- @plugin.write "rails/init.rb", <<-RUBY
- $loaded = true
- RUBY
-
- boot_rails
- assert $loaded
- end
-
- test "deprecated tasks are also loaded" do
- $executed = false
- @plugin.write "tasks/foo.rake", <<-RUBY
- task :foo do
- $executed = true
- end
- RUBY
-
- boot_rails
- require 'rake'
- require 'rake/rdoctask'
- require 'rake/testtask'
- Rails.application.load_tasks
- Rake::Task[:foo].invoke
- assert $executed
- end
-
end
end

0 comments on commit f9c21ce

Please sign in to comment.