Return to Snippet

Revision: 4964
at January 31, 2008 13:23 by peleteiro


Updated Code
gem "twitter4r", ">=0.3.0"
require "twitter"
require "time"

class TwitterNotifier

  attr_writer :login, :password

  def initialize(project)
    @project = project

    Twitter::Client.configure do |conf|
      conf.user_agent = 'cruisecontrolrb'
      conf.application_name = 'CruiseControl.rb'
      conf.application_version = 'v1.2.1'
      conf.application_url = 'http://cruisecontrolrb.thoughtworks.com/'
    end

    def build_finished(build)
      return unless @login and build.failed?
      Twitter::Client.new(:login => @login, :password => @password).
        status(:post, "#{build.project.name} build #{build.label} failed") rescue nil
    end

    def build_fixed(build, previous_build)
      return unless @login
      Twitter::Client.new(:login => @login, :password => @password).
        status(:post, "#{build.project.name} build #{build.label} fixed") rescue nil
    end

  end

end

Project.plugin :twitter_notifier

Revision: 4963
at January 31, 2008 07:30 by peleteiro


Updated Code
gem "twitter4r", ">=0.3.0"
require "twitter"
require "time"

class TwitterNotifier

  attr_writer :login, :password

  def initialize(project)
    @project = project

    Twitter::Client.configure do |conf|
      conf.user_agent = 'cruisecontrolrb'
      conf.application_name = 'CruiseControl.rb'
      conf.application_version = 'v1.2.1'
      conf.application_url = 'http://cruisecontrolrb.thoughtworks.com/'
    end

    def build_finished(build)
      return unless @login and build.failed?
      client = Twitter::Client.new(:login => @login, :password => @password)
      client.status(:post, "#{build.project.name} build #{build.label} failed")
    end

    def build_fixed(build, previous_build)
      return unless @login
      client = Twitter::Client.new(:login => @login, :password => @password)
      client.status(:post, "#{build.project.name} build #{build.label} fixed")
    end

  end

end

Project.plugin :twitter_notifier

Revision: 4962
at January 31, 2008 06:34 by peleteiro


Initial Code
gem "twitter4r", ">=0.3.0"
require "twitter"
require "time"

class TwitterNotifier

  attr_writer :login, :password

  def initialize(project)
    @project = project

    Twitter::Client.configure do |conf|
      conf.user_agent = 'cruisecontrolrb'
      conf.application_name = 'CruiseControl.rb'
      conf.application_version = 'v1.2.1'
      conf.application_url = 'http://cruisecontrolrb.thoughtworks.com/'
    end

    def build_finished(build)
      return if @login.empty? or not build.failed?
      client = Twitter::Client.new(:login => @login, :password => @password)
      client.status(:post, "#{build.project.name} build #{build.label} failed")
    end

    def build_fixed(build, previous_build)
      return if @login.empty?
      client = Twitter::Client.new(:login => @login, :password => @password)
      client.status(:post, "#{build.project.name} build #{build.label} fixed")
    end

  end

end

Project.plugin :twitter_notifier

Initial URL

                                

Initial Description

                                

Initial Title
Twitter notifier for CruiseControl.rb

Initial Tags
plugin, ruby, twitter

Initial Language
Ruby