Module: Stationed::Generators::Plugins::Pundit
- Included in:
- AppGenerator
- Defined in:
- lib/stationed/generators/plugins/pundit.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.prepended(base) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/stationed/generators/plugins/pundit.rb', line 5 def self.prepended(base) base.class_option :pundit, type: :boolean, default: true, desc: 'Include and configure Pundit for authorization' end |
Instance Method Details
#finish_template ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/stationed/generators/plugins/pundit.rb', line 12 def finish_template return super unless [:pundit] gem 'pundit' copy_file 'pundit.rb', 'spec/support/pundit.rb' copy_file 'authorization.rb', 'app/controllers/concerns/authorization.rb' inject_into_class 'app/controllers/application_controller.rb', 'ApplicationController', "\n include Authorization\n\n" super end |
#run_bundle ⇒ Object
21 22 23 24 25 |
# File 'lib/stationed/generators/plugins/pundit.rb', line 21 def run_bundle super return unless [:pundit] generate 'pundit:install' end |