Class: Boring::Dotenv::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
BoringGenerators::GeneratorHelper
Defined in:
lib/generators/boring/dotenv/install/install_generator.rb

Instance Method Summary collapse

Methods included from BoringGenerators::GeneratorHelper

#app_ruby_version, #bundle_install, #check_and_install_gem, #gem_installed?, #inject_into_file_if_new

Instance Method Details

#add_dotenv_gemObject



13
14
15
16
17
18
19
# File 'lib/generators/boring/dotenv/install/install_generator.rb', line 13

def add_dotenv_gem
  return if gem_installed?("dotenv-rails")

  say "Adding dotenv gem", :green

  check_and_install_gem "dotenv-rails", group: :development
end

#configure_dotenv_gemObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/boring/dotenv/install/install_generator.rb', line 21

def configure_dotenv_gem
  say "Configuring dotenv gem", :green

  template ".env", ".env"

  create_file ".gitignore" unless File.exist?(".gitignore")

  FileUtils.cp(".env", ".env.sample")

  add_env_files_to_gitignore
end