predicated 0.2.2 → 0.2.5

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.
@@ -1,11 +1,22 @@
1
1
  module Predicated
2
2
  def self.require_gem_version(gem_name, minimum_version, require_name=gem_name)
3
- unless Gem.available?(gem_name, Gem::Requirement.create(">= #{minimum_version}"))
3
+ gem_version = Gem::Requirement.create(">= #{minimum_version}")
4
+ gem_found =
5
+ if Gem::Specification.respond_to? :find_by_name
6
+ # RubyGems 1.8
7
+ Gem::Specification.find_by_name(gem_name, gem_version)
8
+ else
9
+ # RubyGems <= 1.7
10
+ Gem.available?(gem_name, gem_version)
11
+ end
12
+
13
+ unless gem_found
14
+
4
15
  raise %{
5
16
  Gem: #{gem_name} >=#{minimum_version}
6
17
  Does not appear to be installed. Please install it.
7
18
 
8
- Predicated is built in a way that allows you to pick and
19
+ Predicated is built in a way that allows you to pick and
9
20
  choose which features to use.
10
21
 
11
22
  RubyGems has no way to specify optional dependencies,
@@ -13,22 +24,22 @@ therefore I've made the decision not to have Predicated
13
24
  automatically depend into the various gems referenced
14
25
  in from/to "extensions".
15
26
 
16
- The cost here is that the gem install doesn't necessarily
17
- "just work" for you out of the box. But in return you get
18
- greater flexibility.
27
+ The cost here is that the gem install doesn't necessarily
28
+ "just work" for you out of the box. But in return you get
29
+ greater flexibility.
19
30
 
20
- Notably, rails/arel unfortunately has a hard dependency
21
- on Rails 3 activesupport, which requires ruby 1.8.7.
22
- By making from/to dependencies optional, those with
23
- no interest in arel can use Predicated in a wider
31
+ Notably, rails/arel unfortunately has a hard dependency
32
+ on Rails 3 activesupport, which requires ruby 1.8.7.
33
+ By making from/to dependencies optional, those with
34
+ no interest in arel can use Predicated in a wider
24
35
  variety of environments.
25
36
 
26
37
  For more discussion see:
27
38
  http://stackoverflow.com/questions/2993335/rubygems-optional-dependencies
28
39
  }
29
40
  end
30
-
41
+
31
42
  require require_name
32
43
  end
33
-
34
- end
44
+
45
+ end
@@ -1,3 +1,3 @@
1
1
  module Predicated
2
- VERSION = "0.2.2" unless defined?(Predicated::VERSION)
2
+ VERSION = "0.2.5" unless defined?(Predicated::VERSION)
3
3
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: predicated
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 29
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 2
8
- - 2
9
- version: 0.2.2
9
+ - 5
10
+ version: 0.2.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - Steve Conover
@@ -15,8 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-07-06 00:00:00 -07:00
19
- default_executable:
19
+ date: 2010-07-06 00:00:00 Z
20
20
  dependencies: []
21
21
 
22
22
  description: Predicated is a simple predicate model for Ruby.
@@ -75,7 +75,6 @@ files:
75
75
  - test/to/solr_test.rb
76
76
  - test/to/xml_test.rb
77
77
  - test/xml_conversion_test.rb
78
- has_rdoc: true
79
78
  homepage: http://github.com/sconover/predicated
80
79
  licenses: []
81
80
 
@@ -89,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
88
  requirements:
90
89
  - - ">="
91
90
  - !ruby/object:Gem::Version
92
- hash: 4570885310046635928
91
+ hash: 3
93
92
  segments:
94
93
  - 0
95
94
  version: "0"
@@ -98,13 +97,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
97
  requirements:
99
98
  - - ">="
100
99
  - !ruby/object:Gem::Version
100
+ hash: 3
101
101
  segments:
102
102
  - 0
103
103
  version: "0"
104
104
  requirements: []
105
105
 
106
106
  rubyforge_project: predicated
107
- rubygems_version: 1.3.7
107
+ rubygems_version: 1.7.2
108
108
  signing_key:
109
109
  specification_version: 3
110
110
  summary: Predicated is a simple predicate model for Ruby