module Install::Draper

Public Class Methods

included(thor) click to toggle source
# 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

Public Instance Methods

add_draper_gem() click to toggle source
# File lib/myrails/modules/draper.rb, line 7
        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
create_draper_application_decorator() click to toggle source
# File lib/myrails/modules/draper.rb, line 17
def create_draper_application_decorator
  copy_file 'rails/app/decorators/application_decorator.rb', 'app/decorators/application_decorator.rb'
end
setup_draper() click to toggle source
# File lib/myrails/modules/draper.rb, line 22
def setup_draper
  add_draper_gem
  create_draper_application_decorator
end