Ambient Orb and Damage Control

October 26, 2005 Link to post  Permalink

I’m running Damage Control 0.5.0.1404 This code has some stubbed out code that can be used to have a build update your Ambient Orb when the build is complete.

Since I have my fancy new ambient project on rubyforge, I decided to flesh out this stub code to update my orb on build completion.

This code replaces the content of the ambient_orb.rb file in the lib/damagecontrol/publisher directory:

 1equire 'damagecontrol/publisher/base'
 2require 'ambient'
 3
 4module DamageControl
 5  module Publisher
 6    class AmbientOrb < Base
 7      register self
 8      attr_accessor :enabled
 9
10      ann :description => "Ambient Orb ID"
11      attr_accessor :orb_id
12
13      def initialize
14        @orb_id = ""
15      end
16      
17      def name
18        "Ambient Orb"
19      end    
20
21      def publish(build)
22          color = :green
23          color = :red if build.status_message == 'Failed'
24          Log.info("Set Orb #{@orb_id} to #{color}")
25          
26          begin
27                  Ambient::Orb.new(:id => @orb_id,  :color => color).update 
28          rescue 
29                  Log.warn("Error updating Ambient Orb")
30          end
31      end
32    end
33  end
34end

The file can be downloaded from here: ambient_orb.rb