Class: ActivityNotification::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ActivityNotification::Generators::InstallGenerator
- Defined in:
- lib/generators/activity_notification/install_generator.rb
Overview
Install generator to copy initializer and locale file to rails application.
Instance Method Summary collapse
-
#copy_initializer ⇒ Object
Copies initializer file in application directory.
-
#copy_locale ⇒ Object
Copies locale files in application directory.
-
#show_readme ⇒ Object
Shows readme to console.
Instance Method Details
#copy_initializer ⇒ Object
Copies initializer file in application directory
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/generators/activity_notification/install_generator.rb', line 15 def copy_initializer unless [:active_record, :mongoid].include?([:orm]) raise TypeError, <<-ERROR.strip_heredoc Currently ActivityNotification is only supported with ActiveRecord or Mongoid ORM. Be sure to have an ActiveRecord or MongoidORM loaded in your app or configure your own at `config/application.rb`. config.generators do |g| g.orm :active_record end ERROR end template "activity_notification.rb", "config/initializers/activity_notification.rb" end |
#copy_locale ⇒ Object
Copies locale files in application directory
32 33 34 |
# File 'lib/generators/activity_notification/install_generator.rb', line 32 def copy_locale template "locales/en.yml", "config/locales/activity_notification.en.yml" end |
#show_readme ⇒ Object
Shows readme to console
37 38 39 |
# File 'lib/generators/activity_notification/install_generator.rb', line 37 def show_readme readme "README" if behavior == :invoke end |