semantic 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/semantic.rb +1 -1
 - data/lib/semantic/version.rb +2 -2
 - metadata +12 -18
 - data/spec/core_ext_spec.rb +0 -43
 - data/spec/spec_helper.rb +0 -20
 - data/spec/version_spec.rb +0 -204
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8be7b65e62aeac78a5554d3fe5ab776f21531896
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f07d9b1a21e1b54713a3cb6147e53d0213859b31
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 55558e793373d843849a13058ad77db46067046255eb266919f5089c201bbab6c535f53df692707b5781c8b7ec226d077dd2723e5ba6bb588259569075aacdc4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b1761377c7f2a5beb1decd3246053906c053e76e465e654a43da102fffe3e00e34dca432ff996c74301fe2472ee968eb804d00950e4f96353bc64e592805969e
         
     | 
    
        data/lib/semantic.rb
    CHANGED
    
    
    
        data/lib/semantic/version.rb
    CHANGED
    
    | 
         @@ -78,7 +78,7 @@ module Semantic 
     | 
|
| 
       78 
78 
     | 
    
         | 
| 
       79 
79 
     | 
    
         
             
                def satisfies other_version
         
     | 
| 
       80 
80 
     | 
    
         
             
                  return true if other_version.strip == '*'
         
     | 
| 
       81 
     | 
    
         
            -
                  parts = other_version.split 
     | 
| 
      
 81 
     | 
    
         
            +
                  parts = other_version.split(/(\d(.+)?)/, 2)
         
     | 
| 
       82 
82 
     | 
    
         
             
                  comparator, other_version_string = parts[0].strip, parts[1].strip
         
     | 
| 
       83 
83 
     | 
    
         | 
| 
       84 
84 
     | 
    
         
             
                  begin
         
     | 
| 
         @@ -105,7 +105,7 @@ module Semantic 
     | 
|
| 
       105 
105 
     | 
    
         
             
                end
         
     | 
| 
       106 
106 
     | 
    
         | 
| 
       107 
107 
     | 
    
         
             
                def tilde_matches? other_version_string
         
     | 
| 
       108 
     | 
    
         
            -
                  this_parts = to_a.collect 
     | 
| 
      
 108 
     | 
    
         
            +
                  this_parts = to_a.collect(&:to_s)
         
     | 
| 
       109 
109 
     | 
    
         
             
                  other_parts = other_version_string.split('.').reject {|x| x == '*'}
         
     | 
| 
       110 
110 
     | 
    
         
             
                  other_parts == this_parts[0..other_parts.length-1]
         
     | 
| 
       111 
111 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,41 +1,41 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: semantic
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Josh Lindsey
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-09-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rake
         
     | 
| 
       15 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
19 
     | 
    
         
             
                    version: '10.1'
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :development
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
26 
     | 
    
         
             
                    version: '10.1'
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: rspec
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
33 
     | 
    
         
             
                    version: '2.14'
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :development
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
40 
     | 
    
         
             
                    version: '2.14'
         
     | 
| 
       41 
41 
     | 
    
         
             
            description: 'Semantic Version utility class for parsing, storing, and comparing versions.
         
     | 
| 
         @@ -46,14 +46,11 @@ executables: [] 
     | 
|
| 
       46 
46 
     | 
    
         
             
            extensions: []
         
     | 
| 
       47 
47 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       48 
48 
     | 
    
         
             
            files:
         
     | 
| 
      
 49 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 50 
     | 
    
         
            +
            - README.md
         
     | 
| 
       49 
51 
     | 
    
         
             
            - lib/semantic.rb
         
     | 
| 
       50 
52 
     | 
    
         
             
            - lib/semantic/core_ext.rb
         
     | 
| 
       51 
53 
     | 
    
         
             
            - lib/semantic/version.rb
         
     | 
| 
       52 
     | 
    
         
            -
            - LICENSE
         
     | 
