cloudfoundry-env 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -49,6 +49,10 @@ freq = 60 + (60 * 5 * (CloudFoundry::Environment.instance_index || 0))
49
49
  * instance_index - Returns integer with instance index starting at 1
50
50
  * running_local? - returns `true` if the app is not running on a CloudFoundry instance
51
51
  * is_prod_app?(regex) - Returns `true` if the app name starts with regex provided. Good for having staging and prod apps
52
+ * first_url - Returns the first url for the app or nil
53
+ * app_info - returns the entire environment described by VCAP_APPLICATION
54
+
55
+ ``` ruby
52
56
 
53
57
  * services - Returns a Hashie::Mash representation of the services so it can be used as a class with native attributes
54
58
  * Cloud Foundry Services - http://start.cloudfoundry.com/services.html
@@ -25,6 +25,10 @@ module CloudFoundry
25
25
  Hashie::Mash.new(JSON.parse(raw_vcap_app)) if raw_vcap_app
26
26
  end
27
27
 
28
+ def first_url
29
+ raw_uris.first if raw_uris
30
+ end
31
+
28
32
  def running_local?
29
33
  app_info.nil?
30
34
  end
@@ -1,5 +1,5 @@
1
1
  module Cloudfoundry
2
2
  module Environment
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ describe "CloudFoundry::Environment" do
5
5
  it "Should recognize when its not running on Cloud Foundry" do
6
6
  cf = CloudFoundry::Environment
7
7
  cf.port.should be_nil
8
+ cf.first_url.should be_nil
8
9
  cf.running_local?.should be_true
9
10
  cf.raw_app_version.should be_nil
10
11
  cf.redis_cnx.should be_nil
@@ -22,6 +23,7 @@ describe "CloudFoundry::Environment" do
22
23
 
23
24
  cf = CloudFoundry::Environment
24
25
  cf.port.should == 9456
26
+ cf.first_url.should == "www-newstage2.cloudfoundry.com"
25
27
  cf.running_local?.should be_false
26
28
  cf.raw_uris.should include "www-newstage2.cloudfoundry.com"
27
29
  cf.is_prod_app?.should be_false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudfoundry-env
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-19 00:00:00.000000000Z
12
+ date: 2012-03-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70203930070160 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70203930070160
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: hashie
27
- requirement: &70203930069740 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70203930069740
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description: App Name, App Owner, Port Number, Host, Services, Instances
37
47
  email:
38
48
  - monica.keller@gmail.com
@@ -78,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
88
  version: '0'
79
89
  requirements: []
80
90
  rubyforge_project: cloudfoundry-env
81
- rubygems_version: 1.8.17
91
+ rubygems_version: 1.8.19
82
92
  signing_key:
83
93
  specification_version: 3
84
94
  summary: Ruby Apps can use gem to parse the Cloud Foundry Environment