diff --git a/Gemfile b/Gemfile index 4a270c85..522678c7 100644 --- a/Gemfile +++ b/Gemfile @@ -7,4 +7,5 @@ gem 'rubyzip', rubyzip_version if rubyzip_version && !rubyzip_version.empty? group :development, :test do gem 'rdoc', ['>= 3.10', '< 4.3'], :require => nil + gem 'dotenv' end diff --git a/lib/warbler/jar.rb b/lib/warbler/jar.rb index 9665efb9..5e842ca6 100644 --- a/lib/warbler/jar.rb +++ b/lib/warbler/jar.rb @@ -285,7 +285,7 @@ def add_with_pathmaps(config, f, map_type) def expand_erb(file, config) require 'erb' - erb = ERB.new(File.read(file), nil, '-') + erb = ERB.new(File.read(file), trim_mode: '-') StringIO.new(erb.result(erb_binding(config))) end diff --git a/spec/warbler/web_server_spec.rb b/spec/warbler/web_server_spec.rb index 8da8c1eb..cff2d1c0 100644 --- a/spec/warbler/web_server_spec.rb +++ b/spec/warbler/web_server_spec.rb @@ -1,4 +1,6 @@ require File.expand_path('../../spec_helper', __FILE__) +require 'dotenv' + class Warbler::WebServer::Artifact def self.reset_local_repository @@ -8,9 +10,19 @@ def self.reset_local_repository describe Warbler::WebServer::Artifact do - @@_env = ENV.to_h + #@@_env = ENV.to_h + Dotenv.load + + before(:all) do + @original_env = ENV.to_h + end + + after(:all) do + ENV.clear + @original_env.each { |k, v| ENV[k] = v } + end - after(:all) { ENV.clear; ENV.update @@_env } + # after(:all) { ENV.clear; ENV.update @@_env } before do Warbler::WebServer::Artifact.reset_local_repository