Module: FakeFlorence::Config

Defined in:
lib/fake_florence/config.rb

Constant Summary collapse

DEFAULT_CONFIG =
Pathname.new(__dir__).join('../../templates/config.yaml').freeze
SEVERITY =
{
  'DEBUG' => '🤖',
  'INFO'  => 'â„šī¸',
  'WARN'  => 'âš ī¸',
  'ERROR' => '😡',
  'FATAL' => 'đŸ¤ĸ',
}.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.logObject

Returns the value of attribute log.



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

def log
  @log
end

Class Method Details

.home_dirObject



34
35
36
37
38
# File 'lib/fake_florence/config.rb', line 34

def home_dir
  Pathname.new('~/.flo').expand_path.tap do |home|
    home.mkpath
  end
end

.logfileObject



52
53
54
# File 'lib/fake_florence/config.rb', line 52

def logfile
  home_dir.join('flo.log')
end

.method_missing(m) ⇒ Object



56
57
58
# File 'lib/fake_florence/config.rb', line 56

def method_missing(m)
  read_config(m)
end

.pidfileObject



48
49
50
# File 'lib/fake_florence/config.rb', line 48

def pidfile
  home_dir.join('flo.pid')
end

.store_fileObject



30
31
32
# File 'lib/fake_florence/config.rb', line 30

def store_file
  home_dir.join('config.yaml')
end

.url_for(feature) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/fake_florence/config.rb', line 20

def url_for(feature)
  URI.join(
    read_config(:base_url),
    File.join(
      mount_path,
      feature.id
    )
  )
end