class Bundler::Injector

def remove_gems_from_dependencies(builder, gems, gemfile_path)

Returns:
  • (Array) - Array of removed dependencies.

Parameters:
  • gemfile_path (Pathname) -- Path of the Gemfile.
  • gems (Array) -- Array of names of gems to be removed.
  • builder (Dsl) -- Dsl object of current Gemfile.
def remove_gems_from_dependencies(builder, gems, gemfile_path)
  removed_deps = []
  gems.each do |gem_name|
    deleted_dep = builder.dependencies.find {|d| d.name == gem_name }
    if deleted_dep.nil?
      raise GemfileError, "`#{gem_name}` is not specified in #{gemfile_path} so it could not be removed."
    end
    builder.dependencies.delete(deleted_dep)
    removed_deps << deleted_dep
  end
  removed_deps
end