Class: ExceptionHunter::CreateUsersGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ExceptionHunter::CreateUsersGenerator
- Defined in:
- lib/generators/exception_hunter/create_users/create_users_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_admin_user ⇒ Object
24 25 26 |
# File 'lib/generators/exception_hunter/create_users/create_users_generator.rb', line 24 def create_admin_user invoke 'devise', [name], routes: false end |
#install_devise ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/exception_hunter/create_users/create_users_generator.rb', line 5 def install_devise begin require 'devise' rescue LoadError log :error, 'Please install devise and require add it to your gemfile or run with --skip-users' exit(false) end initializer_file = File.join(destination_root, 'config', 'initializers', 'devise.rb') if File.exist?(initializer_file) log :generate, 'No need to install devise, already done.' else log :generate, 'devise:install' invoke 'devise:install' end end |
#remove_registerable_from_model ⇒ Object
28 29 30 31 32 33 |
# File 'lib/generators/exception_hunter/create_users/create_users_generator.rb', line 28 def remove_registerable_from_model return if [:registerable] model_file = File.join(destination_root, 'app', 'models', "#{file_path}.rb") gsub_file model_file, /\:registerable([.]*,)?/, '' end |