Sha256: 3fb594ed7bf57469acaa33b786dfe13c6498c295da17ab3d304a3b2118fb3159

Contents?: true

Size: 417 Bytes

Versions: 2

Compression:

Stored size: 417 Bytes

Contents

require "jenkins_api_client"

class JenkinsCron::Jenkins
  def initialize(config)
    @client = JenkinsApi::Client.new(config)
  end

  def update(schedule)
    schedule.each_jobs do |job|
      @client.job.create_or_update_freestyle(job.params.dup)
    end

    @client.view.create_list_view(
      name: schedule.name,
      regex: "^#{schedule.name}-.+",
    ) unless @client.view.exists?(schedule.name)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jenkins_cron-0.0.3 lib/jenkins_cron/jenkins.rb
jenkins_cron-0.0.2 lib/jenkins_cron/jenkins.rb