versions.rb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/versions.rb +51 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 78041bf2a4df73df1793b184202621848d58eb03
|
4
|
+
data.tar.gz: 378de3a0716626eb7a5bd0607e387bb5a7c0f4cb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 444f3ef345bd9b74e6b02b9b4c71c0cc4a1ecae6fc497f5179e9548ea4ecc71fd4dd560f020f54d5735601029cac227b7825d87efc47fda42bb25a4365e3e179
|
7
|
+
data.tar.gz: 06ef5277923a34863ef55a03d8e66719fcf9047affd9dac124afed3fb1a9d317f31f6ae22caac473054100575250d334f53e230a7d38c130db8d0c1b6636e599
|
data/lib/versions.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
DEPENDENCIES = %w{versionable configurable file_helpers class_helpers}
|
2
|
+
|
3
|
+
DEPENDENCIES.each { |d| require File.join(File.dirname(__FILE__), 'versions', "#{d}.rb") }
|
4
|
+
|
5
|
+
class Versions
|
6
|
+
extend Versionable
|
7
|
+
extend Configurable
|
8
|
+
|
9
|
+
include FileHelpers
|
10
|
+
include ClassHelpers
|
11
|
+
|
12
|
+
def self.for(mod)
|
13
|
+
new(mod)
|
14
|
+
end
|
15
|
+
|
16
|
+
def at(path)
|
17
|
+
@path = path
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def select(version)
|
22
|
+
if file = mapped_versions[version]
|
23
|
+
load_class(version, file)
|
24
|
+
else
|
25
|
+
raise VersionNotAvailableError.new "Version #{version} is unavailable."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def available?(version)
|
30
|
+
!!mapped_versions[version]
|
31
|
+
end
|
32
|
+
|
33
|
+
def versions
|
34
|
+
mapped_versions.keys.sort
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
def initialize(mod)
|
40
|
+
@library_name = mod.to_s
|
41
|
+
end
|
42
|
+
|
43
|
+
def mapped_versions
|
44
|
+
@file_version_mapping ||= map_file_versions
|
45
|
+
end
|
46
|
+
|
47
|
+
def config
|
48
|
+
Versions.config
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: versions.rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- doomspork
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rr
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.14.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.14.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.8.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.8.2
|
69
|
+
description: Versions.rb provides a simple means to loading versioned libraries.
|
70
|
+
email: iamdoomspork@gmail.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- lib/versions.rb
|
76
|
+
homepage: https://github.com/doomspork/versions.rb
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.0.3
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Library versioning made simple.
|
100
|
+
test_files: []
|
101
|
+
has_rdoc:
|