Module: Travis::Surveillance

Defined in:
lib/travis/surveillance.rb,
lib/travis/surveillance/cli.rb,
lib/travis/surveillance/job.rb,
lib/travis/surveillance/build.rb,
lib/travis/surveillance/project.rb,
lib/travis/surveillance/version.rb,
lib/travis/surveillance/surveyor.rb

Defined Under Namespace

Modules: CLI, Logger Classes: Build, Builds, Job, Project, Surveyor

Constant Summary collapse

VERSION =
"0.0.9"

Class Method Summary collapse

Class Method Details

.instrument_with(logger) ⇒ Object

Public: Allows the user to specify a logger for the log messages that Travis::Surveillance produces.

logger = The object you want logs to be sent too

Examples

Travis::Surveillance.instrument_with(STDOUT.method(:puts))
# => #<Method: IO#puts>

Returns the logger object



27
28
29
# File 'lib/travis/surveillance.rb', line 27

def self.instrument_with(logger)
  @logger = logger
end

.log(data, &blk) ⇒ Object

Internal: Top level log method for use by Travis::Surveillance

data = Logging data (typically a hash) blk = block to execute

Returns the response from calling the logger with the arguments



37
38
39
# File 'lib/travis/surveillance.rb', line 37

def self.log(data, &blk)
  logger.call({ 'travis-surveillance' => true }.merge(data), &blk)
end

.loggerObject

Public: The logging location

Returns an Object



44
45
46
# File 'lib/travis/surveillance.rb', line 44

def self.logger
  @logger || Travis::Surveillance::Logger.method(:log)
end

.mock!Object

Public: Enable mocking mode

Examples

Travis::Surveillance.mock!
# => true


54
55
56
# File 'lib/travis/surveillance.rb', line 54

def self.mock!
  @mock = true
end

.mocking?Boolean

Public: Check if mocking is enabled

Examples

Travis::Surveillance.mocking?
# => false

Returns:

  • (Boolean)


64
65
66
# File 'lib/travis/surveillance.rb', line 64

def self.mocking?
  @mock || false
end