versions.rb 0.1.1 → 1.0
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/.gitignore +26 -0
 - data/.travis.yml +18 -0
 - data/Gemfile +2 -0
 - data/README.md +63 -0
 - data/lib/versionable.rb +51 -0
 - data/lib/versions.rb +13 -10
 - data/lib/versions/class_helpers.rb +34 -0
 - data/lib/versions/configurable.rb +32 -0
 - data/lib/versions/errors/version_not_available.rb +4 -0
 - data/lib/versions/file_helpers.rb +31 -0
 - data/lib/versions/string_helpers.rb +26 -0
 - data/spec/fixtures/v1/sample_library.rb +7 -0
 - data/spec/fixtures/v2.1/sample_library.rb +14 -0
 - data/spec/fixtures/v3.2.1/sample_library.rb +7 -0
 - data/spec/lib/versionable_spec.rb +45 -0
 - data/spec/lib/versions_spec.rb +57 -0
 - data/spec/spec_helper.rb +20 -0
 - data/versions.rb.gemspec +25 -0
 - metadata +83 -18
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3fac1013f437cd729493033b888daa6876e4240e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7565ddf6130285ba36e2d527e604a213907afcee
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: cb9fe45414b32700606c4eae1e6a2881722a7cf54d7b276ec516a75a71db93cbdc3a9c57681d121547428a8201a27278b4ee2e5bd0f15a32188845b4a2cb3ffb
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7836b77b3f8281022134c507d544ce08adfc31142a34f74ef14f6c531b6c5e992eaf197647169482297a91b91758073efd987350ca9df043dcfccfe80207d6f4
         
     | 
    
        data/.gitignore
    ADDED
    
    | 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            *.gem
         
     | 
| 
      
 2 
     | 
    
         
            +
            *.rbc
         
     | 
| 
      
 3 
     | 
    
         
            +
            /.config
         
     | 
| 
      
 4 
     | 
    
         
            +
            /coverage/
         
     | 
| 
      
 5 
     | 
    
         
            +
            /InstalledFiles
         
     | 
| 
      
 6 
     | 
    
         
            +
            /pkg/
         
     | 
| 
      
 7 
     | 
    
         
            +
            /spec/reports/
         
     | 
| 
      
 8 
     | 
    
         
            +
            /test/tmp/
         
     | 
| 
      
 9 
     | 
    
         
            +
            /test/version_tmp/
         
     | 
| 
      
 10 
     | 
    
         
            +
            /tmp/
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ## Documentation cache and generated files:
         
     | 
| 
      
 13 
     | 
    
         
            +
            /.yardoc/
         
     | 
| 
      
 14 
     | 
    
         
            +
            /_yardoc/
         
     | 
| 
      
 15 
     | 
    
         
            +
            /doc/
         
     | 
| 
      
 16 
     | 
    
         
            +
            /rdoc/
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ## Environment normalisation:
         
     | 
| 
      
 19 
     | 
    
         
            +
            /.bundle/
         
     | 
| 
      
 20 
     | 
    
         
            +
            /lib/bundler/man/
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            Gemfile.lock
         
     | 
| 
      
 23 
     | 
    
         
            +
            .ruby-version
         
     | 
| 
      
 24 
     | 
    
         
            +
            .ruby-gemset
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            .rvmrc
         
     | 
    
        data/.travis.yml
    ADDED
    
    | 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            language: ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            rvm:
         
     | 
| 
      
 3 
     | 
    
         
            +
              - 2.1.1
         
     | 
| 
      
 4 
     | 
    
         
            +
              - 2.0.0
         
     | 
| 
      
 5 
     | 
    
         
            +
              - 1.9.3
         
     | 
| 
      
 6 
     | 
    
         
            +
              - 1.9.2
         
     | 
| 
      
 7 
     | 
    
         
            +
              - jruby-19mode
         
     | 
| 
      
 8 
     | 
    
         
            +
              - ruby-head
         
     | 
| 
      
 9 
     | 
    
         
            +
              - jruby-head
         
     | 
| 
      
 10 
     | 
    
         
            +
            jdk:
         
     | 
| 
      
 11 
     | 
    
         
            +
              - openjdk7
         
     | 
| 
      
 12 
     | 
    
         
            +
              - oraclejdk7
         
     | 
