Sha256: 1e9a9c7aca4a51db9bf4f1c107357fdef7af4b281fff32db74a339e2ae710482

Contents?: true

Size: 845 Bytes

Versions: 33

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

require_relative "../../lib/plutonium_generators"

module Pu
  module Gem
    class DotenvGenerator < Rails::Generators::Base
      include PlutoniumGenerators::Generator

      source_root File.expand_path("templates", __dir__)

      desc "Set up dotenv"

      def start
        in_root do
          [".env", ".env.local", ".env.template", ".env.local.template"].each do |file|
            copy_file file
          end

          copy_file "config/initializers/001_ensure_required_env.rb"

          gitignore "!/.env.template", "!/.env.local.template", "!/.env"

          insert_into_file "Gemfile", "\ngem \"dotenv\", :groups => [:development, :test]\n", after: /^gem ["']rails["'].*\n/
          bundle!
        end
      rescue => e
        exception "#{self.class} failed:", e
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
plutonium-0.15.6 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.5 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.4 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.3 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.2 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.1 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.0 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.0.pre.rc3 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.0.pre.rc2 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.15.0.pre.rc1 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.14.1 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.14.0 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.13.3 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.13.2 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.13.1 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.13.0 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.12.14 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.12.13 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.12.12 lib/generators/pu/gem/dotenv/dotenv_generator.rb
plutonium-0.12.11 lib/generators/pu/gem/dotenv/dotenv_generator.rb