pre-Ruby 2.0 cruft cleanup

Change-Id: If3965206f27f585a14fe3e59eef98764e26c310d
Reviewed-on: https://gerrit.instructure.com/92723
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2016-10-12 23:20:14 -06:00
parent 65855f38ee
commit fd68a13496
5 changed files with 9 additions and 73 deletions

View File

@ -27,7 +27,6 @@ environment_configuration(defined?(config) && config) do |config|
# The ruby debug gems conflict with the IDE-based debugger gem.
# Set this option in your dev environment to disable.
unless ENV['DISABLE_RUBY_DEBUGGING']
if RUBY_VERSION >= '2.0.0'
require 'byebug'
if ENV['REMOTE_DEBUGGING_ENABLED']
require 'byebug/core'
@ -36,9 +35,6 @@ environment_configuration(defined?(config) && config) do |config|
byebug_port_file = File.join(Dir.tmpdir, 'byebug.port')
File.write(byebug_port_file, Byebug.actual_port)
end
else
require "debugger"
end
end
# Print deprecation notices to the Rails logger

View File

@ -295,7 +295,6 @@ unless CANVAS_RAILS4_0
def query_conditions_for_initial_load(type_map)
known_type_names = type_map.keys.map { |n| "'#{n}'" } + type_map.keys.map { |n| "'_#{n}'" }
known_type_types = %w('r' 'e' 'd')
#debugger
<<-SQL % [known_type_names.join(", "), known_type_types.join(", ")]
WHERE
t.typname IN (%s)

View File

@ -1,38 +1,3 @@
# ruby pre-2.0 compatibility fixes
if RUBY_VERSION < '2.0'
# see https://bugs.ruby-lang.org/issues/7547
# the fix was only applied in 2.0
module Dir::Tmpname
def create(basename, *rest)
if opts = Hash.try_convert(rest[-1])
opts = opts.dup if rest.pop.equal?(opts)
max_try = opts.delete(:max_try)
opts = [opts]
else
opts = []
end
tmpdir, = *rest
if $SAFE > 0 and tmpdir.tainted?
tmpdir = '/tmp'
else
tmpdir ||= tmpdir()
end
n = nil
begin
path = File.join(tmpdir, make_tmpname(basename, n))
yield(path, n, *opts)
rescue Errno::EEXIST
n ||= 0
n += 1
retry if !max_try or n < max_try
raise "cannot generate temporary name using `#{basename}' under `#{tmpdir}'"
end
path
end
end
end
# This makes it so all parameters get converted to UTF-8 before they hit your
# app. If someone sends invalid UTF-8 to your server, raise an exception.
class ActionController::InvalidByteSequenceErrorFromParams < Encoding::InvalidByteSequenceError; end
@ -71,17 +36,3 @@ end
module ActiveRecord::Coders
Utf8SafeYAMLColumn = YAMLColumn
end
# Fix for https://bugs.ruby-lang.org/issues/7278 , which was filling up our logs with these warnings
if RUBY_VERSION < "2."
require 'net/protocol'
class Net::InternetMessageIO
def each_crlf_line(src)
buffer_filling(@wbuf, src) do
while line = @wbuf.slice!(/\A[^\r\n]*(?:\n|\r(?:\n|(?!\z)))/)
yield line.chomp("\n") + "\r\n"
end
end
end
end
end

View File

@ -3,12 +3,6 @@ source 'https://rubygems.org'
gem 'simplecov', '0.8.2', :require => false
gem 'simplecov-rcov', '0.2.3', :require => false
platforms :ruby_19 do
gem 'debugger'
end
platforms :ruby_21, :ruby_22, :ruby_23 do
gem 'byebug', require: false
end
gemspec

View File

@ -16,11 +16,7 @@ require 'fixtures/zoo'
require 'fixtures/animal'
require 'fixtures/trail'
if RUBY_VERSION =~ /^1.9/
require 'debugger'
elsif RUBY_VERSION =~ /^2/
require 'byebug'
end
RSpec.configure do |config|
Zoo = CanvasPartmanTest::Zoo