aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-10-09 20:15:45 +0200
committerPiotr Sarnacki <drogus@gmail.com>2010-10-09 22:31:26 +0200
commita9bf91ea5640ab9ed9d6d7ba9da780ea1dfbd6e3 (patch)
treef0caf07302be801c243fa6440a118a911cb476f2
parentb417cfbf01a17be7216d09e447f37bf1c19e4cb2 (diff)
downloadrails-a9bf91ea5640ab9ed9d6d7ba9da780ea1dfbd6e3.tar.gz
rails-a9bf91ea5640ab9ed9d6d7ba9da780ea1dfbd6e3.tar.bz2
rails-a9bf91ea5640ab9ed9d6d7ba9da780ea1dfbd6e3.zip
Add 'foo:install:migrations' task to copy migrations from foo engine
-rw-r--r--railties/lib/rails/engine.rb14
-rw-r--r--railties/test/railties/shared_tests.rb2
2 files changed, 15 insertions, 1 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index 909840da04..4acebb4769 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -522,6 +522,20 @@ module Rails
# 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)
diff --git a/railties/test/railties/shared_tests.rb b/railties/test/railties/shared_tests.rb
index 7bd65158b4..b1d7580dff 100644
--- a/railties/test/railties/shared_tests.rb
+++ b/railties/test/railties/shared_tests.rb
@@ -43,7 +43,7 @@ module RailtiesTest
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")