load contents from env file
This commit is contained in:
1 parent
79cf541ebe
commit
e33921f083
2 files changed
+19
No files matched your search
@@ -4,5 +4,10 @@ module Foreman
|
|||||||
|
|
||||||
class AppDoesNotExist < Exception; end
|
class AppDoesNotExist < Exception; end
|
||||||
|
|
||||||
|
# load contents of env_file into ENV
|
||||||
|
def self.load!(env_file)
|
||||||
|
require 'foreman/engine'
|
||||||
|
Foreman::Engine.load_env(env_file)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -8,4 +8,18 @@ describe Foreman do
|
|||||||
it { should be_a String }
|
it { should be_a String }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "::load!(env_file)" do
|
||||||
|
before do
|
||||||
|
File.open("/tmp/env1", "w") { |f| f.puts("FOO=bar") }
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
ENV['FOO'] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should load env_file into ENV" do
|
||||||
|
Foreman.load!("/tmp/env1")
|
||||||
|
ENV['FOO'].should == 'bar'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user