Class: Dependabot::Bundler::FileUpdater::GemfileUpdater
- Inherits:
-
Object
- Object
- Dependabot::Bundler::FileUpdater::GemfileUpdater
- Defined in:
- lib/dependabot/bundler/file_updater/gemfile_updater.rb
Constant Summary collapse
- GEMFILE_FILENAMES =
%w(Gemfile gems.rb).freeze
Instance Method Summary collapse
-
#initialize(dependencies:, gemfile:) ⇒ GemfileUpdater
constructor
A new instance of GemfileUpdater.
- #updated_gemfile_content ⇒ Object
Constructor Details
#initialize(dependencies:, gemfile:) ⇒ GemfileUpdater
Returns a new instance of GemfileUpdater.
16 17 18 19 |
# File 'lib/dependabot/bundler/file_updater/gemfile_updater.rb', line 16 def initialize(dependencies:, gemfile:) @dependencies = dependencies @gemfile = gemfile end |
Instance Method Details
#updated_gemfile_content ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dependabot/bundler/file_updater/gemfile_updater.rb', line 21 def updated_gemfile_content content = gemfile.content dependencies.each do |dependency| content = replace_gemfile_version_requirement( dependency, gemfile, content ) content = remove_gemfile_git_source(dependency, content) if remove_git_source?(dependency) content = update_gemfile_git_pin(dependency, gemfile, content) if update_git_pin?(dependency, gemfile) end content end |