semantic-version 2.0.0.pre.alpha.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 +7 -0
 - data/.gitignore +14 -0
 - data/Gemfile +7 -0
 - data/LICENSE.md +25 -0
 - data/README.md +252 -0
 - data/Rakefile +16 -0
 - data/bin/rake +9 -0
 - data/lib/semantic/version/data.rb +41 -0
 - data/lib/semantic/version/helper.rb +44 -0
 - data/lib/semantic/version/number.rb +45 -0
 - data/lib/semantic/version/to_string.rb +15 -0
 - data/lib/semantic/version.rb +103 -0
 - data/semantic-version.gemspec +30 -0
 - data/semantic-version.version +1 -0
 - metadata +117 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3f9241c69186fc00e63fefb4d11d5bbbbe36b4e2
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ca581b70fc94866659effd01c5a83d23a8e38b21
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3de5e410f84e2445dfaf639f9e1827b262dd7bdd74425e923820a9d7d79fd49e73ff021cbd7e79abede01551cfd9c3f26a1de713976851ad8ccaa080fa6d4f79
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5cde7fcc9a7f6f212d8475d314cd6c116a0ee28c4792d83d2540ce3b34059d73948ae789c186502f8a6f840e810c9bbcc7e6294018f5f652635a0d55ce75bb7d
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.md
    ADDED
    
    | 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            > **Copyright (c) 2015 Chris Keele**
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
            -----------
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 7 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 8 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 9 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 10 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 11 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 12 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 15 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            *
         
     | 
| 
      
 18 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 19 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 20 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 21 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 22 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 23 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 24 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
| 
      
 25 
     | 
    
         
            +
            *
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,252 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Semantic::Version
         
     | 
| 
      
 2 
     | 
    
         
            +
            =================
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            > *Semantic version objects for Ruby.*
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              A utility library that provides a `Semantic::Version` value object.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              You can parse strings into version objects or construct them by hand. Any module, class, or object can be given a version through a helper. All version objects properly handle instantiation, duplication, cloning, accessors, mutators, stringification, and comparison; and come with helpful predicate methods.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Installation
         
     | 
| 
      
 12 
     | 
    
         
            +
            ------------
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 17 
     | 
    
         
            +
            gem 'semantic-version'
         
     | 
| 
      
 18 
     | 
    
         
            +
            ```
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 23 
     | 
    
         
            +
            bundle
         
     | 
| 
      
 24 
     | 
    
         
            +
            ```
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            Or version your gem with it like so:
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            1. Create or modify your version file:
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              ```ruby
         
     | 
| 
      
 31 
     | 
    
         
            +
              # my_gem/version.rb
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              require 'semantic/version'
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              module MyGem
         
     | 
| 
      
 36 
     | 
    
         
            +
                extend Semantic::Version::Helper
         
     | 
| 
      
 37 
     | 
    
         
            +
                version '0.0.1'
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
              ```
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            2. Modify your gemspec:
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              ```ruby
         
     | 
| 
      
 44 
     | 
    
         
            +
              # my_gem.gemspec
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              #...
         
     | 
| 
      
 47 
     | 
    
         
            +
              require 'my_gem/version'
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
              Gem::Specification.new do |spec|
         
     | 
| 
      
 50 
     | 
    
         
            +
                #...
         
     | 
| 
      
 51 
     | 
    
         
            +
                spec.version = MyGem.version
         
     | 
| 
      
 52 
     | 
    
         
            +
                #...
         
     | 
| 
      
 53 
     | 
    
         
            +
                spec.add_dependency "semantic-version", "~> 2.0.0"
         
     | 
| 
      
 54 
     | 
    
         
            +
                #...
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
              ```
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            3. Update your `Gemfile.lock`:
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
              ```sh
         
     | 
| 
      
 61 
     | 
    
         
            +
              bundle
         
     | 
| 
      
 62 
     | 
    
         
            +
              ```
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            4. Add the relevant rake tasks *optional*:
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              ```ruby
         
     | 
| 
      
 67 
     | 
    
         
            +
              # Rakefile
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
              #...
         
     | 
| 
      
 70 
     | 
    
         
            +
              require 'semantic/version/tasks'
         
     | 
| 
      
 71 
     | 
    
         
            +
              ```
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            There is currently no advantage to using `Semantic::Version` objects in your gemspec, outside of using the provided rake tasks, except to declare to the world that your gem is semantic versioning compliant.
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            Usage
         
     | 
