Class: Weeler::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Weeler::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/weeler/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_weeler_routes ⇒ Object
- #install_controllers ⇒ Object
- #install_initializer ⇒ Object
- #install_javascripts_assets ⇒ Object
- #install_migrations ⇒ Object
- #install_stylesheets_assets ⇒ Object
- #install_views ⇒ Object
Class Method Details
.next_migration_number(path) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/weeler/install_generator.rb', line 10 def self.next_migration_number(path) unless @prev_migration_nr @prev_migration_nr = ActiveRecord::Generators::Base.next_migration_number(path).to_i else @prev_migration_nr += 1 end @prev_migration_nr.to_s end |
Instance Method Details
#add_weeler_routes ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/generators/weeler/install_generator.rb', line 49 def add_weeler_routes weeler_routes = "mount_weeler_at \"weeler\" do \n" weeler_routes << " # weeler_resources :example, include_in_weeler_menu: true \n" weeler_routes << " # Also you orderable and imageable concerns \n" weeler_routes << " end" route weeler_routes end |
#install_controllers ⇒ Object
44 45 46 |
# File 'lib/generators/weeler/install_generator.rb', line 44 def install_controllers copy_files 'controllers', 'app/controllers' end |
#install_initializer ⇒ Object
22 23 24 |
# File 'lib/generators/weeler/install_generator.rb', line 22 def install_initializer copy_files 'initializers', 'config/initializers' end |
#install_javascripts_assets ⇒ Object
36 37 38 |
# File 'lib/generators/weeler/install_generator.rb', line 36 def install_javascripts_assets copy_files 'assets/javascripts', 'lib/assets/javascripts' end |
#install_migrations ⇒ Object
26 27 28 29 30 |
# File 'lib/generators/weeler/install_generator.rb', line 26 def install_migrations get_file_list('migrations').each do |migration| migration_template "migrations/#{migration}", "db/migrate/#{migration}" end end |
#install_stylesheets_assets ⇒ Object
40 41 42 |
# File 'lib/generators/weeler/install_generator.rb', line 40 def install_stylesheets_assets copy_files 'assets/stylesheets', 'lib/assets/stylesheets' end |
#install_views ⇒ Object
32 33 34 |
# File 'lib/generators/weeler/install_generator.rb', line 32 def install_views copy_files 'views', 'app/views' end |