Skip to content

Commit

Permalink
Merge pull request #86 from hsbt/removed-ruby18-support
Browse files Browse the repository at this point in the history
Removed EOL'ed Ruby version support.
  • Loading branch information
hsbt committed Jan 14, 2016
2 parents 94493da + 7f100cf commit 9bbf695
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ notifications:
email:
- [email protected]
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.8
Expand All @@ -25,5 +24,6 @@ rvm:
script: ruby -Ilib bin/rake
matrix:
allow_failures:
- rvm: jruby-1.7.20
- rvm: jruby-9.0.4.0
- rvm: jruby-head
2 changes: 0 additions & 2 deletions Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ lib/rake/ext/core.rb
lib/rake/ext/module.rb
lib/rake/ext/pathname.rb
lib/rake/ext/string.rb
lib/rake/ext/time.rb
lib/rake/file_creation_task.rb
lib/rake/file_list.rb
lib/rake/file_task.rb
Expand All @@ -94,7 +93,6 @@ lib/rake/pseudo_status.rb
lib/rake/rake_module.rb
lib/rake/rake_test_loader.rb
lib/rake/rdoctask.rb
lib/rake/ruby182_test_unit_fix.rb
lib/rake/rule_recursion_overflow_error.rb
lib/rake/runtest.rb
lib/rake/scope.rb
Expand Down
3 changes: 1 addition & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ hoe = Hoe.spec 'rake' do
developer 'Eric Hodel', '[email protected]'
developer 'Jim Weirich', ''

require_ruby_version '>= 1.8.7'
require_ruby_version '>= 1.9.3'
require_rubygems_version '>= 1.3.2'

dependency 'minitest', '~> 5.0', :developer
Expand Down Expand Up @@ -78,4 +78,3 @@ begin
rescue LoadError
warn 'run `rake newb` to install rdoc'
end

1 change: 0 additions & 1 deletion lib/rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ module Rake

require 'rake/ext/module'
require 'rake/ext/string'
require 'rake/ext/time'

require 'rake/win32'

Expand Down
70 changes: 4 additions & 66 deletions lib/rake/alt_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,70 +41,8 @@ def define_module_function(name, &block)
end
end

if WINDOWS && RUBY_VERSION < "1.9.0"
RUNNABLE_EXTS = %w[com exe bat cmd]
RUNNABLE_PATTERN = %r!\.(#{RUNNABLE_EXTS.join('|')})\Z!i

define_module_function :kernel_system, &Kernel.method(:system)
define_module_function :kernel_backticks, &Kernel.method(:'`')

module_function

def repair_command(cmd)
"call " + (
if cmd =~ %r!\A\s*\".*?\"!
# already quoted
cmd
elsif match = cmd.match(%r!\A\s*(\S+)!)
if match[1] =~ %r!/!
# avoid x/y.bat interpretation as x with option /y
%Q!"#{match[1]}"! + match.post_match
else
# a shell command will fail if quoted
cmd
end
else
# empty or whitespace
cmd
end
)
end

def find_runnable(file)
if file =~ RUNNABLE_PATTERN
file
else
RUNNABLE_EXTS.each { |ext|
test = "#{file}.#{ext}"
return test if File.exist?(test)
}
nil
end
end

def system(cmd, *args)
repaired = (
if args.empty?
[repair_command(cmd)]
elsif runnable = find_runnable(cmd)
[File.expand_path(runnable), *args]
else
# non-existent file
[cmd, *args]
end
)
kernel_system(*repaired)
end

def backticks(cmd)
kernel_backticks(repair_command(cmd))
end

define_module_function :'`', &method(:backticks)
else
# Non-Windows or ruby-1.9+: same as Kernel versions
define_module_function :system, &Kernel.method(:system)
define_module_function :backticks, &Kernel.method(:'`')
define_module_function :'`', &Kernel.method(:'`')
end
# Non-Windows or ruby-1.9+: same as Kernel versions
define_module_function :system, &Kernel.method(:system)
define_module_function :backticks, &Kernel.method(:'`')
define_module_function :'`', &Kernel.method(:'`')
end
18 changes: 0 additions & 18 deletions lib/rake/ext/time.rb

This file was deleted.

29 changes: 0 additions & 29 deletions lib/rake/ruby182_test_unit_fix.rb

This file was deleted.

11 changes: 1 addition & 10 deletions lib/rake/testtask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,6 @@ def file_list # :nodoc:
end
end

def fix # :nodoc:
case ruby_version
when '1.8.2'
"\"#{find_file 'rake/ruby182_test_unit_fix'}\""
else
nil
end || ''
end

def ruby_version # :nodoc:
RUBY_VERSION
end
Expand All @@ -168,7 +159,7 @@ def run_code # :nodoc:
when :direct
"-e \"ARGV.each{|f| require f}\""
when :testrb
"-S testrb #{fix}"
"-S testrb"
when :rake
"#{rake_include_arg} \"#{rake_loader}\""
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_rake_functional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def test_stand_alone_filelist
# predicate function can be used to skip tests or assertions as
# needed.
def uncertain_exit_status?
RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION)
defined?(JRUBY_VERSION)
end

end
20 changes: 0 additions & 20 deletions test/test_rake_test_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,6 @@ def test_run_code_rake_default_gem
end
end

def test_run_code_testrb_ruby_1_8_2
test_task = Rake::TestTask.new do |t|
t.loader = :testrb
end

def test_task.ruby_version() '1.8.2' end

assert_match(/^-S testrb +".*"$/, test_task.run_code)
end

def test_run_code_testrb_ruby_1_8_6
test_task = Rake::TestTask.new do |t|
t.loader = :testrb
end

def test_task.ruby_version() '1.8.6' end

assert_match(/^-S testrb +$/, test_task.run_code)
end

def test_test_files_equals
tt = Rake::TestTask.new do |t|
t.test_files = FileList['a.rb', 'b.rb']
Expand Down

0 comments on commit 9bbf695

Please sign in to comment.