| 
       53 
     | 
    
         
            -
            - README.md
         
     | 
| 
       54 
     | 
    
         
            -
            - spec/core_ext_spec.rb
         
     | 
| 
       55 
     | 
    
         
            -
            - spec/spec_helper.rb
         
     | 
| 
       56 
     | 
    
         
            -
            - spec/version_spec.rb
         
     | 
| 
       57 
54 
     | 
    
         
             
            homepage: https://github.com/jlindsey/semantic
         
     | 
| 
       58 
55 
     | 
    
         
             
            licenses:
         
     | 
| 
       59 
56 
     | 
    
         
             
            - MIT
         
     | 
| 
         @@ -64,22 +61,19 @@ require_paths: 
     | 
|
| 
       64 
61 
     | 
    
         
             
            - lib
         
     | 
| 
       65 
62 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       66 
63 
     | 
    
         
             
              requirements:
         
     | 
| 
       67 
     | 
    
         
            -
              - -  
     | 
| 
      
 64 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       68 
65 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       69 
66 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       70 
67 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       71 
68 
     | 
    
         
             
              requirements:
         
     | 
| 
       72 
     | 
    
         
            -
              - -  
     | 
| 
      
 69 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       73 
70 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       74 
71 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       75 
72 
     | 
    
         
             
            requirements: []
         
     | 
| 
       76 
73 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       77 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 74 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       78 
75 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       79 
76 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       80 
77 
     | 
    
         
             
            summary: Semantic Version utility class
         
     | 
| 
       81 
     | 
    
         
            -
            test_files:
         
     | 
| 
       82 
     | 
    
         
            -
            - spec/core_ext_spec.rb
         
     | 
| 
       83 
     | 
    
         
            -
            - spec/spec_helper.rb
         
     | 
| 
       84 
     | 
    
         
            -
            - spec/version_spec.rb
         
     | 
| 
      
 78 
     | 
    
         
            +
            test_files: []
         
     | 
| 
       85 
79 
     | 
    
         
             
            has_rdoc: 
         
     | 
    
        data/spec/core_ext_spec.rb
    DELETED
    
    | 
         @@ -1,43 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'semantic/core_ext'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            describe 'Core Extensions' do
         
     | 
| 
       5 
     | 
    
         
            -
              context "String#to_version" do
         
     | 
| 
       6 
     | 
    
         
            -
                before(:each) do
         
     | 
| 
       7 
     | 
    
         
            -
                  @test_versions = [
         
     | 
| 
       8 
     | 
    
         
            -
                    '1.0.0',
         
     | 
| 
       9 
     | 
    
         
            -
                    '12.45.182',
         
     | 
| 
       10 
     | 
    
         
            -
                    '0.0.1-pre.1',
         
     | 
| 
       11 
     | 
    
         
            -
                    '1.0.1-pre.5+build.123.5',
         
     | 
| 
       12 
     | 
    
         
            -
                    '1.1.1+123',
         
     | 
| 
       13 
     | 
    
         
            -
                    '0.0.0+hello',
         
     | 
| 
       14 
     | 
    
         
            -
                    '1.2.3-1'
         
     | 
| 
       15 
     | 
    
         
            -
                  ]
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                  @bad_versions = [
         
     | 
| 
       18 
     | 
    
         
            -
                    'a.b.c',
         
     | 
| 
       19 
     | 
    
         
            -
                    '1.a.3',
         
     | 
| 
       20 
     | 
    
         
            -
                    'a.3.4',
         
     | 
| 
       21 
     | 
    
         
            -
                    '5.2.a',
         
     | 
| 
       22 
     | 
    
         
            -
                    'pre3-1.5.3'
         
     | 
| 
       23 
     | 
    
         
            -
                  ]
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                it "extends String with a #to_version method" do
         
     | 
| 
       27 
     | 
    
         
            -
                  String.new.should respond_to(:to_version)
         
     | 