| 
      
 13 
     | 
    
         
            +
              - openjdk6
         
     | 
| 
      
 14 
     | 
    
         
            +
            script: rspec
         
     | 
| 
      
 15 
     | 
    
         
            +
            matrix:
         
     | 
| 
      
 16 
     | 
    
         
            +
              allow_failures:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - rvm: ruby-head
         
     | 
| 
      
 18 
     | 
    
         
            +
                - rvm: jruby-head
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,63 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Versions.rb
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            _"Ruby class versioning made simple."_
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://rubygems.org/gems/versions.rb) [](https://travis-ci.org/doomspork/versions.rb) [](https://codeclimate.com/github/doomspork/versions.rb) [](https://coveralls.io/r/doomspork/versions.rb)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Ruby 1.9, 2.0, 2.1, and JRuby supported.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## Quickstart
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Install it:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            `gem install versions.rb`
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Create a version (`lib/v1.0/awesome_feature.rb`):
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 18 
     | 
    
         
            +
            module V1_0
         
     | 
| 
      
 19 
     | 
    
         
            +
              class AwesomeFeature
         
     | 
| 
      
 20 
     | 
    
         
            +
                def foo
         
     | 
| 
      
 21 
     | 
    
         
            +
                  :bar
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
      
 25 
     | 
    
         
            +
            ```
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            Use it:
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 30 
     | 
    
         
            +
            VersionedFeature = Versions.for(:awesome_feature).select('1.0')
         
     | 
| 
      
 31 
     | 
    
         
            +
            feature          = VersionedFeature.new
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            ## Configuration
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            #### File locations
         
     | 
| 
      
 37 
     | 
    
         
            +
            By default Versions.rb will try to use a `lib/` directory within the project root, you can override this:
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 40 
     | 
    
         
            +
            Versions.config.base_dir = 'dir_path_of_your_choosing'
         
     | 
| 
      
 41 
     | 
    
         
            +
            ```
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            Alternatively you can override the `base_dir` for a single call as such:
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 46 
     | 
    
         
            +
            Versions.for(:awesome_feature).at('./other/location').select('1.0')
         
     | 
