Ambient Orb and Damage Control

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:

require 'damagecontrol/publisher/base'
require 'ambient'

module DamageControl
  module Publisher
    class AmbientOrb < Base
      register self
      attr_accessor :enabled

      ann :description => "Ambient Orb ID"
      attr_accessor :orb_id

      def initialize
        @orb_id = ""
      end

      def name
        "Ambient Orb"
      end    

      def publish(build)
          color = :green
          color = :red if build.status_message == 'Failed'
          Log.info("Set Orb #{@orb_id} to #{color}")

      begin
          Ambient::Orb.new(:id => @orb_id,  :color => color).update 
      rescue 
          Log.warn("Error updating Ambient Orb")
      end
      end
    end
  end
end

The file can be downloaded from here: ambient_orb.rb

This entry was posted on Wed, 26 Oct 2005 20:32:00 GMT . You can follow any any response to this entry through the Atom feed. You can leave a comment .
Tags


Comments

Leave a response

Leave a comment