| 
       28 
     | 
    
         
            -
                end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                it "converts the String into a Version object" do
         
     | 
| 
       31 
     | 
    
         
            -
                  @test_versions.each do |v|
         
     | 
| 
       32 
     | 
    
         
            -
                    expect { v.to_version }.to_not raise_error()
         
     | 
| 
       33 
     | 
    
         
            -
                    v.to_version.should be_a(Semantic::Version)
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                it "raises an error on invalid strings" do
         
     | 
| 
       38 
     | 
    
         
            -
                  @bad_versions.each do |v|
         
     | 
| 
       39 
     | 
    
         
            -
                    expect { v.to_version }.to raise_error()
         
     | 
| 
       40 
     | 
    
         
            -
                  end
         
     | 
| 
       41 
     | 
    
         
            -
                end
         
     | 
| 
       42 
     | 
    
         
            -
              end
         
     | 
| 
       43 
     | 
    
         
            -
            end
         
     | 
    
        data/spec/spec_helper.rb
    DELETED
    
    | 
         @@ -1,20 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # This file was generated by the `rspec --init` command. Conventionally, all
         
     | 
| 
       2 
     | 
    
         
            -
            # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
         
     | 
| 
       3 
     | 
    
         
            -
            # Require this file using `require "spec_helper"` to ensure that it is only
         
     | 
| 
       4 
     | 
    
         
            -
            # loaded once.
         
     | 
| 
       5 
     | 
    
         
            -
            #
         
     | 
| 
       6 
     | 
    
         
            -
            # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
         
     | 
| 
       7 
     | 
    
         
            -
            RSpec.configure do |config|
         
     | 
| 
       8 
     | 
    
         
            -
              require 'semantic'
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              config.mock_framework = :rspec
         
     | 
| 
       11 
     | 
    
         
            -
              config.treat_symbols_as_metadata_keys_with_true_values = true
         
     | 
| 
       12 
     | 
    
         
            -
              config.run_all_when_everything_filtered = true
         
     | 
| 
       13 
     | 
    
         
            -
              config.filter_run :focus
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              # Run specs in random order to surface order dependencies. If you find an
         
     | 
| 
       16 
     | 
    
         
            -
              # order dependency and want to debug it, you can fix the order by providing
         
     | 
| 
       17 
     | 
    
         
            -
              # the seed, which is printed after each run.
         
     | 
| 
       18 
     | 
    
         
            -
              #     --seed 1234
         
     | 
| 
       19 
     | 
    
         
            -
              config.order = 'random'
         
     | 
| 
       20 
     | 
    
         
            -
            end
         
     | 
    
        data/spec/version_spec.rb
    DELETED
    
    | 
         @@ -1,204 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            describe Semantic::Version do
         
     | 
| 
       4 
     | 
    
         
            -
              before(:each) do
         
     | 
| 
       5 
     | 
    
         
            -
                @test_versions = [
         
     | 
| 
       6 
     | 
    
         
            -
                  '1.0.0',
         
     | 
| 
       7 
     | 
    
         
            -
                  '12.45.182',
         
     | 
| 
       8 
     | 
    
         
            -
                  '0.0.1-pre.1',
         
     | 
| 
       9 
     | 
    
         
            -
                  '1.0.1-pre.5+build.123.5',
         
     | 
| 
       10 
     | 
    
         
            -
                  '1.1.1+123',
         
     | 
| 
       11 
     | 
    
         
            -
                  '0.0.0+hello',
         
     | 
| 
       12 
     | 
    
         
            -
                  '1.2.3-1'
         
     | 
| 
       13 
     | 
    
         
            -
                ]
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                @bad_versions = [
         
     | 
| 
       16 
     | 
    
         
            -
                  'a.b.c',
         
     | 
| 
       17 
     | 
    
         
            -
                  '1.a.3',
         
     | 
| 
       18 
     | 
    
         
            -
                  'a.3.4',
         
     | 
| 
       19 
     | 
    
         
            -
                  '5.2.a',
         
     | 
| 
       20 
     | 
    
         
            -
                  'pre3-1.5.3',
         
     | 
| 
       21 
     | 
    
         
            -
                  "I am not a valid semver\n0.0.0\nbut I still pass"
         
     | 
| 
       22 
     | 
    
         
            -
                ]
         
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              context "parsing" do
         
     | 
