Module: Subordinate::Client::Build

Included in:
Subordinate::Client
Defined in:
lib/subordinate/client/build.rb

Overview

Build management and configuration

Instance Method Summary collapse

Instance Method Details

#build(job, build_number, options = {}) ⇒ Hashie::Mash

Returns the response with information about the specific build

Examples:

Get the build api response

Subordinate::Client.build("My-Job-I-Want-Info-On", 5)

See Also:

Author:

  • Jason Truluck



21
22
23
# File 'lib/subordinate/client/build.rb', line 21

def build(job, build_number, options = {})
  get("job/#{job}/#{build_number}/api/json", options)
end

#build_timestamp(job, build_number, format = nil, options = {}) ⇒ String

Returns the builds timestamp This methods accepts the simple data formatter seen here:

Examples:

Get the first builds timestamp

Subordinate::Client.build_timestamp("My-Job-I-Want-Info-On", 1)

Get the first builds timestamp in format “yyyy/MM/dd”

Subordinate::Client.build_timestamp("My-Job-I-Want-Info-On", 1, "yyyy/MM/dd")

See Also:

Author:

  • Jason Truluck



44
45
46
47
48
49
50
# File 'lib/subordinate/client/build.rb', line 44

def build_timestamp(job, build_number, format = nil, options = {})
  options.merge!(
    :format => format
  ) if !format.nil?

  get("job/#{job}/#{build_number}/buildTimestamp", options)
end

#console_output_for_build(job, build_number, start_offset = 0, pre = false, options = {}) ⇒ String

Returns the console output for the build specified

Examples:

Get the console output of the first build

Subordinate::Client.console_output_for_build("My-Job-I-Want-Info-On", 1)

Get the console output of the first build pre formatted

Subordinate::Client.console_output_for_build("My-Job-I-Want-Info-On", 1, 0, true)

Get the console output of the first build starting from the 200th byte

Subordinate::Client.console_output_for_build("My-Job-I-Want-Info-On", 1, 200)

See Also:

Author:

  • Jason Truluck



73
74
75
76
77
78
79
80
81
82
# File 'lib/subordinate/client/build.rb', line 73

def console_output_for_build(job, build_number, start_offset = 0, pre = false, options = {})
  options.merge!(
    :start => start_offset.to_i # Convert to Integer in case of nil
  )
  if pre
    get("job/#{job}/#{build_number}/logText/progressiveHtml", options)
  else
    get("job/#{job}/#{build_number}/logText/progressiveText", options)
  end
end