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:
parent
65855f38ee
commit
fd68a13496
|
@ -27,17 +27,13 @@ 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'
|
||||
Byebug.start_server('0.0.0.0', 0)
|
||||
puts "Byebug listening on 0.0.0.0:#{Byebug.actual_port}" # rubocop:disable Rails/Output
|
||||
byebug_port_file = File.join(Dir.tmpdir, 'byebug.port')
|
||||
File.write(byebug_port_file, Byebug.actual_port)
|
||||
end
|
||||
else
|
||||
require "debugger"
|
||||
require 'byebug'
|
||||
if ENV['REMOTE_DEBUGGING_ENABLED']
|
||||
require 'byebug/core'
|
||||
Byebug.start_server('0.0.0.0', 0)
|
||||
puts "Byebug listening on 0.0.0.0:#{Byebug.actual_port}" # rubocop:disable Rails/Output
|
||||
byebug_port_file = File.join(Dir.tmpdir, 'byebug.port')
|
||||
File.write(byebug_port_file, Byebug.actual_port)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
gem 'byebug', require: false
|
||||
|
||||
gemspec
|
||||
|
|
|
@ -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
|
||||
require 'byebug'
|
||||
|
||||
RSpec.configure do |config|
|
||||
Zoo = CanvasPartmanTest::Zoo
|
||||
|
|
Loading…
Reference in New Issue