Skip to content

Commit

Permalink
Merge pull request #676 from deivid-rodriguez/followup_to_ruby_1_supp…
Browse files Browse the repository at this point in the history
…ort_drop

Followup to ruby 1 support drop
  • Loading branch information
rafaelfranca authored Sep 13, 2019
2 parents 96b52ea + 0431572 commit edb975f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

gem "rake", "< 11"
gem "rake"

group :development do
gem "pry"
Expand All @@ -16,8 +16,6 @@ end
group :test do
gem "childlabor"
gem "coveralls", ">= 0.8.19"
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"
Expand Down
20 changes: 5 additions & 15 deletions lib/thor/actions/directory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,12 @@ def execute!
end
end

if RUBY_VERSION < "2.0"
def file_level_lookup(previous_lookup)
File.join(previous_lookup, "{*,.[a-z]*}")
end

def files(lookup)
Dir[lookup]
end
else
def file_level_lookup(previous_lookup)
File.join(previous_lookup, "*")
end
def file_level_lookup(previous_lookup)
File.join(previous_lookup, "*")
end

def files(lookup)
Dir.glob(lookup, File::FNM_DOTMATCH)
end
def files(lookup)
Dir.glob(lookup, File::FNM_DOTMATCH)
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/register_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ClassOptionGroupPlugin < Thor::Group
:default => "zebra"
end

class CompatibleWith19Plugin < ClassOptionGroupPlugin
class PluginInheritingFromClassOptionsGroup < ClassOptionGroupPlugin
desc "animal"
def animal
p options[:who]
Expand Down Expand Up @@ -119,7 +119,7 @@ def with_args(*args)
)

BoringVendorProvidedCLI.register(
CompatibleWith19Plugin,
PluginInheritingFromClassOptionsGroup,
"zoo",
"zoo [-w animal]",
"Shows a provided animal or just zebra"
Expand Down Expand Up @@ -221,13 +221,13 @@ def with_args(*args)
end
end

describe "1.8 and 1.9 syntax compatibility" do
it "is compatible with both 1.8 and 1.9 syntax w/o command options" do
describe ".register-ing a Thor::Group subclass with class options" do
it "works w/o command options" do
group_output = capture(:stdout) { BoringVendorProvidedCLI.start(%w(zoo)) }
expect(group_output).to match(/zebra/)
end

it "is compatible with both 1.8 and 1.9 syntax w/command options" do
it "works w/command options" do
group_output = capture(:stdout) { BoringVendorProvidedCLI.start(%w(zoo -w lion)) }
expect(group_output).to match(/lion/)
end
Expand Down

0 comments on commit edb975f

Please sign in to comment.