diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-08-08 14:00:45 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-25 11:16:58 -0500 |
commit | a8462799055044fefa4c2df707ed1dd52db6c56b (patch) | |
tree | b83075d10795c2a311e1e05c6b88654b7220979f /lib/bundler/lazy_specification.rb | |
parent | 07c76fd07fe827d27ce40d6bf048ebc840330bc8 (diff) | |
download | bundler-a8462799055044fefa4c2df707ed1dd52db6c56b.tar.gz |
[LockfileParser] Ensure specs are consistently ordered
Diffstat (limited to 'lib/bundler/lazy_specification.rb')
-rw-r--r-- | lib/bundler/lazy_specification.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index f4cd3614b8..0b667f7dbe 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -6,6 +6,20 @@ require "bundler/match_platform" 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 |