Class: UcbRails::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Extended by:
ActiveRecord::Generators::Migration
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/ucb_rails/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/generators/ucb_rails/install_generator.rb', line 31

def self.next_migration_number(path)
  unless @prev_migration_nr
    @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
  else
    @prev_migration_nr += 1
  end
  @prev_migration_nr.to_s
end

Instance Method Details

#installObject



15
16
17
18
19
20
21
22
23
# File 'lib/generators/ucb_rails/install_generator.rb', line 15

def install
  return if options.readme?
  
  directory 'app/assets'
  directory 'app/helpers'
  directory 'app/views'
  directory 'config'
  install_migrations
end

#show_readmeObject



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

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