Sha256: bbc515b3ffd3d46e7389f71b871061f02414c6a80c0d094d64188dcf2f7d3685

Contents?: true

Size: 970 Bytes

Versions: 10

Compression:

Stored size: 970 Bytes

Contents

require "ostruct"

class CompareLinker
  class Formatter
    class Text < Base
      def format(gem_info)
        g = OpenStruct.new(gem_info)

        text = case
        when g.owner && g.old_rev && g.new_rev
          "#{g.gem_name}: https://github.com/#{g.owner}/#{g.gem_name}/compare/#{g.old_rev}...#{g.new_rev}"
        when g.homepage_uri
          "#{g.gem_name} (#{g.homepage_uri}): #{g.old_ver} => #{g.new_ver}"
        when g.old_tag && g.new_tag
          "#{g.gem_name}: https://github.com/#{g.repo_owner}/#{g.repo_name}/compare/#{g.old_tag}...#{g.new_tag}"
        when g.repo_owner && g.repo_name
          "#{g.gem_name}: https://github.com/#{g.repo_owner}/#{g.repo_name} #{g.old_ver} => #{g.new_ver}"
        else
          "#{g.gem_name} (link not found): #{g.old_ver} => #{g.new_ver}"
        end

        if downgrade?(g.old_ver, g.new_ver, g.old_tag, g.new_tag)
          text += " (downgrade)"
        end

        text
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
compare_linker-1.2.1 lib/compare_linker/formatter/text.rb
compare_linker-1.2.0 lib/compare_linker/formatter/text.rb
compare_linker-1.1.9 lib/compare_linker/formatter/text.rb
compare_linker-1.1.8 lib/compare_linker/formatter/text.rb
compare_linker-1.1.7 lib/compare_linker/formatter/text.rb
compare_linker-1.1.6 lib/compare_linker/formatter/text.rb
compare_linker-1.1.5 lib/compare_linker/formatter/text.rb
compare_linker-1.1.4 lib/compare_linker/formatter/text.rb
compare_linker-1.1.3 lib/compare_linker/formatter/text.rb
compare_linker-1.1.2 lib/compare_linker/formatter/text.rb