eris 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/eris/lib/eris_config.rb +7 -3
- data/lib/eris/templates/ci_build.sh +1 -1
- data/lib/eris/templates/eris_config.json +2 -1
- data/lib/eris/version.rb +1 -1
- data/spec/fixtures/sample_app/eris_config.json +2 -1
- data/spec/lib/eris/lib/eris_config_spec.rb +12 -2
- data/spec/lib/eris/tasks/generator_spec.rb +3 -2
- data/spec/spec_helper.rb +1 -0
- metadata +3 -3
data/lib/eris/lib/eris_config.rb
CHANGED
@@ -7,11 +7,15 @@ class ErisConfig
|
|
7
7
|
@app_root = opts[:app_root]
|
8
8
|
end
|
9
9
|
|
10
|
+
def enyo_root_for_environment
|
11
|
+
ENV['IS_CI_BOX'] == "true" ? @config_hash['ciEnyoRoot'] : @config_hash['localEnyoRoot']
|
12
|
+
end
|
13
|
+
|
10
14
|
def enyo_root
|
11
|
-
if Pathname.new(
|
12
|
-
|
15
|
+
if Pathname.new(enyo_root_for_environment).absolute?
|
16
|
+
enyo_root_for_environment
|
13
17
|
else
|
14
|
-
File.join(@app_root,
|
18
|
+
File.join(@app_root, enyo_root_for_environment)
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
data/lib/eris/version.rb
CHANGED
@@ -12,14 +12,24 @@ describe "Eris Config" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should not append the app_root path if an absolute path is given" do
|
15
|
-
File.stub!(:read).and_return('{"
|
15
|
+
File.stub!(:read).and_return('{"localEnyoRoot": "/foo/bar" }')
|
16
16
|
config = ErisConfig.new(:config_path => @config_path, :app_root => @app_root)
|
17
17
|
config.enyo_root.should == '/foo/bar'
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should not append the app_root path if the path is absolute and contains .." do
|
21
|
-
File.stub!(:read).and_return('{"
|
21
|
+
File.stub!(:read).and_return('{"localEnyoRoot": "/foo/bar/../baz" }')
|
22
22
|
config = ErisConfig.new(:config_path => @config_path, :app_root => @app_root)
|
23
23
|
config.enyo_root.should == '/foo/bar/../baz'
|
24
24
|
end
|
25
|
+
|
26
|
+
describe "if IS_CI_BOX environment variable is set to true" do
|
27
|
+
it "should use the ciEnyoRoot" do
|
28
|
+
old_env_value = ENV['IS_CI_BOX']
|
29
|
+
ENV['IS_CI_BOX'] = "true"
|
30
|
+
config = ErisConfig.new(:config_path => @config_path, :app_root => @app_root)
|
31
|
+
config.enyo_root.should == File.join(@app_root, '../ciboxenyo')
|
32
|
+
ENV['IS_CI_BOX'] = old_env_value
|
33
|
+
end
|
34
|
+
end
|
25
35
|
end
|
@@ -82,8 +82,9 @@ describe Eris do
|
|
82
82
|
|
83
83
|
it "should generate a eris_config.json" do
|
84
84
|
Dir.chdir @tmp_dir do
|
85
|
-
|
86
|
-
|
85
|
+
config = JSON.parse(File.read("eris_config.json"))
|
86
|
+
config['localEnyoRoot'].should == "/usr/palm/frameworks/"
|
87
|
+
config['ciEnyoRoot'].should == "/usr/palm/frameworks/"
|
87
88
|
end
|
88
89
|
end
|
89
90
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED