Sha256: 8c6ec190860177fc3806f2fe1e60dd99a270bf36f38f7ca69b9dfaa781adc360
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
namespace :spree_retailers do desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)" task :install do Rake::Task['spree_retailers:install:migrations'].invoke end namespace :install do desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)" task :migrations do source = File.expand_path('../../../db/migrate', __FILE__) destination = File.join(Rails.root, 'db', 'migrate') FileUtils.mkdir_p(destination) migrations = Dir.entries(destination).select{|file| file.match('.rb') } files = Dir.entries(source).select{|file| file.match('.rb') } files.each_with_index do |file,index| time = Time.now + (index * 7) number = [time.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % index].max new_file = [number,file].join('_') src = File.join(source, file) dst = File.join(destination, new_file) if 0 < migrations.select{|migration| migration.match(file) != nil }.length puts "#{file} exists!" else FileUtils.cp(src, dst) puts "#{new_file} copied!" end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems