Class: Laserblob::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



11
12
13
# File 'lib/generators/laserblob/install/install_generator.rb', line 11

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

Instance Method Details

#copy_migrationsObject



15
16
17
18
19
# File 'lib/generators/laserblob/install/install_generator.rb', line 15

def copy_migrations
  migration_template "create_blobs.rb", "db/migrate/create_blobs.rb"
  sleep 1 # Ensure unique timestamp
  migration_template "create_attachments.rb", "db/migrate/create_attachments.rb"
end

#create_initializerObject



21
22
23
# File 'lib/generators/laserblob/install/install_generator.rb', line 21

def create_initializer
  template "initializer.rb", "config/initializers/laserblob.rb"
end

#show_readmeObject



25
26
27
# File 'lib/generators/laserblob/install/install_generator.rb', line 25

def show_readme
  readme "README" if behavior == :invoke
end