| 
      
 76 
     | 
    
         
            +
            -----
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            Versions can be parsed from strings, or constructed piecewise:
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 81 
     | 
    
         
            +
            Semantic::Version.parse '1.0.0'
         
     | 
| 
      
 82 
     | 
    
         
            +
            Semantic::Version.new major: 1, minor: 0, patch: 0
         
     | 
| 
      
 83 
     | 
    
         
            +
            # => #<struct Semantic::Version
         
     | 
| 
      
 84 
     | 
    
         
            +
            #      number=#<struct Semantic::Version::Number major=1, minor=0, patch=0>,
         
     | 
| 
      
 85 
     | 
    
         
            +
            #      prerelease=[],
         
     | 
| 
      
 86 
     | 
    
         
            +
            #      meta=[]
         
     | 
| 
      
 87 
     | 
    
         
            +
            #    >
         
     | 
| 
      
 88 
     | 
    
         
            +
            ```
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
            Versions can have multiple pre-release and meta tags:
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 93 
     | 
    
         
            +
            Semantic::Version.parse '1.0.0-alpha.12+build.2981'
         
     | 
| 
      
 94 
     | 
    
         
            +
            Semantic::Version.new major: 1, minor: 0, patch: 0, prerelease: %w[alpha 12], meta: %w[build 2981]
         
     | 
| 
      
 95 
     | 
    
         
            +
            # => #<struct Semantic::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
            #      number=#<struct Semantic::Version::Number major=1, minor=0, patch=0>,
         
     | 
| 
      
 97 
     | 
    
         
            +
            #      prerelease=["alpha", 12],
         
     | 
| 
      
 98 
     | 
    
         
            +
            #      meta=["build", 2981]
         
     | 
| 
      
 99 
     | 
    
         
            +
            #    >
         
     | 
| 
      
 100 
     | 
    
         
            +
            ```
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
            They properly display as strings:
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 105 
     | 
    
         
            +
            Semantic::Version.parse('1.0.0').to_s
         
     | 
| 
      
 106 
     | 
    
         
            +
            #=> "1.0.0"
         
     | 
| 
      
 107 
     | 
    
         
            +
            Semantic::Version.parse('1.0.0-alpha.12').to_s
         
     | 
| 
      
 108 
     | 
    
         
            +
            #=> "1.0.0-alpha.12"
         
     | 
| 
      
 109 
     | 
    
         
            +
            Semantic::Version.parse('1.0.0-alpha.12+build.2981').to_s
         
     | 
| 
      
 110 
     | 
    
         
            +
            #=> "1.0.0-alpha.12+build.2981"
         
     | 
