Project

em-ci

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Utility library for monitoring CI servers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.1.1
~> 1.0.3
~> 1.9.4
 Project Readme

EmCi

Event-machine friendly cctray.xml monitoring

Installation

Add this line to your application's Gemfile:

gem 'em-ci'

And then execute:

$ bundle

Or install it yourself as:

$ gem install em-ci

Usage

Basic usage

require 'eventmachine'
require 'em-ci'

ci = EmCi.new 'http://jenkins.site/cc.xml'

# Add a callback
ci.on_run do |server|
  if server.building?
    puts 'Currently building'
  elsif server.failure?
    puts 'Last build failed'
  elsif server.success?
    puts 'All builds successful'
  end
end

EventMachine.run {
  # run every 15 seconds
  ci.start 15
}

Multiple projects

#...
ci.on_run do |server|
  if server['CustomProject'].sleeping?
    puts 'Custom Project is sleeping'
  end

  server.projects.each do |project|
    # do something with individual project
  end
end

Filtering projects

# Filter projects by name
ci = EmCi.new 'http://jenkins.site/cc.xml', { filter: ['ProjectA', 'ProjectB'] }

ci.on_run do |server|
  # only ProjectA and ProjectB will be included in sleeping check
  server.sleeping?
end

Authentication

ci = EmCi.new 'http://jenkins.site/cc.xml', { auth: ['my-username', 'my-password-or-auth-token'] }