Class: HazWebhooks::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

:nodoc:



14
15
16
17
18
19
20
# File 'lib/generators/haz_webhooks/install_generator.rb', line 14

def self.next_migration_number(dirname) #:nodoc:
  if ActiveRecord::Base.timestamped_migrations
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

.source_rootObject



10
11
12
# File 'lib/generators/haz_webhooks/install_generator.rb', line 10

def self.source_root
  File.join(File.dirname(__FILE__), 'templates')
end

Instance Method Details

#create_migration_fileObject

Every method that is declared below will be automatically executed when the generator is run



25
26
27
28
# File 'lib/generators/haz_webhooks/install_generator.rb', line 25

def create_migration_file
  migration_file = File.join(File.dirname(__FILE__), 'templates', 'migration.rb')
  migration_template migration_file, 'db/migrate/create_webhooks_table.rb'
end