Class: BrighterPlanet::Deploy::Cm1

Inherits:
Object
  • Object
show all
Includes:
ReadsFromPublicUrl, Singleton
Defined in:
lib/brighter_planet_deploy/cm1.rb

Constant Summary collapse

RED_IP =
'184.73.240.13'
WANTS =
[
  :resque_redis_url,
  :incoming_queue,
  :color,
  :role,
  :environment,
  :log_dir,
  :phase,
  :carrier, # amazon
  :ey_app,  # cm1_edge_blue
  :service
]

Instance Method Summary collapse

Methods included from ReadsFromPublicUrl

#from_public_url

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_id, *args) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/brighter_planet_deploy/cm1.rb', line 42

def method_missing(method_id, *args)
  if args.length == 0 and not block_given?
    from_public_url method_id
  else
    super
  end
end

Instance Method Details

#colorObject



34
35
36
37
38
39
40
# File 'lib/brighter_planet_deploy/cm1.rb', line 34

def color
  if Deploy.instance.servers.me.service.to_s.underscore == 'cm1'
    (AuthoritativeDnsResolver.getaddress(domain) == RED_IP) ? 'red' : 'blue'
  else
    from_public_url :color
  end
end

#domainObject



26
27
28
# File 'lib/brighter_planet_deploy/cm1.rb', line 26

def domain
  'carbon.brighterplanet.com'
end

#endpointObject



30
31
32
# File 'lib/brighter_planet_deploy/cm1.rb', line 30

def endpoint
  "http://#{domain}"
end

#serviceObject



22
23
24
# File 'lib/brighter_planet_deploy/cm1.rb', line 22

def service
  self.class.to_s.demodulize
end