Drop unused query tracer code + term-ansicolor gem.
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -18,7 +18,6 @@ gem "whenever", :require => false
|
||||
gem "sanitize"
|
||||
gem 'ruby-vips'
|
||||
gem 'net-sftp'
|
||||
gem 'term-ansicolor', :require => "term/ansicolor"
|
||||
gem 'diff-lcs', :require => "diff/lcs/array"
|
||||
gem 'bcrypt', :require => "bcrypt"
|
||||
gem 'statistics2'
|
||||
|
||||
@@ -389,8 +389,6 @@ GEM
|
||||
stripe (4.21.3)
|
||||
faraday (~> 0.13)
|
||||
net-http-persistent (~> 3.0)
|
||||
term-ansicolor (1.7.1)
|
||||
tins (~> 1.0)
|
||||
therubyracer (0.12.3)
|
||||
libv8 (~> 3.16.14.15)
|
||||
ref
|
||||
@@ -398,7 +396,6 @@ GEM
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.9)
|
||||
timecop (0.9.1)
|
||||
tins (1.21.1)
|
||||
twitter (6.2.0)
|
||||
addressable (~> 2.3)
|
||||
buftok (~> 0.2.0)
|
||||
@@ -516,7 +513,6 @@ DEPENDENCIES
|
||||
statistics2
|
||||
streamio-ffmpeg
|
||||
stripe
|
||||
term-ansicolor
|
||||
therubyracer
|
||||
timecop
|
||||
twitter
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'term_cdiff' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
load Gem.bin_path("term-ansicolor", "term_cdiff")
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'term_colortab' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
load Gem.bin_path("term-ansicolor", "term_colortab")
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'term_decolor' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
load Gem.bin_path("term-ansicolor", "term_decolor")
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'term_display' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
load Gem.bin_path("term-ansicolor", "term_display")
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'term_mandel' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
load Gem.bin_path("term-ansicolor", "term_mandel")
|
||||
@@ -1,73 +0,0 @@
|
||||
# yields a stacktrace for each SQL query
|
||||
# put this file in config/initializers
|
||||
class QueryTrace < ActiveSupport::LogSubscriber
|
||||
include Term::ANSIColor
|
||||
attr_accessor :trace_queries
|
||||
|
||||
def sql(event) #:nodoc:
|
||||
return unless QueryTrace.enabled? && logger.debug? && Rails.env.development?
|
||||
stack = Rails.backtrace_cleaner.clean(caller)
|
||||
first_line = stack.shift
|
||||
return unless first_line
|
||||
|
||||
msg = prefix + bold + cyan + "#{first_line}\n" + reset
|
||||
msg += cyan + stack.join("\n") + reset
|
||||
debug msg
|
||||
end
|
||||
|
||||
# :call-seq:
|
||||
# Klass.enabled?
|
||||
#
|
||||
# yields boolean if SQL queries should be logged or not
|
||||
|
||||
def self.enabled?
|
||||
defined?(@trace_queries) && @trace_queries
|
||||
end
|
||||
|
||||
# :call-seq:
|
||||
# Klass.status
|
||||
#
|
||||
# yields text if QueryTrace has been enabled or not
|
||||
|
||||
def self.status
|
||||
QueryTrace.enabled? ? 'enabled' : 'disabled'
|
||||
end
|
||||
|
||||
# :call-seq:
|
||||
# Klass.enable!
|
||||
#
|
||||
# turn on SQL query origin logging
|
||||
|
||||
def self.enable!
|
||||
@trace_queries = true
|
||||
end
|
||||
|
||||
# :call-seq:
|
||||
# Klass.disable!
|
||||
#
|
||||
# turn off SQL query origin logging
|
||||
|
||||
def self.disable!
|
||||
@trace_queries = false
|
||||
end
|
||||
|
||||
# :call-seq:
|
||||
# Klass.toggle!
|
||||
#
|
||||
# Toggles query tracing yielding a boolean indicating the new state of query
|
||||
# origin tracing
|
||||
|
||||
def self.toggle!
|
||||
enabled? ? disable! : enable!
|
||||
enabled?
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def prefix #:nodoc:
|
||||
bold(magenta('Called from: ')) + reset
|
||||
end
|
||||
end
|
||||
|
||||
QueryTrace.attach_to :active_record
|
||||
QueryTrace.enable! if ENV['QUERY_TRACE']
|
||||
Reference in New Issue
Block a user