Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit a9bf91ea5640ab9ed9d6d7ba9da780ea1dfbd6e3 1 parent b417cfb
@drogus drogus authored
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.
Something went wrong with that request. Please try again.