| 
       26 
     | 
    
         
            -
                it "parses valid SemVer versions" do
         
     | 
| 
       27 
     | 
    
         
            -
                  @test_versions.each do |v|
         
     | 
| 
       28 
     | 
    
         
            -
                    expect { Semantic::Version.new v }.to_not raise_error()
         
     | 
| 
       29 
     | 
    
         
            -
                  end
         
     | 
| 
       30 
     | 
    
         
            -
                end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                it "raises an error on invalid versions" do
         
     | 
| 
       33 
     | 
    
         
            -
                  @bad_versions.each do |v|
         
     | 
| 
       34 
     | 
    
         
            -
                    expect { Semantic::Version.new v }.to raise_error()
         
     | 
| 
       35 
     | 
    
         
            -
                  end
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                it "stores parsed versions in member variables" do
         
     | 
| 
       39 
     | 
    
         
            -
                  v1 = Semantic::Version.new '1.5.9'
         
     | 
| 
       40 
     | 
    
         
            -
                  v1.major.should == 1
         
     | 
| 
       41 
     | 
    
         
            -
                  v1.minor.should == 5
         
     | 
| 
       42 
     | 
    
         
            -
                  v1.patch.should == 9
         
     | 
| 
       43 
     | 
    
         
            -
                  v1.pre.should be_nil
         
     | 
| 
       44 
     | 
    
         
            -
                  v1.build.should be_nil
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                  v2 = Semantic::Version.new '0.0.1-pre.1'
         
     | 
| 
       47 
     | 
    
         
            -
                  v2.major.should == 0
         
     | 
| 
       48 
     | 
    
         
            -
                  v2.minor.should == 0
         
     | 
| 
       49 
     | 
    
         
            -
                  v2.patch.should == 1
         
     | 
| 
       50 
     | 
    
         
            -
                  v2.pre.should == 'pre.1'
         
     | 
| 
       51 
     | 
    
         
            -
                  v2.build.should be_nil
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                  v3 = Semantic::Version.new '1.0.1-pre.5+build.123.5'
         
     | 
| 
       54 
     | 
    
         
            -
                  v3.major.should == 1
         
     | 
| 
       55 
     | 
    
         
            -
                  v3.minor.should == 0
         
     | 
| 
       56 
     | 
    
         
            -
                  v3.patch.should == 1
         
     | 
| 
       57 
     | 
    
         
            -
                  v3.pre.should == 'pre.5'
         
     | 
| 
       58 
     | 
    
         
            -
                  v3.build.should == 'build.123.5'
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  v4 = Semantic::Version.new '0.0.0+hello'
         
     | 
| 
       61 
     | 
    
         
            -
                  v4.major.should == 0
         
     | 
| 
       62 
     | 
    
         
            -
                  v4.minor.should == 0
         
     | 
| 
       63 
     | 
    
         
            -
                  v4.patch.should == 0
         
     | 
| 
       64 
     | 
    
         
            -
                  v4.pre.should be_nil
         
     | 
| 
       65 
     | 
    
         
            -
                  v4.build.should == 'hello'
         
     | 
| 
       66 
     | 
    
         
            -
                end
         
     | 
| 
       67 
     | 
    
         
            -
              end
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
              context "comparisons" do
         
     | 
| 
       70 
     | 
    
         
            -
                before(:each) do
         
     | 
| 
       71 
     | 
    
         
            -
                  # These three are all semantically equivalent, according to the spec.
         
     | 
