Module: Maglove

Defined in:
lib/maglove.rb

Class Method Summary collapse

Class Method Details

.loggerObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/maglove.rb', line 25

def self.logger
  if @logger.nil?
    Logging.color_scheme("bright",
                         levels: { debug: :blue, info: :green, warn: :yellow, error: :red, fatal: [:white, :on_red] },
                         date: :blue,
                         mdc: :cyan,
                         logger: :cyan,
                         message: :black)
    Logging.appenders.stdout("stdout", layout: Logging.layouts.pattern(pattern: '[%d] %-5l %-18X{full_command} %x %m\n', color_scheme: 'bright'))
    @logger = Logging::Logger.new(self.class.name)
    @logger.level = :debug
    @logger.add_appenders('stdout')
  end
  @logger
end

.theme_config(key = nil, theme) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/maglove.rb', line 12

def self.theme_config(key = nil, theme)
  @theme_config ||= {}
  unless @theme_config[theme]
    config_file = Workspace::WorkspaceFile.new("src/themes/#{theme}", "theme.yml")
    @theme_config[theme] = config_file.read_yaml
  end
  if key.nil?
    @theme_config[theme]
  else
    @theme_config[theme][key.to_s]
  end
end