Class: NormanGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/norman_generator.rb

Overview

This generator adds an initializer and default empty database to your Rails application. It can be invoked on the command line like:

rails generate norman

Instance Method Summary collapse

Instance Method Details

#create_filesObject

Create the initializer and empty database.



12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/norman_generator.rb', line 12

def create_files
  initializer("norman.rb") do
    <<-EOI
require "norman/adapters/yaml"
require "norman/active_model"
Norman::Adapters::YAML.new :file => Rails.root.join('db', 'norman.yml')
    EOI
  end
  create_file("db/norman.yml", '')
end