Sha256: 1a1fcea88741bd76562c73f8ae21222ba58c85f5f6c7f2c80da523361bd2b4ae

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

class CompareLinker
  class LockfileComparator
    attr_accessor :updated_gems

    def initialize
      @updated_gems = {}
    end

    def compare(old_lockfile, new_lockfile)
      old_lockfile.specs.each do |old_spec|
        new_lockfile.specs.each do |new_spec|
          if old_spec.name == new_spec.name
            old_rev = old_spec.source.options["revision"]
            new_rev = new_spec.source.options["revision"]
            if old_rev && new_rev && (old_rev != new_rev)
              _, owner, gem_name = old_spec.source.uri.match(/github\.com\/([^\/]+)\/([^.]+)/).to_a
              updated_gems[old_spec.name] = {
                owner: owner,
                gem_name: gem_name,
                old_rev: old_rev,
                new_rev: new_rev,
              }
            elsif old_spec.version != new_spec.version
              updated_gems[old_spec.name] = {
                owner: nil,
                gem_name: old_spec.name,
                old_ver: old_spec.version.to_s,
                new_ver: new_spec.version.to_s,
              }
            end
          end
        end
      end
      updated_gems
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
compare_linker-1.3.0 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.2.1 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.2.0 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.9 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.8 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.7 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.6 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.5 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.4 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.3 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.2 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.1.1 lib/compare_linker/lockfile_comparator.rb