class AutoGemUpdater::Updater
Attributes
outdated_gems[R]
Public Class Methods
perform()
click to toggle source
# File lib/auto_gem_updater/updater.rb, line 8 def self.perform new(outdated_gems: AutoGemUpdater::Outdated.perform).perform end
Private Class Methods
new(outdated_gems:)
click to toggle source
# File lib/auto_gem_updater/updater.rb, line 12 def initialize(outdated_gems:) @outdated_gems = outdated_gems end
Public Instance Methods
perform()
click to toggle source
# File lib/auto_gem_updater/updater.rb, line 17 def perform return unless outdated_gems.any? return unless system("git checkout -b auto_gem_updates_#{Time.now.strftime('%d_%m_%Y')}") outdated_gems.each do |name:, newest:, installed:| puts "Updating #{name} from #{installed} to #{newest}" system_command("bundle update #{name} --conservative") if AutoGemUpdater.pre_checks.all? { |check| system_command(check) } puts "Update checks passed commiting update to #{name}" system_command('git add Gemfile.lock') system_command("git commit -m 'Updated: #{name} from #{installed} to #{newest}'") else puts "Failed to update the gem #{name}" system_command('git checkout Gemfile.lock') end end end