Class: Recipes::Env

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

Instance Method Summary collapse

Instance Method Details

#createObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/potassium/recipes/env.rb', line 2

def create
  gather_gems(:development, :test) do
    gather_gem('dotenv-rails')
  end

  template '../assets/.env.development.erb', '.env.development'
  append_to_file '.gitignore', ".env.local\n"
  append_to_file '.gitignore', ".env\n"

  env_config =
    <<~RUBY
      config.before_configuration do
        Dotenv.load(Dotenv::Railtie.root.join('.env.development'))
      end
    RUBY
  application env_config, env: 'test'
end