Sha256: 7a0024264c5b95a55c96bc9ed7042ab2c9c9f4caf86b4c1e790702a3d713350e

Contents?: true

Size: 533 Bytes

Versions: 7

Compression:

Stored size: 533 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

7 entries across 7 versions & 1 rubygems

Version Path
merb-0.1.0 examples/skeleton/script/new_migration
merb-0.2.0 examples/skeleton/script/new_migration
merb-0.3.0 examples/skeleton/script/new_migration
merb-0.3.1 examples/skeleton/script/new_migration
merb-0.3.3 examples/skeleton/script/new_migration
merb-0.3.4 examples/skeleton/script/new_migration
merb-0.3.7 examples/skeleton/script/new_migration