Sha256: e1315783bd5e2e15417425eb232dd0432ad4f55e6ed481d1ec3d535e03a06aa3
Contents?: true
Size: 1.69 KB
Versions: 6
Compression:
Stored size: 1.69 KB
Contents
require "timber/cli/file_helper" module Timber class CLI class ConfigFile attr_reader :path, :file_helper def initialize(path, file_helper) @path = path @file_helper = file_helper end def create! file_helper.write(path, content) end def exists? File.exists?(path) end def logrageify! append!("config.logrageify!") end private def append!(code) if !content.include?(code) content.gsub!(insert_hook, "#{code}\n\n#{insert_hook}") end true end def insert_hook @insert_hook ||= "# Add additional configuration here." end # We provide this as an instance method so that the string is only defined when needed. # This avoids allocating this string during normal app runtime. def content @content ||= <<-CONTENT # Timber.io Ruby Configuration - Simple Structured Logging # # ^ ^ ^ ^ ___I_ ^ ^ ^ ^ ^ ^ ^ # /|\\/|\\/|\\ /|\\ /\\-_--\\ /|\\/|\\ /|\\/|\\/|\\ /|\\/|\\ # /|\\/|\\/|\\ /|\\ / \\_-__\\ /|\\/|\\ /|\\/|\\/|\\ /|\\/|\\ # /|\\/|\\/|\\ /|\\ |[]| [] | /|\\/|\\ /|\\/|\\/|\\ /|\\/|\\ # ------------------------------------------------------------------- # Website: https://timber.io # Documentation: https://timber.io/docs # Support: support@timber.io # ------------------------------------------------------------------- config = Timber::Config.instance #{insert_hook} # For a full list of configuration options and their explanations see: # http://www.rubydoc.info/github/timberio/timber-ruby/Timber/Config CONTENT end end end end
Version data entries
6 entries across 6 versions & 1 rubygems