Browse files

Add 'foo:install:migrations' task to copy migrations from foo engine

  • Loading branch information...
1 parent b417cfb commit a9bf91ea5640ab9ed9d6d7ba9da780ea1dfbd6e3 @drogus drogus committed Oct 9, 2010
Showing with 15 additions and 1 deletion.
  1. +14 −0 railties/lib/rails/engine.rb
  2. +1 −1 railties/test/railties/shared_tests.rb
View
14 railties/lib/rails/engine.rb
@@ -522,6 +522,20 @@ def load_seed
# consistently executed after all the initializers above across all engines.
end
+ rake_tasks do
+ next if self.is_a?(Rails::Application)
+
+ namespace railtie_name do
+ namespace :install do
+ desc "Copy migrations from #{railtie_name} to application"
+ task :migrations do
+ ENV["FROM"] = railtie_name
+ Rake::Task["railties:install:migrations"].invoke
+ end
+ end
+ end
+ end
+
protected
def routes?
defined?(@routes)
View
2 railties/test/railties/shared_tests.rb
@@ -43,7 +43,7 @@ class CreateYaffles < ActiveRecord::Migration
add_to_config "ActiveRecord::Base.timestamped_migrations = false"
Dir.chdir(app_path) do
- output = `rake railties:install:migrations FROM=bukkits 2>&1`
+ output = `rake bukkits:install:migrations 2>&1`
assert File.exists?("#{app_path}/db/migrate/2_create_users.rb")
assert File.exists?("#{app_path}/db/migrate/3_add_last_name_to_users.rb")

0 comments on commit a9bf91e

Please sign in to comment.