Skip to content

Commit

Permalink
Add 'foo:install:migrations' task to copy migrations from foo engine
Browse files Browse the repository at this point in the history
  • Loading branch information
drogus committed Oct 9, 2010
1 parent b417cfb commit a9bf91e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions railties/lib/rails/engine.rb
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion railties/test/railties/shared_tests.rb
Expand Up @@ -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")
Expand Down

0 comments on commit a9bf91e

Please sign in to comment.