Skip to content

Commit

Permalink
Minor code re-organisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitrij Denissenko committed Dec 5, 2009
1 parent 64e22cf commit 819f974
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/tasks/database.rake
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
require 'fileutils'
namespace :db do

# Create a schema.rb file if it is missing
if defined?(RAILS_ROOT) && !File.exist?(File.join(RAILS_ROOT, 'db', 'schema.rb'))
FileUtils.cp File.join(RAILS_ROOT, 'db', 'schema.core.rb'), File.join(RAILS_ROOT, 'db', 'schema.rb')
end

namespace :db do
namespace :retro do
task :load do
STDERR.puts "Task db:retro:load is deprecated and was disabled; please use db:setup instead."
end
end

namespace :schema do
# Copy schema.core.rb to schema.rb if missing
task :clone_core => :environment do
unless File.exist?(Rails.root.join('db', 'schema.rb'))
FileUtils.cp Rails.root.join('db', 'schema.core.rb'), Rails.root.join('db', 'schema.rb')
end
end
end

end

Rake::Task['db:schema:load'].enhance ['db:schema:clone_core']

0 comments on commit 819f974

Please sign in to comment.