Skip to content
This repository
Browse code

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

  • Loading branch information...
commit a9bf91ea5640ab9ed9d6d7ba9da780ea1dfbd6e3 1 parent b417cfb
Piotr Sarnacki authored October 09, 2010
14  railties/lib/rails/engine.rb
@@ -522,6 +522,20 @@ def load_seed
522 522
       # consistently executed after all the initializers above across all engines.
523 523
     end
524 524
 
  525
+    rake_tasks do
  526
+      next if self.is_a?(Rails::Application)
  527
+
  528
+      namespace railtie_name do
  529
+        namespace :install do
  530
+          desc "Copy migrations from #{railtie_name} to application"
  531
+          task :migrations do
  532
+            ENV["FROM"] = railtie_name
  533
+            Rake::Task["railties:install:migrations"].invoke
  534
+          end
  535
+        end
  536
+      end
  537
+    end
  538
+
525 539
   protected
526 540
     def routes?
527 541
       defined?(@routes)
2  railties/test/railties/shared_tests.rb
@@ -43,7 +43,7 @@ class CreateYaffles < ActiveRecord::Migration
43 43
       add_to_config "ActiveRecord::Base.timestamped_migrations = false"
44 44
 
45 45
       Dir.chdir(app_path) do
46  
-        output = `rake railties:install:migrations FROM=bukkits 2>&1`
  46
+        output = `rake bukkits:install:migrations 2>&1`
47 47
 
48 48
         assert File.exists?("#{app_path}/db/migrate/2_create_users.rb")
49 49
         assert File.exists?("#{app_path}/db/migrate/3_add_last_name_to_users.rb")

0 notes on commit a9bf91e

Please sign in to comment.
Something went wrong with that request. Please try again.