Sha256: 4e3110816c84a56b8d862ee4e38a907c6423533dcfa4944b20b30f6b0fe69064
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'jenkins_api_client' module Jenkinson class API attr_reader :client def initialize(config) @client = JenkinsApi::Client.new(config) end def create_or_update_jobs(jobs_folder) jobs = Dir["#{jobs_folder}/*/config.xml"] jobs.each do |job| File.open(job, "rb") do |xml_file| jobname = job.split('/')[-2] client.job.create_or_update(jobname, xml_file.read) end end end def get_jobs_config(target_dir) client.job.list_all.each do |jobname| job_on_server = client.job.get_config(jobname) rescue nil job = "#{target_dir}/#{jobname}/config.xml" next if job_on_server.nil? dirname = File.dirname(job) Dir.mkdir(dirname) unless Dir.exist?(dirname) File.open(job, "w") do |xml_file| xml_file << job_on_server end end end def install_plugins(plugins_str) plugins = plugins_str.split(',') plugins.each do |plugin| client.plugin.install(plugin) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jenkinson-0.0.4 | lib/jenkinson/api.rb |