Module: Rbcli::ConfigurateStorage

Defined in:
lib/rbcli/stateful_systems/storagetypes/localstate.rb,
lib/rbcli/stateful_systems/configuratestorage.rb,
lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb

Overview

Configuration Interface

Class Method Summary collapse

Class Method Details

.configure(&block) ⇒ Object



33
34
35
36
# File 'lib/rbcli/stateful_systems/configuratestorage.rb', line 33

def self.configure &block
	@self_before_instance_eval = eval "self", block.binding
	instance_eval &block
end

.data ⇒ Object

Data Retrieval



41
42
43
# File 'lib/rbcli/stateful_systems/configuratestorage.rb', line 41

def self.data
	@data
end

.local_state(path, force_creation: false, halt_on_error: false) ⇒ Object



28
29
30
# File 'lib/rbcli/stateful_systems/storagetypes/localstate.rb', line 28

def self.local_state path, force_creation: false, halt_on_error: false
	@data[:localstate] = Rbcli::State::LocalStorage.new(path, force_creation: force_creation, halt_on_error: halt_on_error)
end

.remote_state_dynamodb(table_name: nil, region: nil, force_creation: false, halt_on_error: true, locking: false) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb', line 26

def self.remote_state_dynamodb table_name: nil, region: nil, force_creation: false, halt_on_error: true, locking: false
	raise StandardError "Must decalre `table_name` and `region` to use remote_state_dynamodb" if table_name.nil? or region.nil?
	@data[:remotestate_init_params] = {
			dynamodb_table: table_name,
			region: region,
			locking: locking
	}
	@data[:remotestate] = Rbcli::State::DynamoDBStorage.new(table_name, force_creation: force_creation, halt_on_error: halt_on_error)
end