class Apicasso::Generators::InstallGenerator

Class used to install Apicasso engine into a project

Public Class Methods

next_migration_number(path) click to toggle source

Method generates the next migration number @param path [String] the path to migration directory @returns [String] the next migration number

# File lib/generators/apicasso/install/install_generator.rb, line 14
def self.next_migration_number(path)
  if @prev_migration_nr
    @prev_migration_nr += 1
  else
    @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
  end
  @prev_migration_nr.to_s
end

Public Instance Methods

copy_initializer() click to toggle source

Create an initializer with CORS configuration to Apicasso

# File lib/generators/apicasso/install/install_generator.rb, line 31
def copy_initializer
  copy_file 'apicasso.rb', 'config/initializers/apicasso.rb'
end
copy_migrations() click to toggle source

Create a migration to setup database tables used by the engine to implement authentication, authorization and auditability

# File lib/generators/apicasso/install/install_generator.rb, line 25
def copy_migrations
  migration_template 'create_apicasso_tables.rb',
                     'db/migrate/create_apicasso_tables.rb'
end