Class: Simmer::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/simmer/configuration.rb,
lib/simmer/configuration/callback_dsl.rb

Overview

Reads in the Simmer configuration file and options and provides it to the rest of the Simmer implementation.

Defined Under Namespace

Classes: CallbackDsl

Constant Summary collapse

LOCAL_FILE_SYSTEM_KEY =
:local_file_system
TIMEOUT_RETRY_KEY =
:timeout_failure_retry_count
RESULTS =
'results'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, simmer_dir, resolver: Objectable.resolver, callbacks: nil) ⇒ Configuration

Returns a new instance of Configuration.



43
44
45
46
47
48
49
50
# File 'lib/simmer/configuration.rb', line 43

def initialize(config, simmer_dir, resolver: Objectable.resolver, callbacks: nil)
  @config      = config || {}
  @resolver    = resolver
  @simmer_dir  = simmer_dir
  @callbacks   = callbacks

  freeze
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



38
39
40
# File 'lib/simmer/configuration.rb', line 38

def config
  @config
end

Instance Method Details

#aws_file_system?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/simmer/configuration.rb', line 64

def aws_file_system?
  config.key?(AWS_FILE_SYSTEM_KEY.to_s)
end

#aws_file_system_configObject



56
57
58
# File 'lib/simmer/configuration.rb', line 56

def aws_file_system_config
  get(AWS_FILE_SYSTEM_KEY) || {}
end

#files_dirObject



88
89
90
# File 'lib/simmer/configuration.rb', line 88

def files_dir
  File.join(simmer_dir, FILES)
end

#fixtures_dirObject



84
85
86
# File 'lib/simmer/configuration.rb', line 84

def fixtures_dir
  File.join(simmer_dir, FIXTURES)
end

#local_file_system?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/simmer/configuration.rb', line 68

def local_file_system?
  config.key?(LOCAL_FILE_SYSTEM_KEY.to_s)
end

#local_file_system_configObject



60
61
62
# File 'lib/simmer/configuration.rb', line 60

def local_file_system_config
  get(LOCAL_FILE_SYSTEM_KEY) || {}
end

#mysql_database_configObject



52
53
54
# File 'lib/simmer/configuration.rb', line 52

def mysql_database_config
  get(MYSQL_DATABASE_KEY) || {}
end

#results_dirObject



92
93
94
# File 'lib/simmer/configuration.rb', line 92

def results_dir
  File.join(simmer_dir, RESULTS)
end

#spoon_client_configObject



76
77
78
# File 'lib/simmer/configuration.rb', line 76

def spoon_client_config
  get(SPOON_CLIENT_KEY) || {}
end

#tests_dirObject



80
81
82
# File 'lib/simmer/configuration.rb', line 80

def tests_dir
  File.join(simmer_dir, TESTS)
end

#timeout_failure_retry_countObject



72
73
74
# File 'lib/simmer/configuration.rb', line 72

def timeout_failure_retry_count
  get(TIMEOUT_RETRY_KEY) || 0
end