class Sinatra::Generate::CLI

Public Instance Methods

migration(name) click to toggle source
# File lib/sinatra/generate.rb, line 14
def migration name
  dotfile = '.sinatragen'

  defaults = File.file?(dotfile) ? ::YAML.load_file(dotfile) : {}
  defaults = {
    path: 'lib/migrations'
  }.merge defaults

  self.options = Thor::CoreExt::HashWithIndifferentAccess.new defaults.merge(options)

  create_file "#{options[:path]}/#{DateTime.now.strftime '%Y%m%d%H%M%S%9N'}_#{name.underscore}.rb"
end