Class: Notifications::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Notifications::Generators::InstallGenerator
- Defined in:
- lib/generators/notifications/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_initializer ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/notifications/install_generator.rb', line 8 def add_initializer path = "#{Rails.root}/config/initializers/notifications.rb" if File.exist?(path) puts 'Skipping config/initializers/notifications.rb creation, as file already exists!' else puts 'Adding Notifications initializer (config/initializers/notifications.rb)...' template 'config/initializers/notifications.rb', path end end |
#add_migrations ⇒ Object
32 33 34 |
# File 'lib/generators/notifications/install_generator.rb', line 32 def add_migrations exec('rake notifications:install:migrations') end |
#add_models ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/notifications/install_generator.rb', line 18 def add_models path = "#{Rails.root}/app/models/notification.rb" if File.exist?(path) puts 'Skipping notification.rb creation, as file already exists!' else puts 'Adding model (notification.rb)...' template 'app/models/notification.rb', path end end |
#add_routes ⇒ Object
28 29 30 |
# File 'lib/generators/notifications/install_generator.rb', line 28 def add_routes route 'mount Notifications::Engine => "/notifications"' end |