Sha256: 3e55dfbbe16bc03b1369b3f68eaee506c1fa973a4561d2a3ddb31d63cb999b95

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

module KeepUp
  # Apply potential updates to a Gemfile.
  class Updater
    attr_reader :bundle, :repository, :version_control

    def initialize(bundle:, repository:, version_control:)
      @bundle = bundle
      @repository = repository
      @version_control = version_control
    end

    def run
      possible_updates.each do |update|
        if bundle.apply_updated_dependency update
          version_control.commit_changes update
        else
          version_control.revert_changes
        end
      end
    end

    def possible_updates
      bundle.direct_dependencies.
        map { |dep| repository.updated_dependency_for dep }.compact
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
keep_up-0.2.0 lib/keep_up/updater.rb
keep_up-0.1.0 lib/keep_up/updater.rb