Module: CemAcpt

Extended by:
Logging
Defined in:
lib/cem_acpt.rb,
lib/cem_acpt/utils.rb,
lib/cem_acpt/context.rb,
lib/cem_acpt/logging.rb,
lib/cem_acpt/version.rb,
lib/cem_acpt/test_data.rb,
lib/cem_acpt/rspec_utils.rb,
lib/cem_acpt/test_runner.rb,
lib/cem_acpt/puppet_helpers.rb,
lib/cem_acpt/shared_objects.rb,
lib/cem_acpt/image_name_builder.rb,
lib/cem_acpt/test_runner/runner.rb,
lib/cem_acpt/spec_helper_acceptance.rb,
lib/cem_acpt/test_runner/run_handler.rb,
lib/cem_acpt/test_runner/runner_result.rb

Defined Under Namespace

Modules: Bootstrap, ConfigUtils, Context, CoreExtensions, Logging, LoggingAsync, Platform, PuppetHelpers, RSpecUtils, SpecHelperAcceptance, TestData, TestRunner, Utils Classes: Config, ConfigImmutableError, ImageNameBuilder, LocalPortAllocationError, LocalPortAllocator, LockNotRecognizedError, LockWaitTimeoutError, NodeClaimedError, NodeData, NodeDoesNotExistError, NodeInventory, NodeInventoryFileLoadError, NodeInventoryFileNotFoundError, PropertyNotFoundError

Constant Summary collapse

VERSION =
'0.2.5'

Constants included from Logging

Logging::LEVEL_MAP

Class Method Summary collapse

Methods included from Logging

current_log_config, current_log_config, current_log_format, current_log_format, current_log_level, current_log_level, included, logger, logger, new_log_config, new_log_config, new_log_formatter, new_log_formatter, new_log_level, new_log_level, new_logger, new_logger

Class Method Details

.configure_spec_helper!Object

This methods is used in spec_helper_acceptance.rb to set up baseline configurations used in acceptance tests.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cem_acpt/spec_helper_acceptance.rb', line 8

def self.configure_spec_helper!
  require 'serverspec'
  require 'yaml'

  RSpec.configure do |config|
    config.include CemAcpt::SpecHelperAcceptance
    config.extend CemAcpt::SpecHelperAcceptance
    config.add_setting :acpt_test_data, default: {}
    config.add_setting :acpt_node_inventory
    config.threadsafe = true
    config.color_mode = :off
    config.fail_fast = false
  end

  node_inventory = NodeInventory.new
  node_inventory.load
  RSpec.configuration.acpt_node_inventory = node_inventory
end

.run(params) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cem_acpt.rb', line 12

def self.run(params)
  require_relative 'cem_acpt/context'

  log_level = params[:log_level]
  log_formatter = params[:log_format] ? new_log_formatter(params[:log_format]) : nil
  logdevs = [$stdout]
  if params[:log_file] && params[:quiet]
    logdevs = [params[:log_file]]
  elsif params[:log_file] && !params[:quiet]
    logdevs << params[:log_file]
  end
  if (params[:CI] || ENV['CI'] || ENV['GITHUB_ACTION']) && !logdevs.include?($stdout)
    logdevs << $stdout
  end
  new_logger(
    *logdevs,
    level: log_level,
    formatter: log_formatter,
  )
  exit_code = CemAcpt::Context.with(params, &:run)
  exit exit_code
end