Sha256: f0f087c8b2552f97d4f4b24eef66ce761177c6353f276916b220ae785c6a4be6

Contents?: true

Size: 590 Bytes

Versions: 11

Compression:

Stored size: 590 Bytes

Contents

module Dotenv
  # Class for creating a template from a env file
  class EnvTemplate
    def initialize(env_file)
      @env_file = env_file
    end

    def create_template
      File.open(@env_file, "r") do |env_file|
        File.open("#{@env_file}.template", "w") do |env_template|
          env_file.each do |line|
            var, value = line.split("=")
            is_a_comment = var.strip[0].eql?("#")
            line_transform = value.nil? || is_a_comment ? line : "#{var}=#{var}"
            env_template.puts line_transform
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
avalara_sdk-24.12.2 vendor/bundle/ruby/2.7.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
avalara_sdk-24.12.1 vendor/bundle/ruby/2.7.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
avalara_sdk-24.12.0 vendor/bundle/ruby/2.7.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
plaid-14.13.0 vendor/bundle/ruby/3.0.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
plaid-14.12.1 vendor/bundle/ruby/3.0.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
plaid-14.12.0 vendor/bundle/ruby/2.6.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
plaid-14.11.1 vendor/bundle/ruby/2.6.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
plaid-14.10.0 vendor/bundle/ruby/2.6.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
plaid-14.7.0 vendor/bundle/ruby/2.6.0/gems/dotenv-2.7.6/lib/dotenv/template.rb
dotenv-2.7.6 lib/dotenv/template.rb