| 
       72 
     | 
    
         
            -
                  @v1_5_9_pre_1 = Semantic::Version.new '1.5.9-pre.1'
         
     | 
| 
       73 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_5127 = Semantic::Version.new '1.5.9-pre.1+build.5127'
         
     | 
| 
       74 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_4352 = Semantic::Version.new '1.5.9-pre.1+build.4352'
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                  @v1_5_9 = Semantic::Version.new '1.5.9'
         
     | 
| 
       77 
     | 
    
         
            -
                  @v1_6_0 = Semantic::Version.new '1.6.0'
         
     | 
| 
       78 
     | 
    
         
            -
                end
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                it "determines sort order" do
         
     | 
| 
       81 
     | 
    
         
            -
                  # The second parameter here can be a string, so we want to ensure that this kind of comparison works also.
         
     | 
| 
       82 
     | 
    
         
            -
                  (@v1_5_9_pre_1 <=> @v1_5_9_pre_1.to_s).should == 0
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                  (@v1_5_9_pre_1 <=> @v1_5_9_pre_1_build_5127).should == 0
         
     | 
| 
       85 
     | 
    
         
            -
                  (@v1_5_9_pre_1 <=> @v1_5_9).should == -1
         
     | 
| 
       86 
     | 
    
         
            -
                  (@v1_5_9_pre_1_build_5127 <=> @v1_5_9).should == -1
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_5127.build.should == 'build.5127'
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                  (@v1_5_9 <=> @v1_5_9).should == 0
         
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                  (@v1_5_9 <=> @v1_6_0).should == -1
         
     | 
| 
       93 
     | 
    
         
            -
                  (@v1_6_0 <=> @v1_5_9).should == 1
         
     | 
| 
       94 
     | 
    
         
            -
                  (@v1_6_0 <=> @v1_5_9_pre_1).should == 1
         
     | 
| 
       95 
     | 
    
         
            -
                  (@v1_5_9_pre_1 <=> @v1_6_0).should == -1
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                  [@v1_5_9_pre_1, @v1_5_9_pre_1_build_5127, @v1_5_9, @v1_6_0]
         
     | 
| 
       98 
     | 
    
         
            -
                    .reverse
         
     | 
| 
       99 
     | 
    
         
            -
                    .sort
         
     | 
| 
       100 
     | 
    
         
            -
                    .should == [@v1_5_9_pre_1, @v1_5_9_pre_1_build_5127, @v1_5_9, @v1_6_0]
         
     | 
| 
       101 
     | 
    
         
            -
                end
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
                it "determines whether it is greater than another instance" do
         
     | 
| 
       104 
     | 
    
         
            -
                  # These should be equal, since "Build metadata SHOULD be ignored when determining version precedence".
         
     | 
| 
       105 
     | 
    
         
            -
                  # (SemVer 2.0.0-rc.2, paragraph 10 - http://www.semver.org)
         
     | 
| 
       106 
     | 
    
         
            -
                  @v1_5_9_pre_1.should_not > @v1_5_9_pre_1_build_5127
         
     | 
| 
       107 
     | 
    
         
            -
                  @v1_5_9_pre_1.should_not < @v1_5_9_pre_1_build_5127
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                  @v1_6_0.should > @v1_5_9
         
     | 
| 
       110 
     | 
    
         
            -
                  @v1_5_9.should_not > @v1_6_0
         
     | 
| 
       111 
     | 
    
         
            -
                  @v1_5_9.should > @v1_5_9_pre_1_build_5127
         
     | 
| 
       112 
     | 
    
         
            -
                  @v1_5_9.should > @v1_5_9_pre_1
         
     | 
| 
       113 
     | 
    
         
            -
                end
         
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
                it "determines whether it is less than another instance" do
         
     | 
| 
       116 
     | 
    
         
            -
                  @v1_5_9_pre_1.should_not < @v1_5_9_pre_1_build_5127
         
     | 
| 
       117 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_5127.should_not < @v1_5_9_pre_1
         
     | 
