Skip to content

Commit

Permalink
Use newer RubyGems API to look for bundler
Browse files Browse the repository at this point in the history
Closes #448
  • Loading branch information
mattwynne committed Jun 30, 2013
1 parent deff34a commit 2b72335
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/cucumber/rake/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,13 @@ def quoted_binary(cucumber_bin)
end

def use_bundler
@bundler.nil? ? File.exist?("./Gemfile") && gem_available?("bundler") : @bundler
@bundler.nil? ? File.exist?("./Gemfile") && bundler_gem_available? : @bundler
end

def gem_available?(gemname)
gem_available_new_rubygems?(gemname) || gem_available_old_rubygems?(gemname)
end

def gem_available_old_rubygems?(gemname)
Gem.available?(gemname)
end

def gem_available_new_rubygems?(gemname)
Gem::Specification.respond_to?(:find_all_by_name) && Gem::Specification.find_all_by_name(gemname).any?
def bundler_gem_available?
Gem::Specification.find_by_name('bundler')
rescue Gem::LoadError
false
end

def cmd
Expand Down

0 comments on commit 2b72335

Please sign in to comment.