Class: OrochiGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/orochi/orochi_generator.rb

Overview

TODO seperating this content seems to render all generators un-find-able :\

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



12
13
14
# File 'lib/generators/orochi/orochi_generator.rb', line 12

def self.next_migration_number(path)
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#create_migration_fileObject



16
17
18
# File 'lib/generators/orochi/orochi_generator.rb', line 16

def create_migration_file
  migration_template File.join(File.dirname(__FILE__), 'templates/migrations/migration.rb'), 'db/migrate/orochi_migration'
end

#create_modelsObject

Models



21
22
23
24
25
26
27
28
# File 'lib/generators/orochi/orochi_generator.rb', line 21

def create_models
  dir_path = File.join(File.dirname(__FILE__), 'templates/models')
  Dir.new(dir_path).each do |file|
    if !File.directory?(file)
      template "#{dir_path}/#{File.basename(file)}", "app/models/#{File.basename(file)}"
    end
  end
end