Class: DependencyBot::Fixer::BundleAudit

Inherits:
Object
  • Object
show all
Defined in:
lib/dependency_bot/fixer/bundle_audit.rb

Overview

This class is responsible for updating a Ruby dependency using the ‘bundle update` command to fix security vulnerabilities. It is part of the DependencyBot::Fixer module.

Usage:

fixer = DependencyBot::Fixer::BundleAudit.new(dependency)
fixer.fix
puts fixer.branch_name
puts fixer.commit_message

Instance Method Summary collapse

Constructor Details

#initialize(dependency) ⇒ BundleAudit

Returns a new instance of BundleAudit.



15
16
17
# File 'lib/dependency_bot/fixer/bundle_audit.rb', line 15

def initialize(dependency)
  @dependency = dependency
end

Instance Method Details

#branch_nameObject



23
24
25
# File 'lib/dependency_bot/fixer/bundle_audit.rb', line 23

def branch_name
  "update-#{@dependency.name.downcase}"
end

#commit_messageObject



27
28
29
# File 'lib/dependency_bot/fixer/bundle_audit.rb', line 27

def commit_message
  "Update #{@dependency.name} to fix security vulnerabilities"
end

#fixObject



19
20
21
# File 'lib/dependency_bot/fixer/bundle_audit.rb', line 19

def fix
  Kernel.exec "bundle update #{@dependency.name}"
end