| 
      
 111 
     | 
    
         
            +
            ```
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
            They come with useful accessors, mutators, and predicates:
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 116 
     | 
    
         
            +
            version = Semantic::Version.new
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
            version.number.to_s
         
     | 
| 
      
 119 
     | 
    
         
            +
            #=> "0.0.0"
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
            version.bump.number.to_s
         
     | 
| 
      
 122 
     | 
    
         
            +
            #=> "0.0.1"
         
     | 
| 
      
 123 
     | 
    
         
            +
            version.bump(:minor).number.to_s
         
     | 
| 
      
 124 
     | 
    
         
            +
            #=> "0.1.0"
         
     | 
| 
      
 125 
     | 
    
         
            +
            version.bump(:major, by: 2).number.to_s
         
     | 
| 
      
 126 
     | 
    
         
            +
            #=> "2.0.0"
         
     | 
| 
      
 127 
     | 
    
         
            +
            version.bump(:major, to: 20).number.to_s
         
     | 
| 
      
 128 
     | 
    
         
            +
            #=> "20.0.0"
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
            version.bump!
         
     | 
| 
      
 131 
     | 
    
         
            +
            version.number.to_s
         
     | 
| 
      
 132 
     | 
    
         
            +
            #=> "0.0.1"
         
     | 
| 
      
 133 
     | 
    
         
            +
            version.stable?
         
     | 
| 
      
 134 
     | 
    
         
            +
            #=> false
         
     | 
| 
      
 135 
     | 
    
         
            +
            version.bump!(:major, to: 1)
         
     | 
| 
      
 136 
     | 
    
         
            +
            version.stable?
         
     | 
| 
      
 137 
     | 
    
         
            +
            #=> true
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
            version.prerelease.to_s
         
     | 
| 
      
 140 
     | 
    
         
            +
            #=> ""
         
     | 
| 
      
 141 
     | 
    
         
            +
            version.prerelease?
         
     | 
| 
      
 142 
     | 
    
         
            +
            #=> false
         
     | 
| 
      
 143 
     | 
    
         
            +
            version.prerelease = "alpha"
         
     | 
| 
      
 144 
     | 
    
         
            +
            version.prerelease.to_s
         
     | 
| 
      
 145 
     | 
    
         
            +
            #=> "alpha"
         
     | 
| 
      
 146 
     | 
    
         
            +
            version.prerelease?
         
     | 
| 
      
 147 
     | 
    
         
            +
            #=> true
         
     | 
| 
      
 148 
     | 
    
         
            +
            version.prerelease << 12
         
     | 
| 
      
 149 
     | 
    
         
            +
            version.prerelease.to_s
         
     | 
| 
      
 150 
     | 
    
         
            +
            #=> "alpha.12"
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
            version.meta.to_s
         
     | 
| 
      
 153 
     | 
    
         
            +
            #=> ""
         
     | 
| 
      
 154 
     | 
    
         
            +
            version.meta?
         
     | 
| 
      
 155 
     | 
    
         
            +
            #=> false
         
     | 
| 
      
 156 
     | 
    
         
            +
            version.meta = %w[build 2981]
         
     | 
| 
      
 157 
     | 
    
         
            +
            version.meta.to_s
         
     | 
| 
      
 158 
     | 
    
         
            +
            #=> "build.2981"
         
     | 
| 
      
 159 
     | 
    
         
            +
            version.meta?
         
     | 
| 
      
 160 
     | 
    
         
            +
            #=> true
         
     | 
| 
      
 161 
     | 
    
         
            +
            version.meta += %w[sha e796e5da1f40820dcf5dab85487dd9e9a32f27e8]
         
     | 
| 
      
 162 
     | 
    
         
            +
            version.meta.to_s
         
     | 
| 
      
 163 
     | 
    
         
            +
            #=> "build.2981.sha.e796e5da1f40820dcf5dab85487dd9e9a32f27e8"
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
            version.to_s
         
     | 
| 
      
 166 
     | 
    
         
            +
            #=> "1.0.1-alpha.12+build.2981.sha.e796e5da1f40820dcf5dab85487dd9e9a32f27e8"
         
     | 
| 
      
 167 
     | 
    
         
            +
            ```
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
            Most importantly, they are properly comparable per the Semantic Version spec:
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 172 
     | 
    
         
            +
            Semantic::Version.parse('1.0.0+build.1') == Semantic::Version.parse('1.0.0+build.2')
         
     | 
| 
      
 173 
     | 
    
         
            +
            #=> true
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
            %w[
         
     | 
| 
      
 176 
     | 
    
         
            +
              1.0.0-alpha
         
     | 
| 
      
 177 
     | 
    
         
            +
              1.0.0-alpha.1
         
     | 
| 
      
 178 
     | 
    
         
            +
              1.0.0-alpha.beta
         
     | 
| 
      
 179 
     | 
    
         
            +
              1.0.0-beta
         
     | 
| 
      
 180 
     | 
    
         
            +
              1.0.0-beta.2
         
     | 
| 
      
 181 
     | 
    
         
            +
              1.0.0-beta.11
         
     | 
| 
      
 182 
     | 
    
         
            +
              1.0.0-rc.1
         
     | 
| 
      
 183 
     | 
    
         
            +
              1.0.0
         
     | 
| 
      
 184 
     | 
    
         
            +
              2.0.0
         
     | 
| 
      
 185 
     | 
    
         
            +
              2.1.0
         
     | 
| 
      
 186 
     | 
    
         
            +
              2.1.1
         
     | 
| 
      
 187 
     | 
    
         
            +
            ].map do |string|
         
     | 
| 
      
 188 
     | 
    
         
            +
              Semantic::Version.parse string
         
     | 
| 
      
 189 
     | 
    
         
            +
            end.reduce do |smaller, greater|
         
     | 
