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,
  dev: 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



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

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

Instance Method Details

#deploy_notification_urlObject



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

def deploy_notification_url
  config[:deploy_notification_url]
end

#file_exist?Boolean

Returns:

  • (Boolean)


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

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

  @file_exist ||= file.exist?
end

#respond_to_missing?(sym, include_all) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#stagesObject



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

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