Skip to content

Commit

Permalink
Drop ruby 1.x support
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jun 26, 2019
1 parent 04d7560 commit ae4a3d5
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 384 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ before_install:
bundler_args: --without development
language: ruby
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.10
- 2.2.10
Expand Down
26 changes: 7 additions & 19 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,30 @@
source "https://rubygems.org"

gem "rake", "< 11"
gem "rdoc", "~> 4.2.2" # This is to support Ruby 1.8 and 1.9

group :development do
gem "pry"
platforms :ruby_21 do
gem "pry-byebug"
end
platforms :ruby_19, :ruby_20 do
platforms :ruby_20 do
gem "pry-debugger"
gem "pry-stack_explorer"
end
end

group :test do
gem "addressable", "~> 2.3.6", :platforms => [:ruby_18]
gem "childlabor"
gem "coveralls", ">= 0.8.19"
gem "json", "< 2" # This is to support Ruby 1.8 and 1.9
gem "mime-types", "~> 1.25", :platforms => [:jruby, :ruby_18]
gem "rest-client", "~> 1.6.0", :platforms => [:jruby, :ruby_18]
gem "mime-types", "~> 1.25", :platforms => [:jruby]
gem "rest-client", "~> 1.6.0", :platforms => [:jruby]
gem "rspec", ">= 3"
gem "rspec-mocks", ">= 3"
gem "rubocop", ">= 0.19", :platforms => [:ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24]
gem "rubocop", ">= 0.19"
gem "simplecov", ">= 0.13"
gem "term-ansicolor", "~> 1.3.2" # This is to support Ruby 1.8 and 1.9
gem "tins", "< 1.7" # This is to support Ruby 1.8 and 1.9
if RUBY_VERSION < "1.9.3"
gem "webmock", ">= 1.20", "< 2" # This is to support Ruby 1.8 and 1.9.2
gem "hashdiff", "< 0.3.6" # Hashdiff 0.3.6 no longer supports Ruby 1.8
else
gem "webmock"
end
if RUBY_VERSION >= '1.9'
# `did_you_mean` can't build with Ruby 1.8.
gem 'did_you_mean'
end
gem "webmock"
end

gem 'did_you_mean'

gemspec
13 changes: 6 additions & 7 deletions lib/thor/base.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require "thor/command"
require "thor/core_ext/hash_with_indifferent_access"
require "thor/core_ext/ordered_hash"
require "thor/error"
require "thor/invocation"
require "thor/parser"
Expand Down Expand Up @@ -353,22 +352,22 @@ def group(name = nil)
# Returns the commands for this Thor class.
#
# ==== Returns
# OrderedHash:: An ordered hash with commands names as keys and Thor::Command
# objects as values.
# Hash:: An ordered hash with commands names as keys and Thor::Command
# objects as values.
#
def commands
@commands ||= Thor::CoreExt::OrderedHash.new
@commands ||= Hash.new
end
alias_method :tasks, :commands

# Returns the commands for this Thor class and all subclasses.
#
# ==== Returns
# OrderedHash:: An ordered hash with commands names as keys and Thor::Command
# objects as values.
# Hash:: An ordered hash with commands names as keys and Thor::Command
# objects as values.
#
def all_commands
@all_commands ||= from_superclass(:all_commands, Thor::CoreExt::OrderedHash.new)
@all_commands ||= from_superclass(:all_commands, Hash.new)
@all_commands.merge!(commands)
end
alias_method :all_tasks, :all_commands
Expand Down
3 changes: 1 addition & 2 deletions lib/thor/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ def sans_backtrace(backtrace, caller) #:nodoc:
def handle_argument_error?(instance, error, caller)
not_debugging?(instance) && (error.message =~ /wrong number of arguments/ || error.message =~ /given \d*, expected \d*/) && begin
saned = sans_backtrace(error.backtrace, caller)
# Ruby 1.9 always include the called method in the backtrace
saned.empty? || (saned.size == 1 && RUBY_VERSION >= "1.9")
saned.empty? || saned.size == 1
end
end

Expand Down
129 changes: 0 additions & 129 deletions lib/thor/core_ext/ordered_hash.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/thor/line_editor/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_input
$stdin.gets
else
# Lazy-load io/console since it is gem-ified as of 2.3
require "io/console" if RUBY_VERSION > "1.9.2"
require "io/console"
$stdin.noecho(&:gets)
end
end
Expand Down
5 changes: 1 addition & 4 deletions lib/thor/line_editor/readline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ def self.available?
def readline
if echo?
::Readline.completion_append_character = nil
# Ruby 1.8.7 does not allow Readline.completion_proc= to receive nil.
if complete = completion_proc
::Readline.completion_proc = complete
end
::Readline.completion_proc = completion_proc
::Readline.readline(prompt, add_to_history?)
else
super
Expand Down
Loading

0 comments on commit ae4a3d5

Please sign in to comment.