class Deano::ModelGenerator
Public Class Methods
command()
click to toggle source
# File lib/deano/commands/model_generator_command.rb, line 4 def self.command "generate:model" end
help()
click to toggle source
# File lib/deano/commands/model_generator_command.rb, line 8 def self.help "model_name" end
Public Instance Methods
call()
click to toggle source
# File lib/deano/commands/model_generator_command.rb, line 12 def call path = app_path("models", "#{self.underscored}.rb") FileUtils.mkdir_p File.dirname(path), verbose: true File.open(path, 'w') do |file| file.puts <<-EOF class #{self.classified} include Mongoid::Document include Mongoid::Timestamps end EOF end path = app_path("spec", "models", "#{self.underscored}_spec.rb") FileUtils.mkdir_p File.dirname(path), verbose: true File.open(path, 'w') do |file| file.puts <<-EOF require 'spec_helper' describe #{self.classified} do it "does something" end EOF end end