Sha256: c7354d0f26ab8fbd3d7220656f0dd711117a76dda5868f42b7a8841042eeb35d

Contents?: true

Size: 1.17 KB

Versions: 17

Compression:

Stored size: 1.17 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)
              # This section may be unnecessary?
              _, 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

17 entries across 17 versions & 1 rubygems

Version Path
compare_linker-1.4.8 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.4.7 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.4.6 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.4.5 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.4.4 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.4.3 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.4.2 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.4.1 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.4.0 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.3.8 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.3.7 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.3.6 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.3.5 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.3.4 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.3.3 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.3.2 lib/compare_linker/lockfile_comparator.rb
compare_linker-1.3.1 lib/compare_linker/lockfile_comparator.rb