| 
      
 190 
     | 
    
         
            +
              raise unless smaller < greater
         
     | 
| 
      
 191 
     | 
    
         
            +
              greater
         
     | 
| 
      
 192 
     | 
    
         
            +
            end.to_s
         
     | 
| 
      
 193 
     | 
    
         
            +
            #=> 2.1.1
         
     | 
| 
      
 194 
     | 
    
         
            +
            ```
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
            Finally, you can give any module, class, or object a version with a simple helper:
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 199 
     | 
    
         
            +
            module MyGem
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
              extend Semantic::Version::Helper
         
     | 
| 
      
 202 
     | 
    
         
            +
              version '2.0.0' # or self.version = '2.0.0'
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
            end
         
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
      
 206 
     | 
    
         
            +
            MyGem.version
         
     | 
| 
      
 207 
     | 
    
         
            +
            #=> #<struct MyAPI::Version
         
     | 
| 
      
 208 
     | 
    
         
            +
            #     number=#<struct Semantic::Version::Number major=2, minor=0, patch=0>,
         
     | 
| 
      
 209 
     | 
    
         
            +
            #     prerelease=[],
         
     | 
| 
      
 210 
     | 
    
         
            +
            #     meta=[]
         
     | 
| 
      
 211 
     | 
    
         
            +
            #   >
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
            class MyAPI
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
              include Semantic::Version::Helper
         
     | 
| 
      
 216 
     | 
    
         
            +
              def initialize(version: '0.0.1')
         
     | 
| 
      
 217 
     | 
    
         
            +
                self.version = version
         
     | 
| 
      
 218 
     | 
    
         
            +
              end
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
              include Comparable
         
     | 
| 
      
 221 
     | 
    
         
            +
              def <=> other
         
     | 
| 
      
 222 
     | 
    
         
            +
                version <=> other.version
         
     | 
| 
      
 223 
     | 
    
         
            +
              end
         
     | 
| 
      
 224 
     | 
    
         
            +
             
     | 
| 
      
 225 
     | 
    
         
            +
            end
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
            api1 = MyAPI.new
         
     | 
| 
      
 228 
     | 
    
         
            +
            #=> #<MyAPI:0x007fb1fb9115e0
         
     | 
| 
      
 229 
     | 
    
         
            +
            #    @version= #<struct MyAPI::Version
         
     | 
| 
      
 230 
     | 
    
         
            +
            #      number=#<struct Semantic::Version::Number major=0, minor=0, patch=1>,
         
     | 
| 
      
 231 
     | 
    
         
            +
            #      prerelease=[],
         
     | 
| 
      
 232 
     | 
    
         
            +
            #      meta=[]
         
     | 
| 
      
 233 
     | 
    
         
            +
            #    >
         
     | 
| 
      
 234 
     | 
    
         
            +
            #  >
         
     | 
| 
      
 235 
     | 
    
         
            +
            api1.version.to_s
         
     | 
| 
      
 236 
     | 
    
         
            +
            #=> "0.0.1"
         
     | 
| 
      
 237 
     | 
    
         
            +
            api2 = MyAPI.new(version: '0.0.2')
         
     | 
| 
      
 238 
     | 
    
         
            +
            api1 < api2
         
     | 
| 
      
 239 
     | 
    
         
            +
            #=> true
         
     | 
| 
      
 240 
     | 
    
         
            +
            ```
         
     | 
| 
      
 241 
     | 
    
         
            +
             
     | 
| 
      
 242 
     | 
    
         
            +
            Take care to never use `attr_accessor` in conjunction with `version` when using this helper, or the coercion magic will be ruined.
         
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
            Contributing
         
     | 
