Module: Sem

Defined in:
lib/sem.rb,
lib/sem/api.rb,
lib/sem/cli.rb,
lib/sem/views.rb,
lib/sem/version.rb,
lib/sem/configuration.rb

Defined Under Namespace

Modules: API, Errors, Helpers Classes: CLI, Configuration, SRN, Views

Constant Summary collapse

VERSION =
"0.7.0".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.log_level=(value) ⇒ Object (writeonly)

Sets the attribute log_level

Parameters:

  • value

    the value to set the attribute log_level to.



18
19
20
# File 'lib/sem.rb', line 18

def log_level=(value)
  @log_level = value
end

Class Method Details

.run_in_trace_mode!Object



24
25
26
# File 'lib/sem.rb', line 24

def run_in_trace_mode!
  @trace_mode = true
end

.start(args) ⇒ Object

Returns exit status as a number. rubocop:disable Metrics/AbcSize



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/sem.rb', line 30

def start(args)
  args.delete("--trace") && run_in_trace_mode! if args.include?("--trace")

  Sem::CLI.start(args)
rescue Sem::Errors::Base => e
  abort e.message
rescue SemaphoreClient::Exceptions::Conflict, SemaphoreClient::Exceptions::NotAllowed => e
  abort "[ERROR] #{e.message}"
rescue SemaphoreClient::Exceptions::Unauthorized => e
  abort "[ERROR] #{e.message}. Check if your credentials are valid."
rescue SemaphoreClient::Exceptions::ServerError => e
  abort on_server_error(e)
rescue SemaphoreClient::Exceptions::UnprocessableEntity => e
  abort "[ERROR] #{e.message}"
rescue StandardError => e
  abort on_unhandled_error(e)
end

.trace?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/sem.rb', line 20

def trace?
  @trace_mode == true
end