Sha256: aa25c90a66f718ec5fef67e8cd6b0113944d279c4abe427a77cd3104a9998aba

Contents?: true

Size: 454 Bytes

Versions: 2

Compression:

Stored size: 454 Bytes

Contents

require 'activesupport'

class Templater::Generator
  def camel_case
    self.name.camel_case
  end
  def underscore
    self.name.underscore
  end
  def next_migration_num
    migrations = File.join(%W|#{self.destination_root} db migrate [0-9][0-9][0-9]_*.rb|)
    current = Dir.glob(migrations).map{|x| /(\d{3})_.*\.rb/.match(x)[1].to_i }.max
    current ||= 0
    "%03d" % current.succ
  end
  def migration_name
    "create_#{self.name}s"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
michaelbarton-gigantron-0.1.6 lib/gigantron/generators/helper.rb
michaelbarton-gigantron-0.1.7 lib/gigantron/generators/helper.rb