method
remove_deps
v2_6_3 -
Show latest stable
- Class:
Bundler::Injector
remove_deps(gemfile_path)private
evalutes a gemfile to remove the specified gem from it.
# File lib/bundler/injector.rb, line 128
def remove_deps(gemfile_path)
initial_gemfile = IO.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 opertion if no gems were removed
# no need to operate on gemfile furthur
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 Related methods
- Instance methods
- inject
- remove
- Class methods
- inject
- new
- remove
- Private methods
-
append_to -
build_gem_lines -
conservative_version -
cross_check_for_errors -
remove_deps -
remove_gems_from_dependencies -
remove_gems_from_gemfile -
remove_nested_blocks -
show_warning -
version_prefix