Class: Recipes::Pundit
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Recipes::Pundit
- Defined in:
- lib/potassium/recipes/pundit.rb
Instance Method Summary collapse
- #ask ⇒ Object
- #create ⇒ Object
- #install ⇒ Object
- #install_admin_pundit ⇒ Object
- #installed? ⇒ Boolean
Instance Method Details
#ask ⇒ Object
2 3 4 5 6 7 |
# File 'lib/potassium/recipes/pundit.rb', line 2 def ask if get(:authentication).present? use_pundit = answer(:pundit) { Ask.confirm("Do you want to use Pundit for authorization?") } set(:authorization, use_pundit) end end |
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/potassium/recipes/pundit.rb', line 9 def create if selected?(:authorization) run_pundit_installer recipe = self if selected?(:admin_mode) after(:admin_install) do recipe.install_admin_pundit end end end end |
#install ⇒ Object
22 23 24 25 26 27 |
# File 'lib/potassium/recipes/pundit.rb', line 22 def install run_pundit_installer active_admin = load_recipe(:admin) install_admin_pundit if active_admin.installed? end |
#install_admin_pundit ⇒ Object
33 34 35 36 |
# File 'lib/potassium/recipes/pundit.rb', line 33 def install_admin_pundit configure_active_admin_initializer copy_policies end |
#installed? ⇒ Boolean
29 30 31 |
# File 'lib/potassium/recipes/pundit.rb', line 29 def installed? gem_exists?(/pundit/) end |