Sha256: 2716453ca2ccde6b9f61015d96d7e29d9e647392e4e3112f8bb0764338c49ddc
Contents?: true
Size: 615 Bytes
Versions: 4
Compression:
Stored size: 615 Bytes
Contents
namespace :g do desc "Create migration" task :migration, [:name] do |t, args| if args[:name].nil? raise "Please provide a name for migration (rake 'g:migration[my_file_name]')" end date_part = Time.now.strftime("%Y%m%d%H%M%S") words_part = args[:name].to_s.split(/(?=[A-Z])/).map(&:downcase).join("_") filename = "#{date_part}_#{words_part}.rb" full_filename = File.join("db", "migrate", filename) File.open(full_filename, "w") do |file| file.puts("Sequel.migration do") file.puts(" change do") file.puts(" end") file.puts("end") end end end
Version data entries
4 entries across 4 versions & 1 rubygems