| 
       118 
     | 
    
         
            -
                  @v1_5_9_pre_1.should < @v1_5_9
         
     | 
| 
       119 
     | 
    
         
            -
                  @v1_5_9_pre_1.should < @v1_6_0
         
     | 
| 
       120 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_5127.should < @v1_6_0
         
     | 
| 
       121 
     | 
    
         
            -
                  @v1_5_9.should < @v1_6_0
         
     | 
| 
       122 
     | 
    
         
            -
                end
         
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
                it "determines whether it is greater than or equal to another instance" do
         
     | 
| 
       125 
     | 
    
         
            -
                  @v1_5_9_pre_1.should >= @v1_5_9_pre_1
         
     | 
| 
       126 
     | 
    
         
            -
                  @v1_5_9_pre_1.should >= @v1_5_9_pre_1_build_5127
         
     | 
| 
       127 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_5127.should >= @v1_5_9_pre_1
         
     | 
| 
       128 
     | 
    
         
            -
                  @v1_5_9.should >= @v1_5_9_pre_1
         
     | 
| 
       129 
     | 
    
         
            -
                  @v1_6_0.should >= @v1_5_9
         
     | 
| 
       130 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_5127.should_not >= @v1_6_0
         
     | 
| 
       131 
     | 
    
         
            -
                end
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
                it "determines whether it is less than or equal to another instance" do
         
     | 
| 
       134 
     | 
    
         
            -
                  @v1_5_9_pre_1.should <= @v1_5_9_pre_1_build_5127
         
     | 
| 
       135 
     | 
    
         
            -
                  @v1_6_0.should_not <= @v1_5_9
         
     | 
| 
       136 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_5127.should <= @v1_5_9_pre_1_build_5127
         
     | 
| 
       137 
     | 
    
         
            -
                  @v1_5_9.should_not <= @v1_5_9_pre_1
         
     | 
| 
       138 
     | 
    
         
            -
                end
         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
                it "determines whether it is semantically equal to another instance" do
         
     | 
| 
       141 
     | 
    
         
            -
                  @v1_5_9_pre_1.should == @v1_5_9_pre_1.dup
         
     | 
| 
       142 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_5127.should == @v1_5_9_pre_1_build_5127.dup
         
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
                  # "Semantically equal" is the keyword here; these are by definition not "equal" (different build), but should be treated as
         
     | 
| 
       145 
     | 
    
         
            -
                  # equal according to the spec.
         
     | 
| 
       146 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_4352.should == @v1_5_9_pre_1_build_5127
         
     | 
| 
       147 
     | 
    
         
            -
                  @v1_5_9_pre_1_build_4352.should == @v1_5_9_pre_1
         
     | 
| 
       148 
     | 
    
         
            -
                end
         
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
                it "determines whether it satisfies >= style specifications" do
         
     | 
| 
       151 
     | 
    
         
            -
                  @v1_6_0.satisfies('>=1.6.0').should be_true
         
     | 
| 
       152 
     | 
    
         
            -
                  @v1_6_0.satisfies('<=1.6.0').should be_true
         
     | 
| 
       153 
     | 
    
         
            -
                  @v1_6_0.satisfies('>=1.5.0').should be_true
         
     | 
| 
       154 
     | 
    
         
            -
                  @v1_6_0.satisfies('<=1.5.0').should_not be_true
         
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
                  # partial / non-semver numbers after comparator are extremely common in
         
     | 
| 
       157 
     | 
    
         
            -
                  # version specifications in the wild
         
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
                  @v1_6_0.satisfies('>1.5').should be_true
         
     | 
| 
       160 
     | 
    
         
            -
                  @v1_6_0.satisfies('<1').should_not be_true
         
     | 
| 
       161 
     | 
    
         
            -
                end
         
     | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
       163 
     | 
    
         
            -
                it "determines whether it satisfies * style specifications" do
         
     | 
