From ef68d42dbef96e1fa7d96b458e17c37b634092c9 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 7 Aug 2019 22:11:07 -0500 Subject: [PATCH] Drop unused query tracer code + term-ansicolor gem. --- Gemfile | 1 - Gemfile.lock | 4 -- bin/term_cdiff | 29 ------------ bin/term_colortab | 29 ------------ bin/term_decolor | 29 ------------ bin/term_display | 29 ------------ bin/term_mandel | 29 ------------ config/initializers/query_trace.rb | 73 ------------------------------ 8 files changed, 223 deletions(-) delete mode 100755 bin/term_cdiff delete mode 100755 bin/term_colortab delete mode 100755 bin/term_decolor delete mode 100755 bin/term_display delete mode 100755 bin/term_mandel delete mode 100644 config/initializers/query_trace.rb diff --git a/Gemfile b/Gemfile index 3871d4f9c..70b2dbf5a 100644 --- a/Gemfile +++ b/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' diff --git a/Gemfile.lock b/Gemfile.lock index 42e433293..c3dde334f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/bin/term_cdiff b/bin/term_cdiff deleted file mode 100755 index 669d7d89e..000000000 --- a/bin/term_cdiff +++ /dev/null @@ -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") diff --git a/bin/term_colortab b/bin/term_colortab deleted file mode 100755 index f03be701b..000000000 --- a/bin/term_colortab +++ /dev/null @@ -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") diff --git a/bin/term_decolor b/bin/term_decolor deleted file mode 100755 index 238b84c39..000000000 --- a/bin/term_decolor +++ /dev/null @@ -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") diff --git a/bin/term_display b/bin/term_display deleted file mode 100755 index 84c6191b9..000000000 --- a/bin/term_display +++ /dev/null @@ -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") diff --git a/bin/term_mandel b/bin/term_mandel deleted file mode 100755 index 0c064431f..000000000 --- a/bin/term_mandel +++ /dev/null @@ -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") diff --git a/config/initializers/query_trace.rb b/config/initializers/query_trace.rb deleted file mode 100644 index 8ec579182..000000000 --- a/config/initializers/query_trace.rb +++ /dev/null @@ -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']