Class: Feedy::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Feedy::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/feedy/install_generator.rb
Instance Attribute Summary collapse
-
#current_user_helper ⇒ Object
readonly
Returns the value of attribute current_user_helper.
-
#user_class ⇒ Object
readonly
Returns the value of attribute user_class.
Instance Method Summary collapse
- #copy_initializer ⇒ Object
- #copy_migration_file ⇒ Object
- #determine_current_user_helper ⇒ Object
- #determine_user_class ⇒ Object
- #mount_engine ⇒ Object
Instance Attribute Details
#current_user_helper ⇒ Object (readonly)
Returns the value of attribute current_user_helper.
11 12 13 |
# File 'lib/generators/feedy/install_generator.rb', line 11 def current_user_helper @current_user_helper end |
#user_class ⇒ Object (readonly)
Returns the value of attribute user_class.
11 12 13 |
# File 'lib/generators/feedy/install_generator.rb', line 11 def user_class @user_class end |
Instance Method Details
#copy_initializer ⇒ Object
35 36 37 38 |
# File 'lib/generators/feedy/install_generator.rb', line 35 def copy_initializer puts "Adding Feedy initializer (config/initializers/feedy.rb)..." template 'initializer.rb', 'config/initializers/feedy.rb' end |
#copy_migration_file ⇒ Object
16 17 18 19 20 21 |
# File 'lib/generators/feedy/install_generator.rb', line 16 def copy_migration_file puts "Copying over Feedy migrations..." Dir.chdir(Rails.root) do `rake feedy:install:migrations` end end |
#determine_current_user_helper ⇒ Object
29 30 31 32 33 |
# File 'lib/generators/feedy/install_generator.rb', line 29 def determine_current_user_helper @current_user_helper = ["current_user_helper"].presence || ask("What is the current user helper in your application? [current_user]").presence || 'current_user' end |
#determine_user_class ⇒ Object
23 24 25 26 27 |
# File 'lib/generators/feedy/install_generator.rb', line 23 def determine_user_class @user_class = ["user_class"].presence || ask("What is your user class called? [User]").presence || "User" end |
#mount_engine ⇒ Object
40 41 42 43 |
# File 'lib/generators/feedy/install_generator.rb', line 40 def mount_engine puts "Mounting Feedy engine (config/routes.rb)..." route 'mount Feedy::Engine, at: "/feedy"' end |