Sha256: 4bc03d41842c4bb0604a9ca1865102d7c8846464aff1bcdb498d1b1ff2686927
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
require 'rails/generators/base' module ActivityNotification module Generators #:nodoc: # Install generator to copy initializer and locale file to rails application. # @example Run install generator # rails generate activity_notification:install class InstallGenerator < Rails::Generators::Base source_root File.expand_path("../../templates", __FILE__) desc "Creates a ActivityNotification initializer and copy locale files to your application." class_option :orm # Copies initializer file in application directory def copy_initializer #TODO suport other orm e.g. mongoid unless options[:orm] == :active_record raise TypeError, <<-ERROR.strip_heredoc Currently ActivityNotification is only supported with Active Record ORM. Be sure to have an Active Record ORM 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 # Copies locale files in application directory def copy_locale template "locales/en.yml", "config/locales/activity_notification.en.yml" end # Shows readme to console def show_readme readme "README" if behavior == :invoke end end end end
Version data entries
3 entries across 3 versions & 1 rubygems