class Bunup::Services::Updater

Use bundler to update the gem and the Gemfile

Constants

USING_PATTERN

Public Class Methods

new(gem) click to toggle source
# File lib/bunup/services/updater.rb, line 7
def initialize(gem)
  @gem = gem
end

Public Instance Methods

perform() click to toggle source
# File lib/bunup/services/updater.rb, line 11
def perform
  update
end

Private Instance Methods

bundle_update() click to toggle source
# File lib/bunup/services/updater.rb, line 17
def bundle_update
  ::Open3.capture3("bundle update #{@gem.name}")
end
update() click to toggle source
# File lib/bunup/services/updater.rb, line 21
def update
  stdout, _stderr, _status = bundle_update

  # Bundler might be unable to update the gem, and won't say why.
  if stdout =~ /its version stayed the same/
    raise ::SystemExit.new(
      false,
      "Bundler tried to update #{@gem.name} " \
        'but its version stayed the same'
    )
  end
end