Module: Install::Draper

Defined in:
lib/myrails/modules/draper.rb

Class Method Summary collapse

Class Method Details

.included(thor) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/myrails/modules/draper.rb', line 3

def self.included(thor)
  thor.class_eval do
    
    desc 'add_draper_gem', 'Add draper gem to Gemfile and run bundler'
    def add_draper_gem
      insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
gem 'draper'
CODE
      end
    
      run 'bundle install'
    end
    
    desc 'create_draper_application_decorator', 'Generate draper application decorator'
    def create_draper_application_decorator
      copy_file 'rails/app/decorators/application_decorator.rb', 'app/decorators/application_decorator.rb'
    end
    
    desc 'setup_draper', 'Install draper gem'
    def setup_draper
      add_draper_gem
      create_draper_application_decorator
    end
  end
end