Class: Afterlife::Config::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/afterlife/config/provider.rb

Constant Summary collapse

PROFILES =
[
  PROFILE_PRODUCTION = 'mifiel-production',
  PROFILE_TESTING = 'mifiel-sandbox',
].freeze
CLOUD_PROFILES =

stage => profile

{
  staging: PROFILE_TESTING,
  qa: PROFILE_TESTING,
  sandbox: PROFILE_PRODUCTION,
  production: PROFILE_PRODUCTION,
}.freeze

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



22
23
24
# File 'lib/afterlife/config/provider.rb', line 22

def method_missing(sym, *args, &block)
  config.key?(sym) ? config[sym] : super
end

Instance Method Details

#deploy_notification_urlObject



38
39
40
# File 'lib/afterlife/config/provider.rb', line 38

def deploy_notification_url
  config[:deploy_notification_url]
end

#file_exist?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/afterlife/config/provider.rb', line 26

def file_exist?
  return @file_exist if defined?(@file_exist)

  @file_exist ||= file.exist?
end

#respond_to_missing?(sym, include_all) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/afterlife/config/provider.rb', line 18

def respond_to_missing?(sym, include_all)
  config.key?(sym) || super
end

#stagesObject



32
33
34
35
36
# File 'lib/afterlife/config/provider.rb', line 32

def stages
  @stages ||= config.delete(:stages)&.to_h do |name, val|
    [name, Stage.new(val.merge(name: name.to_s))]
  end
end