| 
       164 
     | 
    
         
            -
                  @v1_6_0.satisfies('1.*').should be_true
         
     | 
| 
       165 
     | 
    
         
            -
                  @v1_6_0.satisfies('1.6.*').should be_true
         
     | 
| 
       166 
     | 
    
         
            -
                  @v1_6_0.satisfies('2.*').should_not be_true
         
     | 
| 
       167 
     | 
    
         
            -
                  @v1_6_0.satisfies('1.5.*').should_not be_true
         
     | 
| 
       168 
     | 
    
         
            -
                end
         
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
                it "determines whether it satisfies ~ style specifications" do
         
     | 
| 
       171 
     | 
    
         
            -
                  @v1_6_0.satisfies('~1.6').should be_true
         
     | 
| 
       172 
     | 
    
         
            -
                  @v1_5_9_pre_1.satisfies('~1.5').should be_true
         
     | 
| 
       173 
     | 
    
         
            -
                  @v1_6_0.satisfies('~1.5').should_not be_true
         
     | 
| 
       174 
     | 
    
         
            -
                end
         
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
              end
         
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
              context "type coercions" do
         
     | 
| 
       179 
     | 
    
         
            -
                it "converts to a string" do
         
     | 
| 
       180 
     | 
    
         
            -
                  @test_versions.each do |v|
         
     | 
| 
       181 
     | 
    
         
            -
                    Semantic::Version.new(v).to_s.should == v
         
     | 
| 
       182 
     | 
    
         
            -
                  end
         
     | 
| 
       183 
     | 
    
         
            -
                end
         
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
                it "converts to an array" do
         
     | 
| 
       186 
     | 
    
         
            -
                  Semantic::Version.new('1.0.0').to_a.should == [1, 0, 0, nil, nil]
         
     | 
| 
       187 
     | 
    
         
            -
                  Semantic::Version.new('6.1.4-pre.5').to_a.should == [6, 1, 4, 'pre.5', nil]
         
     | 
| 
       188 
     | 
    
         
            -
                  Semantic::Version.new('91.6.0+build.17').to_a.should == [91, 6, 0, nil, 'build.17']
         
     | 
| 
       189 
     | 
    
         
            -
                  Semantic::Version.new('0.1.5-pre.7+build191').to_a.should == [0, 1, 5, 'pre.7', 'build191']
         
     | 
| 
       190 
     | 
    
         
            -
                end
         
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
                it "converts to a hash" do
         
     | 
| 
       193 
     | 
    
         
            -
                  Semantic::Version.new('1.0.0').to_h.should == { major: 1, minor: 0, patch: 0, pre: nil, build: nil }
         
     | 
| 
       194 
     | 
    
         
            -
                  Semantic::Version.new('6.1.4-pre.5').to_h.should == { major: 6, minor: 1, patch: 4, pre: 'pre.5', build: nil }
         
     | 
| 
       195 
     | 
    
         
            -
                  Semantic::Version.new('91.6.0+build.17').to_h.should == { major: 91, minor: 6, patch: 0, pre: nil, build: 'build.17' }
         
     | 
| 
       196 
     | 
    
         
            -
                  Semantic::Version.new('0.1.5-pre.7+build191').to_h.should == { major: 0, minor: 1, patch: 5, pre: 'pre.7', build: 'build191' }
         
     | 
| 
       197 
     | 
    
         
            -
                end
         
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
                it "aliases conversion methods" do
         
     | 
| 
       200 
     | 
    
         
            -
                  v = Semantic::Version.new('0.0.0')
         
     | 
| 
       201 
     | 
    
         
            -
                  [:to_hash, :to_array, :to_string].each { |sym| v.should respond_to(sym) }
         
     | 
| 
       202 
     | 
    
         
            -
                end
         
     | 
| 
       203 
     | 
    
         
            -
              end
         
     | 
| 
       204 
     | 
    
         
            -
            end
         
     |