Sha256: b45dd87c3d8bd1e93de3298ab26b55e2ef3a6d4d296f803adfff052116fec0df

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

module Bundleup
  class PinReport < Report
    def initialize(gem_versions:, outdated_gems:, gem_comments:)
      super()
      @gem_versions = gem_versions
      @outdated_gems = outdated_gems
      @gem_comments = gem_comments
    end

    def title
      return "Note that this gem is being held back:" if rows.count == 1

      "Note that the following gems are being held back:"
    end

    def rows
      outdated_gems.keys.sort.map do |gem|
        meta = outdated_gems[gem]
        current_version = gem_versions[gem]
        newest_version = meta[:newest]
        pin = meta[:pin]

        [gem, current_version, "→", newest_version, *pin_reason(gem, pin)]
      end
    end

    def pinned_gems
      outdated_gems.keys.sort
    end

    private

    attr_reader :gem_versions, :outdated_gems, :gem_comments

    def pin_reason(gem, pin)
      notes = Colors.gray(gem_comments[gem].to_s)
      pin_operator, pin_version = pin.split(" ", 2)
      [":", "pinned at", pin_operator.rjust(2), pin_version, notes]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bundleup-2.5.2 lib/bundleup/pin_report.rb
bundleup-2.5.1 lib/bundleup/pin_report.rb
bundleup-2.5.0 lib/bundleup/pin_report.rb
bundleup-2.4.2 lib/bundleup/pin_report.rb
bundleup-2.4.1 lib/bundleup/pin_report.rb
bundleup-2.4.0 lib/bundleup/pin_report.rb