Class: HowAreWeDoing::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/generators/how_are_we_doing/install/install_generator.rb', line 8

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

Instance Method Details

#generate_assetsObject



16
17
18
# File 'lib/generators/how_are_we_doing/install/install_generator.rb', line 16

def generate_assets
  directory "public/", "public/"
end

#generate_controllersObject



20
21
22
# File 'lib/generators/how_are_we_doing/install/install_generator.rb', line 20

def generate_controllers
  #template "app/controllers/authentications_controller.rb", "app/controllers/authentications_controller.rb"
end

#generate_migrationsObject



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

def generate_migrations
  migration_template "db/migrate/create_views.rb", "db/migrate/create_views.rb" rescue true
  migration_template "db/migrate/create_shares.rb", "db/migrate/create_shares.rb" rescue true
  migration_template "db/migrate/create_prints.rb", "db/migrate/create_prints.rb" rescue true
  migration_template "db/migrate/create_totals.rb", "db/migrate/create_totals.rb" rescue true
end

#generate_routesObject



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

def generate_routes
  route("match '/reports' => 'reports#index'")
  route("match ':parent_type/:parent_id/reports' => 'reports#index'")
  route("match ':viewable_type/:viewable_id/views' => 'views#create', :via => :post")
  route("match ':printable_type/:printable_id/prints' => 'prints#create', :via => :post")
  route("match ':shareable_type/:shareable_id/shares' => 'shares#create', :via => :post")
end