module Troo
Constants
- ConfigurationAborted
- ConfigurationNotFound
- EndpointNotFound
- ExpiredAccessToken
- VERSION
Public Class Methods
configuration(file = Dir.home + '/.trooconf', env = 'default')
click to toggle source
@param [String] @param [String] @return [Troo::Configuration]
# File lib/troo.rb, line 15 def self.configuration(file = Dir.home + '/.trooconf', env = 'default') unless File.exist?(file) warn "\nConfiguration cannot be found, please run `troo " \ "wizard` or `./bin/troo wizard` first.\n" file = root_path + '/config/trooconf.yml' end @configuration ||= Troo::Configuration.load(file, env) end
debug(filename = 'profile.html') { || ... }
click to toggle source
@param [String] @param [] @return []
# File lib/troo/debug.rb, line 9 def self.debug(filename = 'profile.html', &block) RubyProf.start yield result = RubyProf.stop result.eliminate_methods!([/^Array/, /^Hash/]) File.open('./tmp/' + filename, 'w') do |file| RubyProf::CallStackPrinter.new(result).print(file) end end
logger()
click to toggle source
@return [TrueClass]
# File lib/troo.rb, line 26 def self.logger @logger ||= Logger .new(root_path + '/logs/troo.log').tap do |log| log.formatter = proc do |mode, time, prog, msg| "\n" + Esc.green + "#{time.iso8601}:" + Esc.reset + " #{msg}\n" end end end
root_path()
click to toggle source
# File lib/troo.rb, line 35 def self.root_path File.expand_path('../..', __FILE__) end
trace()
click to toggle source
# File lib/troo/debug.rb, line 22 def self.trace trace = TracePoint.new(:call) do |tp| if tp.defined_class.to_s.match(/Troo/) Troo.logger.debug [tp.defined_class.to_s, tp.method_id.to_s].join(' ') end end trace.enable end