eris 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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(@config_hash['enyoRoot']).absolute?
12
- @config_hash['enyoRoot']
15
+ if Pathname.new(enyo_root_for_environment).absolute?
16
+ enyo_root_for_environment
13
17
  else
14
- File.join(@app_root, @config_hash['enyoRoot'])
18
+ File.join(@app_root, enyo_root_for_environment)
15
19
  end
16
20
  end
17
21
  end
@@ -13,4 +13,4 @@ echo USER=$USER && ruby --version && which ruby && which bundle
13
13
  # conditionally install project gems from Gemfile
14
14
  bundle check || bundle install --deployment || exit 1
15
15
 
16
- bundle exec rake jasmine:ci
16
+ IS_CI_BOX=true bundle exec rake jasmine:ci
@@ -1,3 +1,4 @@
1
1
  {
2
- "enyoRoot": "/Users/pivotal/workspace/"
2
+ "localEnyoRoot": "/usr/palm/frameworks/",
3
+ "ciEnyoRoot": "/usr/palm/frameworks/"
3
4
  }
@@ -1,3 +1,3 @@
1
1
  module Eris
2
- Eris::VERSION = "0.0.1"
2
+ Eris::VERSION = "0.0.2"
3
3
  end
@@ -1,3 +1,4 @@
1
1
  {
2
- "enyoRoot": "../"
2
+ "localEnyoRoot": "../",
3
+ "ciEnyoRoot": "../ciboxenyo"
3
4
  }
@@ -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('{"enyoRoot": "/foo/bar" }')
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('{"enyoRoot": "/foo/bar/../baz" }')
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
- contents = File.read("eris_config.json")
86
- contents.should include('enyoRoot')
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
@@ -3,6 +3,7 @@ require 'bundler/setup'
3
3
  require 'rack/test'
4
4
  require 'nokogiri'
5
5
  require 'uri'
6
+ require 'json'
6
7
 
7
8
  require 'vcr'
8
9
  require 'rspec'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eris
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - HP webOS