| 
      
 47 
     | 
    
         
            +
            ```
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            Please make appropriate use of [Issues][issues] and [Pull Requests][pr]. All code should have accompanying tests.
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            ## Author/Contact
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            Versions.rb is written and maintained by [@doomspork](https://github.com/doomspork)
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            Versions.rb is made available under the [MIT][mit] license.
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            [issues]: https://github.com/doomspork/versions.rb/issues
         
     | 
| 
      
 62 
     | 
    
         
            +
            [pr]: https://github.com/doomspork/versions.rb/pulls
         
     | 
| 
      
 63 
     | 
    
         
            +
            [mit]: LICENSE
         
     | 
    
        data/lib/versionable.rb
    ADDED
    
    | 
         @@ -0,0 +1,51 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Versionable
         
     | 
| 
      
 2 
     | 
    
         
            +
              extend Forwardable
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              DEFAULT_PATH = File.join(File.dirname(__FILE__), '')
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              def_delegators :@versions, :versions, :available?, :select
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              def self.included(base)
         
     | 
| 
      
 9 
     | 
    
         
            +
                base.extend(ClassMethods)
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              module ClassMethods
         
     | 
| 
      
 13 
     | 
    
         
            +
                def instance_of!(version, *args)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  version         = version.to_sym
         
     | 
| 
      
 15 
     | 
    
         
            +
                  versioned_class = loaded_versions[version]
         
     | 
| 
      
 16 
     | 
    
         
            +
                  instance        = versioned_class.new(*args)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  instance.instance_variable_set(:@instance_version, version)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  instance
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                def instance_of(version, *args)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 23 
     | 
    
         
            +
                    instance_of!(version, args)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  rescue Versions::VersionNotAvailableError
         
     | 
| 
      
 25 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def versions_path(path)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  @versions_path = path
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                private
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                def versions_directory
         
     | 
| 
      
 36 
     | 
    
         
            +
                  @versions_path || DEFAULT_PATH
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                def loaded_versions
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @loaded_versions ||= Hash.new { |hash, key| hash[key] = versions_rb.select(key) }
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
               
         
     | 
| 
      
 43 
     | 
    
         
            +
                def versions_rb
         
     | 
| 
      
 44 
     | 
    
         
            +
                  @versions_rb ||= Versions.for(self.name).at(versions_directory)
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              def version
         
     | 
| 
      
 49 
     | 
    
         
            +
                @instances_version
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/versions.rb
    CHANGED
    
    | 
         @@ -1,27 +1,29 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require ' 
     | 
| 
      
 1 
     | 
    
         
            +
            require 'versionable.rb'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'versions/configurable.rb'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'versions/file_helpers.rb'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'versions/class_helpers.rb'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'versions/string_helpers.rb'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'versions/errors/version_not_available.rb'
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
       6 
8 
     | 
    
         
             
            class Versions
         
     | 
| 
       7 
     | 
    
         
            -
              extend Versionable
         
     | 
| 
       8 
9 
     | 
    
         
             
              extend Configurable
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
              include FileHelpers
         
     | 
| 
       11 
12 
     | 
    
         
             
              include ClassHelpers
         
     | 
| 
      
 13 
     | 
    
         
            +
              include StringHelpers
         
     | 
| 
       12 
14 
     | 
    
         | 
| 
       13 
15 
     | 
    
         
             
              # Public: Sets up and returns a new instance
         
     | 
| 
       14 
16 
     | 
    
         
             
              #
         
     | 
| 
       15 
17 
     | 
    
         
             
              # mod - Symbol or String of the library name
         
     | 
| 
       16 
18 
     | 
    
         
             
              #
         
     | 
| 
       17 
19 
     | 
    
         
             
              # Returns an instance of Versions
         
     | 
| 
       18 
     | 
    
         
            -
              def self.for( 
     | 
| 
       19 
     | 
    
         
            -
                new( 
     | 
| 
      
 20 
     | 
    
         
            +
              def self.for(library)
         
     | 
| 
      
 21 
     | 
    
         
            +
                new(library)
         
     | 
| 
       20 
22 
     | 
    
         
             
              end
         
     | 
| 
       21 
23 
     | 
    
         | 
| 
       22 
24 
     | 
    
         
             
              # Public: Sets the base directory for this instance
         
     | 
| 
       23 
25 
     | 
    
         
             
              #
         
     | 
| 
       24 
     | 
    
         
            -
              # path - path to the directory 
     | 
| 
      
 26 
     | 
    
         
            +
              # path - path to the directory
         
     | 
| 
       25 
27 
     | 
    
         
             
              #
         
     | 
| 
       26 
28 
     | 
    
         
             
              # Returns self
         
     | 
| 
       27 
29 
     | 
    
         
             
              def at(path)
         
     | 
| 
         @@ -36,6 +38,7 @@ class Versions 
     | 
|
| 
       36 
38 
     | 
    
         
             
              # Returns the versioned Class
         
     | 
| 
       37 
39 
     | 
    
         
             
              # Raises VersionNotAvailableError
         
     | 
| 
       38 
40 
     | 
    
         
             
              def select(version)
         
     | 
| 
      
 41 
     | 
    
         
            +
                version = version.to_sym
         
     | 
| 
       39 
42 
     | 
    
         
             
                if file = mapped_versions[version]
         
     | 
| 
       40 
43 
     | 
    
         
             
                  load_class(version, file)
         
     | 
| 
       41 
44 
     | 
    
         
             
                else
         
     | 
| 
         @@ -49,7 +52,7 @@ class Versions 
     | 
|
| 
       49 
52 
     | 
    
         
             
              #
         
     | 
| 
       50 
53 
     | 
    
         
             
              # Returns a Boolean
         
     | 
| 
       51 
54 
     | 
    
         
             
              def available?(version)
         
     | 
| 
       52 
     | 
    
         
            -
                !!mapped_versions[version]
         
     | 
| 
      
 55 
     | 
    
         
            +
                !!mapped_versions[version.to_sym]
         
     | 
| 
       53 
56 
     | 
    
         
             
              end
         
     | 
| 
       54 
57 
     | 
    
         | 
| 
       55 
58 
     | 
    
         
             
              # Public: Get the available versions
         
     | 
| 
         @@ -63,15 +66,15 @@ class Versions 
     | 
|
| 
       63 
66 
     | 
    
         | 
| 
       64 
67 
     | 
    
         
             
              # Internal: Create a new instance
         
     | 
| 
       65 
68 
     | 
    
         
             
              #
         
     | 
| 
       66 
     | 
    
         
            -
              #  
     | 
| 
      
 69 
     | 
    
         
            +
              # library - Symbol or String of the library name
         
     | 
| 
       67 
70 
     | 
    
         
             
              #
         
     | 
| 
       68 
71 
     | 
    
         
             
              # Returns a new instance
         
     | 
| 
       69 
     | 
    
         
            -
              def initialize( 
     | 
| 
       70 
     | 
    
         
            -
                @library_name =  
     | 
| 
      
 72 
     | 
    
         
            +
              def initialize(library)
         
     | 
| 
      
 73 
     | 
    
         
            +
                @library_name = snake_case(library.to_s)
         
     | 
| 
       71 
74 
     | 
    
         
             
              end
         
     | 
| 
       72 
75 
     | 
    
         | 
| 
       73 
76 
     | 
    
         
             
              # Internal: An internal map of versions and their respective files,
         
     | 
| 
       74 
     | 
    
         
            -
              # the Hash keys are version strings and files as value. 
     | 
| 
      
 77 
     | 
    
         
            +
              # the Hash keys are version strings and files as value.
         
     | 
| 
       75 
78 
     | 
    
         
             
              #
         
     | 
| 
       76 
79 
     | 
    
         
             
              # Returns a Hash
         
     | 
| 
       77 
80 
     | 
    
         
             
              def mapped_versions
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Versions
         
     | 
| 
      
 2 
     | 
    
         
            +
              module ClassHelpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                protected
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                # Internal: The ClassName of the Library
         
     | 
| 
      
 6 
     | 
    
         
            +
                #
         
     | 
| 
      
 7 
     | 
    
         
            +
                # Returns a String
         
     | 
| 
      
 8 
     | 
    
         
            +
                def library_name
         
     | 
| 
      
 9 
     | 
    
         
            +
                  camel_case(@library_name)
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                # Internal: Get the fully qualified class name with version
         
     | 
| 
      
 13 
     | 
    
         
            +
                #
         
     | 
| 
      
 14 
     | 
    
         
            +
                # version - the version selected
         
     | 
| 
      
 15 
     | 
    
         
            +
                #
         
     | 
| 
      
 16 
     | 
    
         
            +
                # Returns a String
         
     | 
| 
      
 17 
     | 
    
         
            +
                def versioned_class_name(version)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  safe_version = version.to_s.gsub(/\./, '_')
         
     | 
| 
      
 19 
     | 
    
         
            +
                  "#{Versions.config.class_prefix}#{safe_version}::#{library_name}"
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                # Internal: Load and return the Class
         
     | 
| 
      
 23 
     | 
    
         
            +
                #
         
     | 
| 
      
 24 
     | 
    
         
            +
                # version - the selected version
         
     | 
| 
      
 25 
     | 
    
         
            +
                # file    - the file path
         
     | 
| 
      
 26 
     | 
    
         
            +
                #
         
     | 
| 
      
 27 
     | 
    
         
            +
                # Returns a Class
         
     | 
| 
      
 28 
     | 
    
         
            +
                def load_class(version, file)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  require file
         
     | 
| 
      
 30 
     | 
    
         
            +
                  name = versioned_class_name(version)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  name.split('::').inject(Object) { |obj, klz| obj.const_get(klz) }
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Versions
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Configurable
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                # A simple configuration wrapper
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Config
         
     | 
| 
      
 6 
     | 
    
         
            +
                  attr_accessor :base_dir, :version_pattern, :class_prefix
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  # The default base directory path
         
     | 
| 
      
 9 
     | 
    
         
            +
                  BASE_DIR         = File.join(Dir.pwd, 'lib')
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # The default filename pattern
         
     | 
| 
      
 11 
     | 
    
         
            +
                  VERSION_PATTERN  = /v(?:ersion)?[-_]?((\d+(?:\.\d+)*))/i
         
     | 
| 
      
 12 
     | 
    
         
            +
                  # The default class prefix
         
     | 
| 
      
 13 
     | 
    
         
            +
                  CLASS_PREFIX     = 'V'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  # Public: Create a new instance with default values
         
     | 
| 
      
 16 
     | 
    
         
            +
                  #
         
     | 
| 
      
 17 
     | 
    
         
            +
                  # Returns a new instance
         
     | 
| 
      
 18 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 19 
     | 
    
         
            +
                    self.base_dir         = BASE_DIR
         
     | 
| 
      
 20 
     | 
    
         
            +
                    self.version_pattern  = VERSION_PATTERN
         
     | 
| 
      
 21 
     | 
    
         
            +
                    self.class_prefix     = CLASS_PREFIX
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                # Public: Versions.rb configuration instance
         
     | 
| 
      
 26 
     | 
    
         
            +
                #
         
     | 
| 
      
 27 
     | 
    
         
            +
                # Returns an instance of Config
         
     | 
| 
      
 28 
     | 
    
         
            +
                def config
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @config ||= Config.new
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Versions
         
     | 
| 
      
 2 
     | 
    
         
            +
              module FileHelpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                protected
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                # Internal: Parse a file path into a version string
         
     | 
| 
      
 6 
     | 
    
         
            +
                #
         
     | 
| 
      
 7 
     | 
    
         
            +
                # path - the file path to parse
         
     | 
| 
      
 8 
     | 
    
         
            +
                #
         
     | 
| 
      
 9 
     | 
    
         
            +
                # Returns a version String or nil
         
     | 
| 
      
 10 
     | 
    
         
            +
                def parse_filepath(path)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  (match = Versions.config.version_pattern.match(path)) ? match[1] : nil
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                # Internal: Create a map of versions and files
         
     | 
| 
      
 15 
     | 
    
         
            +
                #
         
     | 
| 
      
 16 
     | 
    
         
            +
                # Returns a Hash
         
     | 
| 
      
 17 
     | 
    
         
            +
                def map_file_versions
         
     | 
| 
      
 18 
     | 
    
         
            +
                  file_path = File.join(path, '**', "#{@library_name}.rb")
         
     | 
| 
      
 19 
     | 
    
         
            +
                  files = Dir[file_path] || {}
         
     | 
| 
      
 20 
     | 
    
         
            +
                  files.inject({}) do |memo, path|
         
     | 
| 
      
 21 
     | 
    
         
            +
                    version_key = parse_filepath(path)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    memo[version_key.to_sym] = path if version_key
         
     | 
| 
      
 23 
     | 
    
         
            +
                    memo
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def path
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @path ||= Versions.config.base_dir
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Versions
         
     | 
| 
      
 2 
     | 
    
         
            +
              module StringHelpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                # Internal: Make a String CamelCase
         
     | 
| 
      
 4 
     | 
    
         
            +
                #
         
     | 
| 
      
 5 
     | 
    
         
            +
                # str- to make CamelCase String
         
     | 
| 
      
 6 
     | 
    
         
            +
                #
         
     | 
| 
      
 7 
     | 
    
         
            +
                # Returns a String
         
     | 
| 
      
 8 
     | 
    
         
            +
                def camel_case(str)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  str.to_s.split(/[ _]/).map(&:capitalize).join('')
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                # Internal: Make a String snake_case 
         
     | 
| 
      
 13 
     | 
    
         
            +
                # Implementation borrowed from ActiveSupport
         
     | 
| 
      
 14 
     | 
    
         
            +
                #
         
     | 
| 
      
 15 
     | 
    
         
            +
                # str - to make snake_case String
         
     | 
| 
      
 16 
     | 
    
         
            +
                #
         
     | 
| 
      
 17 
     | 
    
         
            +
                # Returns a String
         
     | 
| 
      
 18 
     | 
    
         
            +
                def snake_case(str)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  str.gsub(/::/, '/').
         
     | 
| 
      
 20 
     | 
    
         
            +
                    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
         
     | 
| 
      
 21 
     | 
    
         
            +
                    gsub(/([a-z\d])([A-Z])/,'\1_\2').
         
     | 
| 
      
 22 
     | 
    
         
            +
                    tr("-", "_").
         
     | 
| 
      
 23 
     | 
    
         
            +
                    downcase
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class SampleLibrary
         
     | 
| 
      
 4 
     | 
    
         
            +
              include Versionable
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              versions_path File.join(File.dirname(__FILE__), '..', 'fixtures')
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            describe Versionable do
         
     | 
| 
      
 10 
     | 
    
         
            +
              subject { SampleLibrary }
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              describe '.instance_of!' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                context 'with available version' do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  it 'will return the class' do
         
     | 
| 
      
 15 
     | 
    
         
            +
                    vers = subject.instance_of!('2.1')
         
     | 
| 
      
 16 
     | 
    
         
            +
                    expect(vers.version).to eql '2.1'
         
     | 
| 
      
 17 
     | 
    
         
            +
                    expect(vers).to instance_of V2_1::SampleLibrary
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  context 'with additional paramaters' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                    it 'will pass them to the constructor' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                      vers = subject.instance_of!('2.1', 0, 0)
         
     | 
| 
      
 23 
     | 
    
         
            +
                      expect(vers.one).to eql 0
         
     | 
| 
      
 24 
     | 
    
         
            +
                      expect(vers.two).to eql 0
         
     | 
| 
      
 25 
     | 
    
         
            +
                    end
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                context 'with missing version' do
         
     | 
| 
      
 30 
     | 
    
         
            +
                  it 'will be raise an error' do
         
     | 
| 
      
 31 
     | 
    
         
            +
                    expect { subject.instance_of!('4.2.0') }.to raise_error Versions::VersionNotAvailableError
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              describe '.instance_of' do
         
     | 
| 
      
 37 
     | 
    
         
            +
                context 'with missing version' do
         
     | 
| 
      
 38 
     | 
    
         
            +
                  it 'will return nil' do
         
     | 
| 
      
 39 
     | 
    
         
            +
                    vers = subject.instance_of('4.2.0')
         
     | 
| 
      
 40 
     | 
    
         
            +
                    expect(vers).to be_nil
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,57 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Versions do
         
     | 
| 
      
 4 
     | 
    
         
            +
              subject { Versions.for(:sample_library) }
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              let(:fixture_path) { File.join(File.dirname(__FILE__), '..', 'fixtures') }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              before { Versions.config.base_dir = fixture_path }
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              describe '#available?' do
         
     | 
| 
      
 11 
     | 
    
         
            +
                context 'with existing version' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                  it 'will be true' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                    avail = subject.available? '1'
         
     | 
| 
      
 14 
     | 
    
         
            +
                    expect(avail).to be_truthy
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                context 'with missing version' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  it 'will be false' do
         
     | 
| 
      
 20 
     | 
    
         
            +
                    avail = subject.available? '4.2.0'
         
     | 
| 
      
 21 
     | 
    
         
            +
                    expect(avail).to be_falsey
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              describe '#versions' do
         
     | 
| 
      
 27 
     | 
    
         
            +
                it 'returns an Array of available versions' do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  vers = subject.versions
         
     | 
| 
      
 29 
     | 
    
         
            +
                  expect(vers.size).to eql 3
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              describe '#at' do
         
     | 
| 
      
 34 
     | 
    
         
            +
                before { Versions.config.base_dir = nil }
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                it 'will override the base dir for this instance' do
         
     | 
| 
      
 37 
     | 
    
         
            +
                  vers = subject.at(fixture_path).versions
         
     | 
| 
      
 38 
     | 
    
         
            +
                  expect(vers.size).to eql 3
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              describe '#select' do
         
     | 
| 
      
 43 
     | 
    
         
            +
                context 'with available version' do
         
     | 
| 
      
 44 
     | 
    
         
            +
                  it 'will return the class' do
         
     | 
| 
      
 45 
     | 
    
         
            +
                    vers = subject.select('2.1')
         
     | 
| 
      
 46 
     | 
    
         
            +
                    expect(vers).to eql V2_1::SampleLibrary
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                context 'with missing version' do
         
     | 
| 
      
 51 
     | 
    
         
            +
                  it 'will be raise an error' do
         
     | 
| 
      
 52 
     | 
    
         
            +
                    expect { subject.select('4.2.0') }.to raise_error
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'simplecov'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'pry'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ENV['RACK_ENV'] = 'test'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            SimpleCov.formatter = Coveralls::SimpleCov::Formatter if defined?(Coveralls)
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            # Configure code coverage reporting
         
     | 
| 
      
 9 
     | 
    
         
            +
            SimpleCov.start do
         
     | 
| 
      
 10 
     | 
    
         
            +
              add_filter '/spec/'
         
     | 
| 
      
 11 
     | 
    
         
            +
              coverage_dir 'docs/coverage'
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            require 'versions'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            Dir['./spec/support/**/*.rb'].each { |f| require f }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 19 
     | 
    
         
            +
              config.mock_framework = :rr
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
    
        data/versions.rb.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 2 
     | 
    
         
            +
              s.name        = 'versions.rb'
         
     | 
| 
      
 3 
     | 
    
         
            +
              s.version     = '1.0' 
         
     | 
| 
      
 4 
     | 
    
         
            +
              s.summary     = 'Support for versioned class definitions.'
         
     | 
| 
      
 5 
     | 
    
         
            +
              s.description = 'Using simple namespacing Versions.rb lets you load versions of your code on-demand.'
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.authors     = ['Sean Callan']
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.email       = 'seancallan@gmail.com'
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.homepage    = 'https://github.com/doomspork/versions.rb'
         
     | 
| 
      
 9 
     | 
    
         
            +
              s.license     = 'MIT'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              s.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.executables   = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 13 
     | 
    
         
            +
              s.test_files    = s.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 14 
     | 
    
         
            +
              s.require_paths = ['lib']
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              s.required_ruby_version = '> 1.9'
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              s.add_development_dependency 'bundler',     '~> 1.7'
         
     | 
| 
      
 19 
     | 
    
         
            +
              s.add_development_dependency 'coveralls',   '~> 0.7' unless RUBY_PLATFORM =~ /java/
         
     | 
| 
      
 20 
     | 
    
         
            +
              s.add_development_dependency 'pry',         '~> 0.10'
         
     | 
| 
      
 21 
     | 
    
         
            +
              s.add_development_dependency 'rake',        '~> 10.0'
         
     | 
| 
      
 22 
     | 
    
         
            +
              s.add_development_dependency 'rr',          '~> 1.1.2'
         
     | 
| 
      
 23 
     | 
    
         
            +
              s.add_development_dependency 'rspec',       '~> 3.1'
         
     | 
| 
      
 24 
     | 
    
         
            +
              s.add_development_dependency 'simplecov',   '~> 0.9'
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,29 +1,71 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: versions.rb
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: '1.0'
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
     | 
    
         
            -
            -  
     | 
| 
      
 7 
     | 
    
         
            +
            - Sean Callan
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-04-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: coveralls
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0.7'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0.7'
         
     | 
| 
       13 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
42 
     | 
    
         
             
              name: pry
         
     | 
| 
       15 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
45 
     | 
    
         
             
                - - ~>
         
     | 
| 
       18 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
       20 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       21 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
66 
     | 
    
         
             
                - - ~>
         
     | 
| 
       25 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version: 0 
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
       27 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
70 
     | 
    
         
             
              name: rr
         
     | 
| 
       29 
71 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -44,37 +86,54 @@ dependencies: 
     | 
|
| 
       44 
86 
     | 
    
         
             
                requirements:
         
     | 
| 
       45 
87 
     | 
    
         
             
                - - ~>
         
     | 
| 
       46 
88 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version:  
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '3.1'
         
     | 
| 
       48 
90 
     | 
    
         
             
              type: :development
         
     | 
| 
       49 
91 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
92 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
93 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
94 
     | 
    
         
             
                - - ~>
         
     | 
| 
       53 
95 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version:  
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '3.1'
         
     | 
| 
       55 
97 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
98 
     | 
    
         
             
              name: simplecov
         
     | 
| 
       57 
99 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       58 
100 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
101 
     | 
    
         
             
                - - ~>
         
     | 
| 
       60 
102 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 103 
     | 
    
         
            +
                    version: '0.9'
         
     | 
| 
       62 
104 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
105 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
106 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
107 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
108 
     | 
    
         
             
                - - ~>
         
     | 
| 
       67 
109 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version: 0. 
     | 
| 
       69 
     | 
    
         
            -
            description: Versions.rb  
     | 
| 
       70 
     | 
    
         
            -
               
     | 
| 
       71 
     | 
    
         
            -
            email:  
     | 
| 
      
 110 
     | 
    
         
            +
                    version: '0.9'
         
     | 
| 
      
 111 
     | 
    
         
            +
            description: Using simple namespacing Versions.rb lets you load versions of your code
         
     | 
| 
      
 112 
     | 
    
         
            +
              on-demand.
         
     | 
| 
      
 113 
     | 
    
         
            +
            email: seancallan@gmail.com
         
     | 
| 
       72 
114 
     | 
    
         
             
            executables: []
         
     | 
| 
       73 
115 
     | 
    
         
             
            extensions: []
         
     | 
| 
       74 
116 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       75 
117 
     | 
    
         
             
            files:
         
     | 
| 
       76 
     | 
    
         
            -
            -  
     | 
| 
      
 118 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 119 
     | 
    
         
            +
            - .travis.yml
         
     | 
| 
      
 120 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
       77 
121 
     | 
    
         
             
            - LICENSE
         
     | 
| 
      
 122 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 123 
     | 
    
         
            +
            - lib/versionable.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - lib/versions.rb
         
     | 
| 
      
 125 
     | 
    
         
            +
            - lib/versions/class_helpers.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - lib/versions/configurable.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            - lib/versions/errors/version_not_available.rb
         
     | 
| 
      
 128 
     | 
    
         
            +
            - lib/versions/file_helpers.rb
         
     | 
| 
      
 129 
     | 
    
         
            +
            - lib/versions/string_helpers.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - spec/fixtures/v1/sample_library.rb
         
     | 
| 
      
 131 
     | 
    
         
            +
            - spec/fixtures/v2.1/sample_library.rb
         
     | 
| 
      
 132 
     | 
    
         
            +
            - spec/fixtures/v3.2.1/sample_library.rb
         
     | 
| 
      
 133 
     | 
    
         
            +
            - spec/lib/versionable_spec.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            - spec/lib/versions_spec.rb
         
     | 
| 
      
 135 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 136 
     | 
    
         
            +
            - versions.rb.gemspec
         
     | 
| 
       78 
137 
     | 
    
         
             
            homepage: https://github.com/doomspork/versions.rb
         
     | 
| 
       79 
138 
     | 
    
         
             
            licenses:
         
     | 
| 
       80 
139 
     | 
    
         
             
            - MIT
         
     | 
| 
         @@ -85,9 +144,9 @@ require_paths: 
     | 
|
| 
       85 
144 
     | 
    
         
             
            - lib
         
     | 
| 
       86 
145 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       87 
146 
     | 
    
         
             
              requirements:
         
     | 
| 
       88 
     | 
    
         
            -
              - - ' 
     | 
| 
      
 147 
     | 
    
         
            +
              - - '>'
         
     | 
| 
       89 
148 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       90 
     | 
    
         
            -
                  version: 1. 
     | 
| 
      
 149 
     | 
    
         
            +
                  version: '1.9'
         
     | 
| 
       91 
150 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       92 
151 
     | 
    
         
             
              requirements:
         
     | 
| 
       93 
152 
     | 
    
         
             
              - - '>='
         
     | 
| 
         @@ -95,9 +154,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       95 
154 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       96 
155 
     | 
    
         
             
            requirements: []
         
     | 
| 
       97 
156 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       98 
     | 
    
         
            -
            rubygems_version: 2.0. 
     | 
| 
      
 157 
     | 
    
         
            +
            rubygems_version: 2.0.14
         
     | 
| 
       99 
158 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       100 
159 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       101 
     | 
    
         
            -
            summary:  
     | 
| 
       102 
     | 
    
         
            -
            test_files: 
     | 
| 
      
 160 
     | 
    
         
            +
            summary: Support for versioned class definitions.
         
     | 
| 
      
 161 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 162 
     | 
    
         
            +
            - spec/fixtures/v1/sample_library.rb
         
     | 
| 
      
 163 
     | 
    
         
            +
            - spec/fixtures/v2.1/sample_library.rb
         
     | 
| 
      
 164 
     | 
    
         
            +
            - spec/fixtures/v3.2.1/sample_library.rb
         
     | 
| 
      
 165 
     | 
    
         
            +
            - spec/lib/versionable_spec.rb
         
     | 
| 
      
 166 
     | 
    
         
            +
            - spec/lib/versions_spec.rb
         
     | 
| 
      
 167 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
       103 
168 
     | 
    
         
             
            has_rdoc: 
         
     |