Module: Install::Figaro

Defined in:
lib/myrails/modules/figaro.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
28
29
30
31
32
33
34
# 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