Sha256: 53cc12c43fbf1151622372aa6c66fc3ab773c3697d15ba84fdec5d4ca580127a

Contents?: true

Size: 792 Bytes

Versions: 7

Compression:

Stored size: 792 Bytes

Contents

module Deano
  class ModelGenerator < Deano::NameCommand

    def self.command
      "generate:model"
    end

    def self.help
      "model_name"
    end

    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

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
deano-1.2.1 lib/deano/commands/model_generator_command.rb
deano-1.2.0 lib/deano/commands/model_generator_command.rb
deano-1.1.3 lib/deano/commands/model_generator_command.rb
deano-1.1.2 lib/deano/commands/model_generator_command.rb
deano-1.1.1 lib/deano/commands/model_generator_command.rb
deano-1.1.0 lib/deano/commands/model_generator_command.rb
deano-1.0.0 lib/deano/commands/model_generator_command.rb