| 
      
 246 
     | 
    
         
            +
            ------------
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
      
 248 
     | 
    
         
            +
            1. Fork it ( https://github.com/[my-github-username]/semantic-version/fork )
         
     | 
| 
      
 249 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 250 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 251 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 252 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'bundler/gem_tasks'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            desc 'Open a pry console preloaded with this library'
         
     | 
| 
      
 4 
     | 
    
         
            +
            task console: 'console:pry'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            namespace :console do
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              task :pry do
         
     | 
| 
      
 9 
     | 
    
         
            +
                sh 'bundle exec pry -I lib -r semantic/version.rb'
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              task :irb do
         
     | 
| 
      
 13 
     | 
    
         
            +
                sh 'bundle exec irb -I lib -r semantic/version.rb'
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
    
        data/bin/rake
    ADDED
    
    
| 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'semantic/version/to_string'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Semantic
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Version
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Data < Array
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  include ToString
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize(*args)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    super args.compact.map{ |element| Integer(element) rescue element }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  include Comparable
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def <=> other
         
     | 
| 
      
 16 
     | 
    
         
            +
                    if [self, other].any?(&:empty?)
         
     | 
| 
      
 17 
     | 
    
         
            +
                      other.length <=> length # no data always wins
         
     | 
| 
      
 18 
     | 
    
         
            +
                    else
         
     | 
| 
      
 19 
     | 
    
         
            +
                      myself = to_a
         
     | 
| 
      
 20 
     | 
    
         
            +
                      if myself.length < other.length
         
     | 
| 
      
 21 
     | 
    
         
            +
                        myself << nil until myself.length == other.length
         
     | 
| 
      
 22 
     | 
    
         
            +
                      end
         
     | 
| 
      
 23 
     | 
    
         
            +
                      myself.zip(other).reduce(0) do |result, (mine, theirs)|
         
     | 
| 
      
 24 
     | 
    
         
            +
                        if not result.zero?
         
     | 
| 
      
 25 
     | 
    
         
            +
                          result
         
     | 
| 
      
 26 
     | 
    
         
            +
                        else
         
     | 
| 
      
 27 
     | 
    
         
            +
                          if mine.class == theirs.class
         
     | 
| 
      
 28 
     | 
    
         
            +
                            mine <=> theirs
         
     | 
| 
      
 29 
     | 
    
         
            +
                          elsif String === mine
         
     | 
| 
      
 30 
     | 
    
         
            +
                            return 1
         
     | 
| 
      
 31 
     | 
    
         
            +
                          else
         
     | 
| 
      
 32 
     | 
    
         
            +
                            return -1
         
     | 
| 
      
 33 
     | 
    
         
            +
                          end
         
     | 
| 
      
 34 
     | 
    
         
            +
                        end
         
     | 
| 
      
 35 
     | 
    
         
            +
                      end
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,44 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Semantic
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Version
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Helper
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def version(number=nil, from: nil)
         
     | 
| 
      
 6 
     | 
    
         
            +
                    if number
         
     | 
| 
      
 7 
     | 
    
         
            +
                      self.version = number
         
     | 
| 
      
 8 
     | 
    
         
            +
                    elsif from
         
     | 
| 
      
 9 
     | 
    
         
            +
                      self.version = version_class.read(from)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    else
         
     | 
| 
      
 11 
     | 
    
         
            +
                      @version
         
     | 
| 
      
 12 
     | 
    
         
            +
                    end
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def version= number
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @version ||= case number
         
     | 
| 
      
 17 
     | 
    
         
            +
                    when String
         
     | 
| 
      
 18 
     | 
    
         
            +
                      version_class.parse(number)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    when version_class
         
     | 
| 
      
 20 
     | 
    
         
            +
                      number
         
     | 
| 
      
 21 
     | 
    
         
            +
                    when ::Semantic::Version
         
     | 
| 
      
 22 
     | 
    
         
            +
                      data = number.to_h
         
     | 
| 
      
 23 
     | 
    
         
            +
                      version_class.new data.merge(data.delete(:number).to_h)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    else
         
     | 
| 
      
 25 
     | 
    
         
            +
                      raise "version must be a string or instance of `Semantic::Version`."
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                private
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  def version_namespace
         
     | 
| 
      
 32 
     | 
    
         
            +
                    respond_to?(:const_get) ? self : self.class
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  def version_class
         
     | 
| 
      
 36 
     | 
    
         
            +
                    unless (version_namespace.const_get :Version rescue false)
         
     | 
| 
      
 37 
     | 
    
         
            +
                      version_namespace.const_set :Version, Class.new(::Semantic::Version)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
      
 39 
     | 
    
         
            +
                    version_namespace.const_get :Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'semantic/version/to_string'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Semantic
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Version
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Number < Struct.new(*%i[ major minor patch ])
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  include ToString
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize(*args)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    super *args.map{ |number| Integer number }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  def stable?
         
     | 
| 
      
 14 
     | 
    
         
            +
                    major > 0
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def bump(*args)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    clone.bump!(*args)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  def bump!(level = :patch, by: 1, to: nil)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    tap do |number|
         
     | 
| 
      
 23 
     | 
    
         
            +
                      if to
         
     | 
| 
      
 24 
     | 
    
         
            +
                        number[level.to_sym] = to
         
     | 
| 
      
 25 
     | 
    
         
            +
                      else
         
     | 
| 
      
 26 
     | 
    
         
            +
                        number[level.to_sym] += by
         
     | 
| 
      
 27 
     | 
    
         
            +
                      end
         
     | 
| 
      
 28 
     | 
    
         
            +
                    end
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  include Comparable
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def <=> other
         
     | 
| 
      
 34 
     | 
    
         
            +
                    members.reduce(0) do |result, member|
         
     | 
| 
      
 35 
     | 
    
         
            +
                      if not result.zero?
         
     | 
| 
      
 36 
     | 
    
         
            +
                        result
         
     | 
| 
      
 37 
     | 
    
         
            +
                      else
         
     | 
| 
      
 38 
     | 
    
         
            +
                        self[member] <=> other[member]
         
     | 
| 
      
 39 
     | 
    
         
            +
                      end
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,103 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'forwardable'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Semantic
         
     | 
| 
      
 4 
     | 
    
         
            +
              Version = Struct.new(*%i[ number prerelease meta ])
         
     | 
| 
      
 5 
     | 
    
         
            +
            end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'semantic/version/number'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'semantic/version/data'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            module Semantic
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              class Version < Struct
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  extend Forwardable
         
     | 
| 
      
 17 
     | 
    
         
            +
                  def_delegators :number, :major, :minor, :patch, :stable?
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  def pattern
         
     | 
| 
      
 20 
     | 
    
         
            +
                    /(?<number>\d+\.\d+\.\d+)(\-(?<prerelease>[^+]+))?(\+(?<meta>.+))?/
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def parse(string)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    matches = string.match(pattern)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    (major, minor, patch), prerelease, meta = matches.captures.map{ |list| list.to_s.split('.') }
         
     | 
| 
      
 26 
     | 
    
         
            +
                    new major: major, minor: minor, patch: patch, prerelease: prerelease, meta: meta
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  def read(file_path)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    file_path = Pathname.new(file_path) unless file_path.is_a? Pathname
         
     | 
| 
      
 31 
     | 
    
         
            +
                    string = File.open(file_path) do |file|
         
     | 
| 
      
 32 
     | 
    
         
            +
                      file.read.gsub(/\A[[:space:]]+/, '').gsub(/[[:space:]]+\z/, '').gsub(/[[:space:]]+/, ' ')
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    parse string
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                def initialize(major: 0, minor: 0, patch: 0, prerelease: [], meta: [])
         
     | 
| 
      
 40 
     | 
    
         
            +
                  super Number.new(major, minor, patch), Data.new(*prerelease), Data.new(*meta)
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                def bump(*args)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  clone.bump!(*args)
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                def bump!(*args)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  tap do |version|
         
     | 
| 
      
 49 
     | 
    
         
            +
                    version.number.bump!(*args)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                def prerelease?
         
     | 
| 
      
 54 
     | 
    
         
            +
                  not prerelease.to_a.compact.empty?
         
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                def prerelease= *array
         
     | 
| 
      
 58 
     | 
    
         
            +
                  self[:prerelease] = Data.new(*array)
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                def meta?
         
     | 
| 
      
 62 
     | 
    
         
            +
                  not meta.to_a.compact.empty?
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                def meta= *array
         
     | 
| 
      
 66 
     | 
    
         
            +
                  self[:meta] = Data.new(*array)
         
     | 
| 
      
 67 
     | 
    
         
            +
                end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 70 
     | 
    
         
            +
                  number.to_s.tap do |version|
         
     | 
| 
      
 71 
     | 
    
         
            +
                    version.concat '-' + prerelease if prerelease?
         
     | 
| 
      
 72 
     | 
    
         
            +
                    version.concat '+' + meta       if meta?
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                def to_str
         
     | 
| 
      
 77 
     | 
    
         
            +
                  to_s
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                def clone
         
     | 
| 
      
 81 
     | 
    
         
            +
                  self.class.new number.to_h.clone.merge(prerelease: prerelease.clone, meta: meta.clone)
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                include Comparable
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                def <=> other
         
     | 
| 
      
 88 
     | 
    
         
            +
                  %i[number prerelease].reduce(0) do |result, member|
         
     | 
| 
      
 89 
     | 
    
         
            +
                    if not result.zero?
         
     | 
| 
      
 90 
     | 
    
         
            +
                      result
         
     | 
| 
      
 91 
     | 
    
         
            +
                    else
         
     | 
| 
      
 92 
     | 
    
         
            +
                      self[member] <=> other[member]
         
     | 
| 
      
 93 
     | 
    
         
            +
                    end
         
     | 
| 
      
 94 
     | 
    
         
            +
                  end
         
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
              end
         
     | 
| 
      
 98 
     | 
    
         
            +
            end
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            require 'semantic/version/helper'
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
            Semantic::Version.extend Semantic::Version::Helper
         
     | 
| 
      
 103 
     | 
    
         
            +
            Semantic::Version.version from: Dir['*.version'].first
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'semantic/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = 'semantic-version'
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = Semantic::Version.version
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ['Chris Keele']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ['dev@chriskeele.com']
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary       = 'Semantic version objects for Ruby.'
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description   = <<-DESC
         
     | 
| 
      
 13 
     | 
    
         
            +
                A utility library that provides a `Semantic::Version` value object.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                You can parse strings into version objects or construct them by hand. Any module, class, or object can be given a version through a helper. All version objects properly handle instantiation, duplication, cloning, accessors, mutators, stringification, and comparison; and come with helpful predicate methods.
         
     | 
| 
      
 16 
     | 
    
         
            +
              DESC
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.homepage      = 'http://semver.org/'
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.license       = 'MIT'
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
      
 21 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_dependency 'highline', '~> 1.6.0'
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_dependency 'rake',     '~> 10.0'
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 1.7'
         
     | 
| 
      
 29 
     | 
    
         
            +
              spec.add_development_dependency 'pry'
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            2.0.0-alpha.1
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,117 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: semantic-version
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.0.pre.alpha.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Chris Keele
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-02-17 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: highline
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 1.6.0
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 1.6.0
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: pry
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            description: |2
         
     | 
| 
      
 70 
     | 
    
         
            +
                  A utility library that provides a `Semantic::Version` value object.
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                  You can parse strings into version objects or construct them by hand. Any module, class, or object can be given a version through a helper. All version objects properly handle instantiation, duplication, cloning, accessors, mutators, stringification, and comparison; and come with helpful predicate methods.
         
     | 
| 
      
 73 
     | 
    
         
            +
            email:
         
     | 
| 
      
 74 
     | 
    
         
            +
            - dev@chriskeele.com
         
     | 
| 
      
 75 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 76 
     | 
    
         
            +
            - rake
         
     | 
| 
      
 77 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 78 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 79 
     | 
    
         
            +
            files:
         
     | 
| 
      
 80 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 81 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 82 
     | 
    
         
            +
            - LICENSE.md
         
     | 
| 
      
 83 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 84 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 85 
     | 
    
         
            +
            - bin/rake
         
     | 
| 
      
 86 
     | 
    
         
            +
            - lib/semantic/version.rb
         
     | 
| 
      
 87 
     | 
    
         
            +
            - lib/semantic/version/data.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - lib/semantic/version/helper.rb
         
     | 
| 
      
 89 
     | 
    
         
            +
            - lib/semantic/version/number.rb
         
     | 
| 
      
 90 
     | 
    
         
            +
            - lib/semantic/version/to_string.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - semantic-version.gemspec
         
     | 
| 
      
 92 
     | 
    
         
            +
            - semantic-version.version
         
     | 
| 
      
 93 
     | 
    
         
            +
            homepage: http://semver.org/
         
     | 
| 
      
 94 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 95 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 96 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 97 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 98 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 99 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 100 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 101 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 102 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 103 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 104 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 105 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 106 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
              - - ">"
         
     | 
| 
      
 109 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
      
 111 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 112 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 113 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
      
 114 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 115 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 116 
     | 
    
         
            +
            summary: Semantic version objects for Ruby.
         
     | 
| 
      
 117 
     | 
    
         
            +
            test_files: []
         
     |