class Tennpipes::Generators::Migration

Responsible for generating migration files for the appropriate ORM component.

Public Class Methods

banner() click to toggle source
source_root() click to toggle source
# File lib/tennpipes-init/generators/migration.rb, line 9
def self.source_root; File.expand_path(File.dirname(__FILE__)); end

Public Instance Methods

create_migration() click to toggle source

Creates the migration file within a Tennpipes project.

# File lib/tennpipes-init/generators/migration.rb, line 27
def create_migration
  self.destination_root = options[:root]
  if in_app_root?
    self.behavior = :revoke if options[:destroy]
    if include_component_module_for(:orm)
      create_migration_file(name, name, columns)
    else
      say '<= You need an ORM adapter for run this generator. Sorry!'
      raise SystemExit
    end
  else
    say 'You are not at the root of a Tennpipes application! (config/boot.rb not found)'
  end
end