brighter_planet_deploy 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/brighter_planet_deploy.gemspec +1 -0
- data/lib/brighter_planet_deploy/{emission_estimate_service.rb → cm1.rb} +6 -6
- data/lib/brighter_planet_deploy/server.rb +5 -5
- data/lib/brighter_planet_deploy/version.rb +1 -1
- data/lib/brighter_planet_deploy.rb +3 -3
- data/test/helper.rb +1 -0
- data/test/test_cm1.rb +5 -5
- metadata +31 -20
@@ -1,6 +1,6 @@
|
|
1
1
|
module BrighterPlanet
|
2
2
|
class Deploy
|
3
|
-
class
|
3
|
+
class Cm1
|
4
4
|
include ::Singleton
|
5
5
|
include ReadsFromPublicUrl
|
6
6
|
|
@@ -19,6 +19,10 @@ module BrighterPlanet
|
|
19
19
|
:service
|
20
20
|
]
|
21
21
|
|
22
|
+
def service
|
23
|
+
self.class.to_s.demodulize
|
24
|
+
end
|
25
|
+
|
22
26
|
def domain
|
23
27
|
'carbon.brighterplanet.com'
|
24
28
|
end
|
@@ -27,12 +31,8 @@ module BrighterPlanet
|
|
27
31
|
"http://#{domain}"
|
28
32
|
end
|
29
33
|
|
30
|
-
def name
|
31
|
-
'EmissionEstimateService'
|
32
|
-
end
|
33
|
-
|
34
34
|
def color
|
35
|
-
if Deploy.instance.servers.me.service == '
|
35
|
+
if Deploy.instance.servers.me.service.to_s.underscore == 'cm1'
|
36
36
|
(AuthoritativeDnsResolver.getaddress(domain) == RED_IP) ? 'red' : 'blue'
|
37
37
|
else
|
38
38
|
from_public_url :color
|
@@ -48,7 +48,7 @@ module BrighterPlanet
|
|
48
48
|
# can't be saved
|
49
49
|
attr_writer :status
|
50
50
|
def status
|
51
|
-
@status || (color ==
|
51
|
+
@status || (color == service_model.color ? :active : :standby)
|
52
52
|
end
|
53
53
|
|
54
54
|
attr_writer :environment
|
@@ -61,10 +61,10 @@ module BrighterPlanet
|
|
61
61
|
@hostname || lookup(:hostname) || local_hostname
|
62
62
|
end
|
63
63
|
|
64
|
-
def
|
65
|
-
case service.
|
66
|
-
when
|
67
|
-
|
64
|
+
def service_model
|
65
|
+
case service.to_s.underscore
|
66
|
+
when 'cm1'
|
67
|
+
Cm1.instance
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -10,7 +10,7 @@ module BrighterPlanet
|
|
10
10
|
include ::Singleton
|
11
11
|
|
12
12
|
autoload :Server, 'brighter_planet_deploy/server'
|
13
|
-
autoload :
|
13
|
+
autoload :Cm1, 'brighter_planet_deploy/cm1'
|
14
14
|
autoload :AuthoritativeDnsResolver, 'brighter_planet_deploy/authoritative_dns_resolver'
|
15
15
|
|
16
16
|
# mixins
|
@@ -21,8 +21,8 @@ module BrighterPlanet
|
|
21
21
|
Server
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
|
24
|
+
def cm1
|
25
|
+
Cm1.instance
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
data/test/helper.rb
CHANGED
data/test/test_cm1.rb
CHANGED
@@ -31,12 +31,12 @@ class TestCm1 < Test::Unit::TestCase
|
|
31
31
|
|
32
32
|
def test_001_color
|
33
33
|
assert_equal 'blue', @me.color
|
34
|
-
assert_equal 'blue', BrighterPlanet.deploy.
|
34
|
+
assert_equal 'blue', BrighterPlanet.deploy.cm1.color
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_003_service
|
38
|
-
assert_equal '
|
39
|
-
assert_equal '
|
38
|
+
assert_equal 'Cm1', BrighterPlanet.deploy.cm1.service
|
39
|
+
assert_equal 'Cm1', @me.service_model.service
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_004_status
|
@@ -71,9 +71,9 @@ class TestCm1 < Test::Unit::TestCase
|
|
71
71
|
def test_009_color_from_cm1_itself
|
72
72
|
FakeFS.deactivate!
|
73
73
|
Rails.root = File.expand_path("../tmp", __FILE__)
|
74
|
-
@me.service = '
|
74
|
+
@me.service = 'Cm1'
|
75
75
|
@me.save
|
76
|
-
assert_equal 'red', BrighterPlanet.deploy.
|
76
|
+
assert_equal 'red', BrighterPlanet.deploy.cm1.color
|
77
77
|
ensure
|
78
78
|
FileUtils.rm_rf File.expand_path("../tmp", __FILE__)
|
79
79
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brighter_planet_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-17 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: test-unit
|
17
|
-
requirement: &
|
17
|
+
requirement: &2153990020 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153990020
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: fakeweb
|
28
|
-
requirement: &
|
28
|
+
requirement: &2153989600 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2153989600
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: fakefs
|
39
|
-
requirement: &
|
39
|
+
requirement: &2153989180 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2153989180
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: net-dns
|
50
|
-
requirement: &
|
50
|
+
requirement: &2153988760 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2153988760
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: activesupport
|
61
|
-
requirement: &
|
61
|
+
requirement: &2153988340 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2153988340
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: i18n
|
72
|
-
requirement: &
|
72
|
+
requirement: &2153987920 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,10 +77,21 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2153987920
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rake
|
83
|
+
requirement: &2153987500 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *2153987500
|
81
92
|
- !ruby/object:Gem::Dependency
|
82
93
|
name: thor
|
83
|
-
requirement: &
|
94
|
+
requirement: &2153987080 !ruby/object:Gem::Requirement
|
84
95
|
none: false
|
85
96
|
requirements:
|
86
97
|
- - ! '>='
|
@@ -88,10 +99,10 @@ dependencies:
|
|
88
99
|
version: '0'
|
89
100
|
type: :runtime
|
90
101
|
prerelease: false
|
91
|
-
version_requirements: *
|
102
|
+
version_requirements: *2153987080
|
92
103
|
- !ruby/object:Gem::Dependency
|
93
104
|
name: eat
|
94
|
-
requirement: &
|
105
|
+
requirement: &2153986660 !ruby/object:Gem::Requirement
|
95
106
|
none: false
|
96
107
|
requirements:
|
97
108
|
- - ! '>='
|
@@ -99,7 +110,7 @@ dependencies:
|
|
99
110
|
version: '0'
|
100
111
|
type: :runtime
|
101
112
|
prerelease: false
|
102
|
-
version_requirements: *
|
113
|
+
version_requirements: *2153986660
|
103
114
|
description: Brighter Planet deployment system, published as the gem brighter_planet_deploy.
|
104
115
|
Internal use.
|
105
116
|
email:
|
@@ -116,7 +127,7 @@ files:
|
|
116
127
|
- brighter_planet_deploy.gemspec
|
117
128
|
- lib/brighter_planet_deploy.rb
|
118
129
|
- lib/brighter_planet_deploy/authoritative_dns_resolver.rb
|
119
|
-
- lib/brighter_planet_deploy/
|
130
|
+
- lib/brighter_planet_deploy/cm1.rb
|
120
131
|
- lib/brighter_planet_deploy/reads_from_local_filesystem.rb
|
121
132
|
- lib/brighter_planet_deploy/reads_from_public_url.rb
|
122
133
|
- lib/brighter_planet_deploy/server.rb
|
@@ -144,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
155
|
version: '0'
|
145
156
|
requirements: []
|
146
157
|
rubyforge_project: brighter_planet_deploy
|
147
|
-
rubygems_version: 1.8.
|
158
|
+
rubygems_version: 1.8.6
|
148
159
|
signing_key:
|
149
160
|
specification_version: 3
|
150
161
|
summary: Brighter Planet deployment system, published as the gem brighter_planet_deploy
|