Class: Recipes::Draper
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Recipes::Draper
- Defined in:
- lib/potassium/recipes/draper.rb
Instance Method Summary collapse
- #add_api_responder ⇒ Object
- #add_draper ⇒ Object
- #ask ⇒ Object
- #create ⇒ Object
- #install ⇒ Object
- #installed? ⇒ Boolean
Instance Method Details
#add_api_responder ⇒ Object
29 30 31 32 33 |
# File 'lib/potassium/recipes/draper.rb', line 29 def add_api_responder after(:gem_install) do copy_file '../assets/api/draper_responder.rb', 'app/responders/api_responder.rb', force: true end end |
#add_draper ⇒ Object
23 24 25 26 27 |
# File 'lib/potassium/recipes/draper.rb', line 23 def add_draper gather_gem 'draper', '3.0.0.pre1' add_readme_section :internal_dependencies, :draper create_file 'app/decorators/.keep' end |
#ask ⇒ Object
2 3 4 5 |
# File 'lib/potassium/recipes/draper.rb', line 2 def ask draper = answer(:draper) { Ask.confirm('Do you want to use Draper to decorate models?') } set(:draper, draper) end |
#create ⇒ Object
7 8 9 10 11 |
# File 'lib/potassium/recipes/draper.rb', line 7 def create return unless selected?(:draper) add_draper add_api_responder if selected?(:api_support) end |
#install ⇒ Object
17 18 19 20 21 |
# File 'lib/potassium/recipes/draper.rb', line 17 def install add_draper api_recipe = load_recipe(:api) add_api_responder if api_recipe.installed? end |
#installed? ⇒ Boolean
13 14 15 |
# File 'lib/potassium/recipes/draper.rb', line 13 def installed? gem_exists?(/draper/) end |