Skip to content

Commit

Permalink
[LockfileParser] Ensure specs are consistently ordered
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Aug 25, 2016
1 parent 07c76fd commit a846279
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions lib/bundler/lazy_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
module Bundler
class LazySpecification
Identifier = Struct.new(:name, :version, :source, :platform, :dependencies)
class Identifier
include Comparable
def <=>(other)
return unless other.is_a?(Identifier)
[name, version, platform_string] <=> [other.name, other.version, other.platform_string]
end

protected

def platform_string
platform_string = platform.to_s
platform_string == Index::RUBY ? Index::NULL : platform_string
end
end

include MatchPlatform

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/lockfile_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def initialize(lockfile)
end
end
@sources << @rubygems_aggregate
@specs = @specs.values
@specs = @specs.values.sort_by(&:identifier)
warn_for_outdated_bundler_version
rescue ArgumentError => e
Bundler.ui.debug(e)
Expand Down

0 comments on commit a846279

Please sign in to comment.