hudson-remote-cli is ruby library to talk to Hudson's json remote access api
Add this line to your application's Gemfile:
gem install hudson-remote-cli
require 'hudson-remote-cli'
# Manual Configuration
Hudson[:url] = 'http://localhost:8080'
Hudson[:user] = 'hudson'
Hudson[:password] = 'password'
# get all jobs
Hudson.jobs
# load statistics
Hudson.overallLoad
# get all infomation for hudson
Hudson.api
# just get job name and colors.
# For more of this see:_Controlling the amount of data you fetch_ in hudson help
# All api method can use like this
Hudson.api('jobs[name, color]')
# when you request the _api_ method, we'll cache the data default.
# you can specified the second param as true to clean the cache
Hudson.api('jobs[name, color]', true)
# get build queue job names
Hudson::BuildQueue.list
# get full information of build queue
Hudson::BuildQueuq.api
job = Hudson::Job.create('job_name', 'config.xml local path')
# load existing job
j = Hudson::Job.new('job_name')
# enable the job
j.enable
# disable the job
j.disable
# is the job enable?
j.buildable?
# start a build
j.build
# start a build with params
j.build({'key1' => 'value1', 'key2' => 'value2', ...})
# is the job building
j.active?
# wait the job building complete
j.wait_for_build
# start a build and wait for it finish, also worked with params
j.build!
# description of the job
j.description
# set description of the job
j.description = 'some description'
# update the job
j.update('config.xml local path')
# delete the job
j.delete
# job name
j.name
# all information
j.api
# last build number
j.last_build
# last success build number
j.last_success_build
# get information on latest build
b = Hudson::Build.new('job_name')
# get information on particular build number
b = Hudson::Build.new('job_name', 142)
# get all informations of the build
b.api
# get build description
b.description
# set build description
b.description = 'some description'
# get the result of this build
b.result
# get commit revisions in this build
b.revisions
# build start time
b.start_time
# build end time
b.end_time
# build log
b.console
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request