Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

use lockfile parser for detecting gems in Gemfile

doing this so we can detect in case bundle install fails
  • Loading branch information...
1 parent 0ad0b01 commit 4f2bbbef036fecb4b024c057b7a014fbb06f616b @hone hone committed
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/language_pack/ruby.rb
18 lib/language_pack/ruby.rb
@@ -258,21 +258,25 @@ def add_bundler_to_load_path
# detects whether the Gemfile.lock contains the Windows platform
# @return [Boolean] true if the Gemfile.lock was created on Windows
def has_windows_gemfile_lock?
- add_bundler_to_load_path
- require "bundler"
- parser ="Gemfile.lock"))
- parser.platforms.detect do |platform|
+ lockfile_parser.platforms.detect do |platform|
/mingw|mswin/.match(platform.os) if platform.is_a?(Gem::Platform)
# detects if a gem is in the bundle.
- # @note it caches the output of `bundle show` on the first run, so this will break if `bundle show` changes between calls.
# @param [String] name of the gem in question
# @return [String, nil] if it finds the gem, it will return the line from bundle show or nil if nothing is found.
def gem_is_bundled?(gem)
- @bundle_show ||= run("bundle show")
- @bundle_show.split("\n").detect { |line| line =~ / \* #{gem} / }
+ @bundler_gems ||=
+ @bundler_gems.include?(gem)
+ end
+ # setup the lockfile parser
+ # @return [Bundler::LockfileParser] a Bundler::LockfileParser
+ def lockfile_parser
+ add_bundler_to_load_path
+ require "bundler"
+ @lockfile_parser ||="Gemfile.lock"))
# detects if a rake task is defined in the app

0 comments on commit 4f2bbbe

Please sign in to comment.
Something went wrong with that request. Please try again.