1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Do not treat information about skipped migrations as WARNINGs but as a NOTEs, also puts to stdin

This commit is contained in:
Piotr Sarnacki 2010-10-10 15:03:57 +02:00 committed by José Valim
parent ab1a661533
commit f07cbec865
3 changed files with 12 additions and 6 deletions

View file

@ -494,7 +494,7 @@ namespace :railties do
end end
on_skip = Proc.new do |name, migration| 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 end
on_copy = Proc.new do |name, migration, old_path| on_copy = Proc.new do |name, migration, old_path|

View file

@ -547,6 +547,12 @@ module Rails
Rake::Task["railties:install:migrations"].invoke Rake::Task["railties:install:migrations"].invoke
end end
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
end end

View file

@ -43,24 +43,24 @@ module RailtiesTest
add_to_config "ActiveRecord::Base.timestamped_migrations = false" add_to_config "ActiveRecord::Base.timestamped_migrations = false"
Dir.chdir(app_path) do 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/2_create_users.rb")
assert File.exists?("#{app_path}/db/migrate/3_add_last_name_to_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 2_create_users.rb from bukkits/, output
assert_match /Copied migration 3_add_last_name_to_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 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 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_match /Copied migration 4_create_yaffles.rb from acts_as_yaffle/, output
assert_no_match /2_create_users/, output assert_no_match /2_create_users/, output
migrations_count = Dir["#{app_path}/db/migrate/*.rb"].length 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 assert_equal migrations_count, Dir["#{app_path}/db/migrate/*.rb"].length
end end