Sha256: 3284cf84ab2d3e3c952512e1888d34d620a68c69c8d68c13c28f4cf8882df4f1

Contents?: true

Size: 534 Bytes

Versions: 8

Compression:

Stored size: 534 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'merb'

TMPL = <<EOF
class <%= class_name.snake_case.camel_case %> < ActiveRecord::Migration
  def self.up
  end

  def self.down
  end
end
EOF

class_name = ARGV[0]
highest_migration = Dir[Dir.pwd+'/dist/schema/migrations/*'].map{|f| File.basename(f) =~ /^(\d+)/; $1}.max
filename = format("%03d_%s", (highest_migration.to_i+1), class_name.snake_case)

File.open(Dir.pwd+"/dist/schema/migrations/#{filename}.rb", 'w+') do |file|
  file.write Erubis::Eruby.new(TMPL).result(binding)
end

Version data entries

8 entries across 4 versions & 1 rubygems

Version Path
merb-0.0.6 examples/sample_app/script/new_migration
merb-0.0.8 examples/app_skeleton/scripts/new_migration
merb-0.0.5 examples/app_skeleton/scripts/new_migration
merb-0.0.5 examples/sample_app/script/new_migration
merb-0.0.6 examples/app_skeleton/scripts/new_migration
merb-0.0.7 examples/app_skeleton/scripts/new_migration
merb-0.0.7 examples/sample_app/script/new_migration
merb-0.0.8 examples/sample_app/script/new_migration