Module: RSpec::Buildkite::Analytics

Defined in:
lib/rspec/buildkite/analytics/version.rb,
lib/rspec/buildkite/analytics/reporter.rb,
lib/rspec/buildkite/analytics/uploader.rb,
lib/rspec/buildkite/analytics/socket_connection.rb,
lib/rspec/buildkite/analytics/session.rb,
lib/rspec/buildkite/analytics/network.rb,
lib/rspec/buildkite/analytics/tracer.rb,
lib/rspec/buildkite/analytics/object.rb,
lib/rspec/buildkite/analytics.rb

Defined Under Namespace

Classes: CI, Error, Network, Object, Reporter, Session, SocketConnection, TimeoutError, Tracer, Uploader

Constant Summary collapse

VERSION =
"0.8.2"
NAME =
"rspec-buildkite"
DEFAULT_URL =
"https://analytics-api.buildkite.com/v1/uploads"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_tokenObject

Returns the value of attribute api_token.



15
16
17
# File 'lib/rspec/buildkite/analytics.rb', line 15

def api_token
  @api_token
end

.debug_enabledObject

Returns the value of attribute debug_enabled.



19
20
21
# File 'lib/rspec/buildkite/analytics.rb', line 19

def debug_enabled
  @debug_enabled
end

.debug_filepathObject

Returns the value of attribute debug_filepath.



20
21
22
# File 'lib/rspec/buildkite/analytics.rb', line 20

def debug_filepath
  @debug_filepath
end

.sessionObject

Returns the value of attribute session.



18
19
20
# File 'lib/rspec/buildkite/analytics.rb', line 18

def session
  @session
end

.uploaderObject

Returns the value of attribute uploader.



17
18
19
# File 'lib/rspec/buildkite/analytics.rb', line 17

def uploader
  @uploader
end

.urlObject

Returns the value of attribute url.



16
17
18
# File 'lib/rspec/buildkite/analytics.rb', line 16

def url
  @url
end

Class Method Details

.annotate(content) ⇒ Object



36
37
38
39
40
# File 'lib/rspec/buildkite/analytics.rb', line 36

def self.annotate(content)
  tracer = RSpec::Buildkite::Analytics::Uploader.tracer
  tracer&.enter("annotation", **{ content: content })
  tracer&.leave
end

.configure(token: nil, url: nil, debug_enabled: false, debug_filepath: nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rspec/buildkite/analytics.rb', line 23

def self.configure(token: nil, url: nil, debug_enabled: false, debug_filepath: nil)
  self.api_token = token || ENV["BUILDKITE_ANALYTICS_TOKEN"]
  self.url = url || DEFAULT_URL
  self.debug_enabled = debug_enabled || !!(ENV["BUILDKITE_ANALYTICS_DEBUG_ENABLED"])
  self.debug_filepath = debug_filepath || ENV["BUILDKITE_ANALYTICS_DEBUG_FILEPATH"] || Dir.tmpdir

  Kernel.warn "UNSUPPORTED: The rspec-buildkite-analytics gem has been renamed to buildkite-test_collector. rspec-buildkite-analytics will not receive any further maintenance. Please follow our docs https://buildkite.com/docs/test-analytics/ruby-collectors to upgrade to the new gem: https://rubygems.org/gems/buildkite-test_collector. Thank you!"

  require_relative "analytics/uploader"

  self::Uploader.configure
end