Class: Backflip::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/backflip.rb

Instance Method Summary collapse

Instance Method Details

#generate(filename) ⇒ Object



69
70
71
72
73
74
75
76
77
# File 'lib/backflip.rb', line 69

def generate(filename)
  begin
    require "./#{filename}"
    filename.split(/\//).last.gsub(/\.rb/, '').classify.constantize.generate_migrations
  rescue NameError
    $stderr.print "Ah, there is a dependancy in this model that Backflip won't try to load.\nTry generating the migration before adding in all the goodies.\n\nHere's a hint for what the problem is:\n\n"
    raise 
  end
end