Sha256: 91b92b87745ba8885c11f6eab95fa8e813379d11aa06696c912fb99874d2c745

Contents?: true

Size: 672 Bytes

Versions: 2

Compression:

Stored size: 672 Bytes

Contents

class JenkinsCron::Job
  attr_reader :name, :params

  def initialize(schedule, name, &block)
    @schedule = schedule
    @name = name
    @params = { name: "#{@schedule.name}-#{@name}" }
    instance_eval(&block)
    @params.freeze
  end

  private

  def command(command, opts = {})
    cmd = JenkinsCron::Job::Command.new(command, opts)
    @params[:shell_command] = cmd.shell_command
  end

  def timer(opts = {}, &block)
    timer = JenkinsCron::Job::Timer.new(opts, &block)
    if @params[:timer].nil?
      @params[:timer] = timer.to_s
    else
      @params[:timer] += "\n" + timer.to_s
    end
  end

  def options(key, value)
    @params[key] = value
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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