class Bundler::Injector
def remove_deps(gemfile_path)
evaluates a gemfile to remove the specified gem
def remove_deps(gemfile_path) initial_gemfile = File.readlines(gemfile_path) Bundler.ui.info "Removing gems from #{gemfile_path}" # evaluate the Gemfile we have builder = Dsl.new builder.eval_gemfile(gemfile_path) removed_deps = remove_gems_from_dependencies(builder, @deps, gemfile_path) # abort the operation if no gems were removed # no need to operate on gemfile further return [] if removed_deps.empty? cleaned_gemfile = remove_gems_from_gemfile(@deps, gemfile_path) SharedHelpers.write_to_gemfile(gemfile_path, cleaned_gemfile) # check for errors # including extra gems being removed # or some gems not being removed # and return the actual removed deps cross_check_for_errors(gemfile_path, builder.dependencies, removed_deps, initial_gemfile) end