Skip to content

Commit

Permalink
Merge pull request #197 from vccw-team/load-env-on-spec-helper
Browse files Browse the repository at this point in the history
load env on spec_helper.rb
  • Loading branch information
miya0001 authored Jan 15, 2017
2 parents 4afa17e + f48e71f commit a7e632e
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'serverspec'
require 'docker'
require 'json'

$conf = YAML.load(
File.open(
Expand All @@ -8,28 +9,13 @@
).read
)

if File.exists?(File.join(ENV["HOME"], '.vccw/config.yml'))
_custom = YAML.load(
File.open(
File.join(ENV["HOME"], '.vccw/config.yml'),
File::RDONLY
).read
)
$conf.merge!(_custom) if _custom.is_a?(Hash)
if ENV['ANSIBLE_ENV'].instance_of?( String )
site = JSON.parse( ENV['ANSIBLE_ENV'] );
$conf.merge!( site ) if site.is_a?( Hash );
end

if File.exists?('site.yml')
_site = YAML.load(
File.open(
'site.yml',
File::RDONLY
).read
)
$conf.merge!(_site) if _site.is_a?(Hash)
end

$conf["vagrant_dir"] = "/vagrant"
$conf["user"] = "ubuntu"
$conf["vagrant_dir"] = "/vagrant"

# set :backend, :ssh

Expand Down

0 comments on commit a7e632e

Please sign in to comment.