Class: Recipes::Draper

Inherits:
Rails::AppBuilder
  • Object
show all
Defined in:
lib/potassium/recipes/draper.rb

Instance Method Summary collapse

Instance Method Details

#add_draperObject



20
21
22
23
24
# File 'lib/potassium/recipes/draper.rb', line 20

def add_draper
  gather_gem 'draper', '~> 3.1'
  add_readme_section :internal_dependencies, :draper
  create_file 'app/decorators/.keep'
end

#askObject



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

#createObject



7
8
9
10
# File 'lib/potassium/recipes/draper.rb', line 7

def create
  return unless selected?(:draper)
  add_draper
end

#installObject



16
17
18
# File 'lib/potassium/recipes/draper.rb', line 16

def install
  add_draper
end

#installed?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/potassium/recipes/draper.rb', line 12

def installed?
  gem_exists?(/draper/)
end