finder 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/.ruby +1 -1
  2. data/HISTORY.md +11 -0
  3. data/lib/finder/gem.rb +18 -19
  4. metadata +7 -7
data/.ruby CHANGED
@@ -38,7 +38,7 @@ load_path:
38
38
  revision: 0
39
39
  name: finder
40
40
  title: Finder
41
- version: 0.2.0
41
+ version: 0.2.1
42
42
  summary: Robust library file locator
43
43
  created: '2009-11-24'
44
44
  description: Finder is a general purpose file finder for Ruby. Finder can search RubyGems,
data/HISTORY.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # RELEASE HISTORY
2
2
 
3
+ ## 0.2.1 / 2012-03-15
4
+
5
+ Fix Gem finder so that is places spec in Array, and catches
6
+ error is gem is not found.
7
+
8
+ Changes:
9
+
10
+ * Fix Gem finder :from option to collect Array of spec.
11
+ * Fix Gem finder to catch error when gem is not found.
12
+
13
+
3
14
  ## 0.2.0 / 2012-03-14
4
15
 
5
16
  This release adds the `:from` option which allows searching
@@ -21,15 +21,7 @@ module Finder
21
21
  # @return [Array<String>] List of absolute paths.
22
22
  #
23
23
  def path(match, options={})
24
- if from = options[:from] || options[:gem]
25
- begin
26
- specs = ::Gem::Specification.find_by_name(from.to_s)
27
- rescue ::Gem::LoadError
28
- return []
29
- end
30
- else
31
- specs = ::Gem::Specification.current_specs
32
- end
24
+ specs = specifications(options)
33
25
 
34
26
  matches = []
35
27
  specs.each do |spec|
@@ -65,11 +57,7 @@ module Finder
65
57
  # @return [Array<String>] List of paths.
66
58
  #
67
59
  def load_path(match, options={})
68
- if from = options[:from] || options[:gem]
69
- specs = ::Gem::Specification.find_by_name(from.to_s)
70
- else
71
- specs = ::Gem::Specification.current_specs
72
- end
60
+ specs = specifications(options)
73
61
 
74
62
  matches = []
75
63
  specs.each do |spec|
@@ -103,11 +91,7 @@ module Finder
103
91
  # @return [Array<String>] List of absolute paths.
104
92
  #
105
93
  def data_path(match, options={})
106
- if from = options[:from] || options[:gem]
107
- specs = ::Gem::Specification.find_by_name(from.to_s)
108
- else
109
- specs = ::Gem::Specification.current_specs
110
- end
94
+ specs = specifications(options)
111
95
 
112
96
  matches = []
113
97
  specs.each do |spec|
@@ -122,6 +106,21 @@ module Finder
122
106
  matches
123
107
  end
124
108
 
109
+ private
110
+
111
+ def specifications(options)
112
+ name = options[:from] || options[:gem]
113
+ if name
114
+ begin
115
+ specs = [::Gem::Specification.find_by_name(name.to_s)]
116
+ rescue ::Gem::LoadError
117
+ return []
118
+ end
119
+ else
120
+ ::Gem::Specification.current_specs
121
+ end
122
+ end
123
+
125
124
  end
126
125
 
127
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: detroit
16
- requirement: &17355120 !ruby/object:Gem::Requirement
16
+ requirement: &30903600 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *17355120
24
+ version_requirements: *30903600
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: qed
27
- requirement: &17352400 !ruby/object:Gem::Requirement
27
+ requirement: &30903060 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *17352400
35
+ version_requirements: *30903060
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ae
38
- requirement: &17350740 !ruby/object:Gem::Requirement
38
+ requirement: &30918840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *17350740
46
+ version_requirements: *30918840
47
47
  description: Finder is a general purpose file finder for Ruby. Finder can search RubyGems,
48
48
  Roll libraries and Ruby's standard $LOAD_PATH and system data directory for the
49
49
  active or the most current library files. It is especially useful for implementing