module AppVeyor::Worker

Constants

VERSION

Public Class Methods

env(envs) click to toggle source
# File lib/appveyor/worker.rb, line 32
def self.env envs
  x = api or return
  envs.each do |k, v|
    body = JSON.generate name: k, value: v
    x.post '/api/build/variables',
      body,
      'Content-Length'=>body.length.to_s,
      'Content-Type'=>'application/json'
  end
end
message(msg, details=nil) click to toggle source
# File lib/appveyor/worker.rb, line 12
def self.message msg, details=nil
  x = api or return
  body = JSON.generate category: 'info',
    message: msg,
    details: details
  x.post '/api/build/messages',
    body,
    'Content-Length'=>body.length.to_s,
    'Content-Type'=>'application/json'
end
skip?() click to toggle source
# File lib/appveyor/worker.rb, line 8
def self.skip?
  !api
end
test(info) click to toggle source
# File lib/appveyor/worker.rb, line 23
def self.test info
  x = api or return
  body = JSON.generate info
  x.post '/api/tests',
    body,
    'Content-Length'=>body.length.to_s,
    'Content-Type'=>'application/json'
end

Private Class Methods

api() click to toggle source
# File lib/appveyor/worker.rb, line 45
def self.api
  return if false===@http
  return @http if @http
  unless z = ENV['APPVEYOR_API_URL']
    @http = false
    return
  end
  z = URI z
  @http = x = Net::HTTP.start z.host, z.port
  x.use_ssl='https'==z.scheme
  x
end