module Install::Figaro

Public Class Methods

included(thor) click to toggle source
# File lib/myrails/modules/figaro.rb, line 3
    def self.included(thor)
      thor.class_eval do
        
        desc 'add_figaro', 'Add Figaro gem to Gemfile and run bundler'
        def add_figaro
          insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
  gem "figaro"
  CODE
          end

          run 'bundle install'
        end
        
        desc 'generate_figaro', 'Run Figaro installer'
        def generate_figaro
          run 'bundle exec figaro install'
        end
        
        desc 'generate_example', 'Create example application.yml file'
        def generate_example
          copy_file 'rails/config/application.example.yml', 'config/application.example.yml'
        end
        
        desc 'setup_figaro', 'Install and configure figaro gem'
        def setup_figaro
          add_figaro
          generate_figaro
          generate_example
        end

      end
    end

Public Instance Methods

add_figaro() click to toggle source
# File lib/myrails/modules/figaro.rb, line 7
        def add_figaro
          insert_into_file 'Gemfile', after: "gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n" do <<-CODE
  gem "figaro"
  CODE
          end

          run 'bundle install'
        end
generate_example() click to toggle source
# File lib/myrails/modules/figaro.rb, line 22
def generate_example
  copy_file 'rails/config/application.example.yml', 'config/application.example.yml'
end
generate_figaro() click to toggle source
# File lib/myrails/modules/figaro.rb, line 17
def generate_figaro
  run 'bundle exec figaro install'
end
setup_figaro() click to toggle source
# File lib/myrails/modules/figaro.rb, line 27
def setup_figaro
  add_figaro
  generate_figaro
  generate_example
end