From f07cbec865093c30299ad038d52e3e70e2527848 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sun, 10 Oct 2010 15:03:57 +0200 Subject: [PATCH] Do not treat information about skipped migrations as WARNINGs but as a NOTEs, also puts to stdin --- activerecord/lib/active_record/railties/databases.rake | 2 +- railties/lib/rails/engine.rb | 6 ++++++ railties/test/railties/shared_tests.rb | 10 +++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 5ad440e58d..1fbc8a1d32 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -494,7 +494,7 @@ namespace :railties do end on_skip = Proc.new do |name, migration| - $stderr.puts "WARNING: Migration #{migration.basename} from #{name} has been skipped. Migration with the same name already exists." + puts "NOTE: Migration #{migration.basename} from #{name} has been skipped. Migration with the same name already exists." end on_copy = Proc.new do |name, migration, old_path| diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index e9ce9610b8..86a8374ded 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -547,6 +547,12 @@ module Rails Rake::Task["railties:install:migrations"].invoke end end + + desc "Copy assets from #{railtie_name} to application" + task :assets do + ENV["FROM"] = railtie_name + Rake::Task["railties:install:assets"].invoke + end end end diff --git a/railties/test/railties/shared_tests.rb b/railties/test/railties/shared_tests.rb index b1d7580dff..9f48c7acfd 100644 --- a/railties/test/railties/shared_tests.rb +++ b/railties/test/railties/shared_tests.rb @@ -43,24 +43,24 @@ module RailtiesTest add_to_config "ActiveRecord::Base.timestamped_migrations = false" Dir.chdir(app_path) do - output = `rake bukkits:install:migrations 2>&1` + output = `rake bukkits:install:migrations` 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") assert_match /Copied migration 2_create_users.rb from bukkits/, output assert_match /Copied migration 3_add_last_name_to_users.rb from bukkits/, output - assert_match /WARNING: Migration 3_create_sessions.rb from bukkits has been skipped/, output + assert_match /NOTE: Migration 3_create_sessions.rb from bukkits has been skipped/, output assert_equal 3, Dir["#{app_path}/db/migrate/*.rb"].length - output = `rake railties:install:migrations 2>&1` + output = `rake railties:install:migrations` assert File.exists?("#{app_path}/db/migrate/4_create_yaffles.rb") - assert_match /WARNING: Migration 3_create_sessions.rb from bukkits has been skipped/, output + assert_match /NOTE: Migration 3_create_sessions.rb from bukkits has been skipped/, output assert_match /Copied migration 4_create_yaffles.rb from acts_as_yaffle/, output assert_no_match /2_create_users/, output migrations_count = Dir["#{app_path}/db/migrate/*.rb"].length - output = `rake railties:install:migrations 2>&1` + output = `rake railties:install:migrations` assert_equal migrations_count, Dir["#{app_path}/db/migrate/*.rb"].length end