Sha256: b2c0bf569f87a4d1e042a7b990effeb9a1989426172a670069a9bdb941319d10
Contents?: true
Size: 1.81 KB
Versions: 14
Compression:
Stored size: 1.81 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 def silence_template_renders! append!("config.integrations.action_view.silence = Rails.env.production?") 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
14 entries across 14 versions & 1 rubygems