versions.rb 1.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fac1013f437cd729493033b888daa6876e4240e
4
- data.tar.gz: 7565ddf6130285ba36e2d527e604a213907afcee
3
+ metadata.gz: 88b8d2f4d6826a132b6e8c5175001b9538d3f619
4
+ data.tar.gz: f7f182d909aef04ce3832f350206104f2bbd2b4e
5
5
  SHA512:
6
- metadata.gz: cb9fe45414b32700606c4eae1e6a2881722a7cf54d7b276ec516a75a71db93cbdc3a9c57681d121547428a8201a27278b4ee2e5bd0f15a32188845b4a2cb3ffb
7
- data.tar.gz: 7836b77b3f8281022134c507d544ce08adfc31142a34f74ef14f6c531b6c5e992eaf197647169482297a91b91758073efd987350ca9df043dcfccfe80207d6f4
6
+ metadata.gz: 632b936a5f22abeec133fc3b0384b98219a41d0a87d2effe27284fec9adebf5729a635c56c3cc9bec05fe115632bb9e87ae2d9844ddacb9af7c601e83a485db1
7
+ data.tar.gz: f43619ed901510f7cee1c814c441f9d8dd19b438bb841b1793b491d1923c634f5da62471905b005cecdff8d0a5c12da37a39dd906d4d2453e3ae744e02a8bca6
data/README.md CHANGED
@@ -27,6 +27,8 @@ end
27
27
  Use it:
28
28
 
29
29
  ```ruby
30
+ require 'versions'
31
+
30
32
  VersionedFeature = Versions.for(:awesome_feature).select('1.0')
31
33
  feature = VersionedFeature.new
32
34
  ```
@@ -39,13 +39,9 @@ module Versionable
39
39
  def loaded_versions
40
40
  @loaded_versions ||= Hash.new { |hash, key| hash[key] = versions_rb.select(key) }
41
41
  end
42
-
42
+
43
43
  def versions_rb
44
44
  @versions_rb ||= Versions.for(self.name).at(versions_directory)
45
45
  end
46
46
  end
47
-
48
- def version
49
- @instances_version
50
- end
51
47
  end
@@ -1,3 +1,5 @@
1
+ require 'forwardable'
2
+
1
3
  require 'versionable.rb'
2
4
  require 'versions/configurable.rb'
3
5
  require 'versions/file_helpers.rb'
@@ -12,6 +14,11 @@ class Versions
12
14
  include ClassHelpers
13
15
  include StringHelpers
14
16
 
17
+ class << self
18
+ extend Forwardable
19
+ def_delegators :config, :base_dir, :version_pattern, :class_prefix
20
+ end
21
+
15
22
  # Public: Sets up and returns a new instance
16
23
  #
17
24
  # mod - Symbol or String of the library name
@@ -16,7 +16,7 @@ class Versions
16
16
  # Returns a String
17
17
  def versioned_class_name(version)
18
18
  safe_version = version.to_s.gsub(/\./, '_')
19
- "#{Versions.config.class_prefix}#{safe_version}::#{library_name}"
19
+ "#{Versions.class_prefix}#{safe_version}::#{library_name}"
20
20
  end
21
21
 
22
22
  # Internal: Load and return the Class
@@ -54,4 +54,12 @@ describe Versions do
54
54
  end
55
55
  end
56
56
 
57
+ describe '#base_dir' do
58
+ before { Versions.config.base_dir = '/' }
59
+
60
+ it 'will delegate to config#base_dir' do
61
+ expect(Versions.base_dir).to eq Versions.config.base_dir
62
+ end
63
+ end
64
+
57
65
  end
@@ -1,5 +1,4 @@
1
1
  require 'simplecov'
2
- require 'pry'
3
2
 
4
3
  ENV['RACK_ENV'] = 'test'
5
4
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'versions.rb'
3
- s.version = '1.0'
3
+ s.version = '1.1'
4
4
  s.summary = 'Support for versioned class definitions.'
5
5
  s.description = 'Using simple namespacing Versions.rb lets you load versions of your code on-demand.'
6
6
  s.authors = ['Sean Callan']
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency 'coveralls', '~> 0.7' unless RUBY_PLATFORM =~ /java/
20
20
  s.add_development_dependency 'pry', '~> 0.10'
21
21
  s.add_development_dependency 'rake', '~> 10.0'
22
- s.add_development_dependency 'rr', '~> 1.1.2'
22
+ s.add_development_dependency 'rr', '~> 1.1'
23
23
  s.add_development_dependency 'rspec', '~> 3.1'
24
24
  s.add_development_dependency 'simplecov', '~> 0.9'
25
25
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versions.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Callan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coveralls
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.7'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.10'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.10'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '10.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rr
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.1.2
75
+ version: '1.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.1.2
82
+ version: '1.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '3.1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0.9'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.9'
111
111
  description: Using simple namespacing Versions.rb lets you load versions of your code
@@ -115,8 +115,8 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - .gitignore
119
- - .travis.yml
118
+ - ".gitignore"
119
+ - ".travis.yml"
120
120
  - Gemfile
121
121
  - LICENSE
122
122
  - README.md
@@ -144,17 +144,17 @@ require_paths:
144
144
  - lib
145
145
  required_ruby_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - '>'
147
+ - - ">"
148
148
  - !ruby/object:Gem::Version
149
149
  version: '1.9'
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - '>='
152
+ - - ">="
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.0.14
157
+ rubygems_version: 2.4.5
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Support for versioned class definitions.