Class: DeviseSmsActivable::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- DeviseSmsActivable::Generators::InstallGenerator
- Defined in:
- lib/generators/devise_sms_activable/install_generator.rb
Instance Method Summary collapse
-
#add_config_options_to_initializer ⇒ Object
def devise_install invoke “devise:install” end.
- #copy_default_smser ⇒ Object
- #copy_locale ⇒ Object
Instance Method Details
#add_config_options_to_initializer ⇒ Object
def devise_install
invoke "devise:install"
end
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/generators/devise_sms_activable/install_generator.rb', line 11 def devise_initializer_path = "config/initializers/devise.rb" if File.exist?(devise_initializer_path) old_content = File.read(devise_initializer_path) if old_content.match(Regexp.new(/^\s# ==> Configuration for :sms_activable\n/)) false else inject_into_file(devise_initializer_path, :before => " # ==> Configuration for :confirmable\n") do <<-CONTENT # ==> Configuration for :sms_activable # The period the generated sms token is valid, after # this period, the user won't be able to activate. # config.sms_confirm_within = 0.days # The keys searched for confirmation values. # config.sms_confirmation_keys = [:email] # Your SmsSender class. The provided one uses # moonshado-sms gem so install it and configure # if you want to use it. # A simple instance of the class has been copied in your lib folder # For further informations on using and configuring moonshado-sms gem check # https://github.com/moonshado/moonshado-sms # config.sms_sender = "Devise::SmsSender" CONTENT end end end end |
#copy_default_smser ⇒ Object
47 48 49 |
# File 'lib/generators/devise_sms_activable/install_generator.rb', line 47 def copy_default_smser copy_file "lib/sms_sender.rb", "lib/devise_sms_sender.rb" end |
#copy_locale ⇒ Object
43 44 45 |
# File 'lib/generators/devise_sms_activable/install_generator.rb', line 43 def copy_locale copy_file "../../../config/locales/en.yml", "config/locales/devise_sms_activable.en.yml" end |