summaryrefslogtreecommitdiff
path: root/lib/bundler/injector.rb
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/injector.rb11
1 files changed, 9 insertions, 2 deletions
@@ -179,11 +179,11 @@ module Bundler
# @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
def remove_gems_from_gemfile(gems, gemfile_path)
patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
-
new_gemfile = []
multiline_removal = false
IO.readlines(gemfile_path).each do |line|
- if line.match(patterns)
multiline_removal = line.rstrip.end_with?(",")
# skip lines which match the regex
next
@@ -207,6 +207,13 @@ module Bundler
new_gemfile.join.chomp
end
# @param [Array] gemfile Array of gemfile contents.
# @param [String] block_name Name of block name to look for.
def remove_nested_blocks(gemfile, block_name)