active_fedora_finders 0.4.0 → 0.5.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.
@@ -14,16 +14,20 @@ SUPPORTED_ALTS = [:cdate, :create_date, :mdate, :modified_date, :owner_id]
14
14
  Example:
15
15
 
16
16
  class MyModel < ActiveFedora::Base
17
- include ActiveFedora::Finders
17
+ include ActiveFedora::RepositoryQuerying
18
18
  end
19
19
 
20
- obj = MyModel.find_by_identifier("fedora-system:ContentModel-3.0")
20
+ obj = MyModel.search_repo(pid: "fedora-system:ContentModel-3.0").first!
21
21
 
22
22
  **
23
23
 
24
24
  Roadmap:
25
25
 
26
26
  0.1: dynamic finders, bang support
27
- 0.2: support or_create|initialize
28
- 0.3: support _all and _last
29
- 0.4: support scopes
27
+ 0.2 rubydora 1.x
28
+ 0.3: Rubydora 1.0...2.0
29
+ 0.4: AF 6.7+
30
+ 0.5: Rails 4 and Hydra 7
31
+ 0.6: support or_create|initialize
32
+ 0.7: support _all and _last
33
+ 0.8: support scopes
@@ -9,12 +9,12 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Benjamin Armintor"]
10
10
  s.email = ["armintor@gmail.com"]
11
11
  s.homepage = %q{https://github.com/barmintor/active_fedora_finders}
12
- s.summary = %q{A library for adding ActiveRecord-style dynamic finders to ActiveFedora::Base subclasses.}
13
- s.description = %q{A mixin library for ActiveFedora. Generates dynamic finder methods operating against the FCRepo object search terms (DCES elements and object properties).}
12
+ s.summary = %q{A library for adding ActiveRecord-style relations to ActiveFedora::Base subclasses.}
13
+ s.description = %q{A mixin library for ActiveFedora. Realtion methods operating against the FCRepo object search terms (DCES elements and object properties).}
14
14
 
15
15
  s.rubygems_version = %q{1.3.7}
16
16
 
17
- s.add_dependency('active-fedora', '>=6.7.0')
17
+ s.add_dependency('active-fedora', '>=7.0.0')
18
18
  s.add_dependency('activerecord')
19
19
  s.add_dependency('nokogiri')
20
20
  s.add_development_dependency("yard")
@@ -1,119 +1,22 @@
1
- require 'active-fedora'
1
+ require 'active_fedora'
2
2
  require 'active_support'
3
+ require 'active_support/deprecation'
3
4
  require 'active_record'
4
5
  require 'active_record/errors' # RecordNotFound is not autoloaded, and ActiveRecord::Base not referenced
5
- module ActiveFedora
6
- module Finders
7
- extend ActiveSupport::Concern
8
- extend ActiveSupport::Autoload
9
- autoload :Version
10
-
11
- SINGLE_VALUE_FIELDS = [:pid, :cDate, :mDate, :label]
12
- SYSTEM_FIELDS = [:ownerId].concat(SINGLE_VALUE_FIELDS)
13
- DC_FIELDS = [:contributor, :coverage, :creator, :date, :description, :format,
14
- :identifier, :language, :publisher, :relation, :rights, :source,
15
- :subject, :title, :type ]
16
- SUPPORTED_ALTS = [:cdate, :create_date, :mdate, :modified_date, :owner_id]
17
- ALL_FIELDS = [].concat(SYSTEM_FIELDS).concat(DC_FIELDS)
18
- FIELD_KEYS = begin
19
- fk = Hash[ALL_FIELDS.map {|a| [a.to_s, a]}]
20
- fk["cdate"] = :cDate
21
- fk["create_date"] = :cDate
22
- fk["mdate"] = :mDate
23
- fk["modified_date"] = :mDate
24
- fk["owner_id"] = :ownerId
25
- fk
26
- end
27
-
28
- module ClassMethods
29
-
30
- # modeled after ActiveRecord::FinderMethods.find_by_attributes
31
- def find_by_attributes(match, attribute_names, *args)
32
- conditions = Hash[attribute_names.map {|a| [a, args[attribute_names.index(a)]]}]
33
- result = fcrepo_find(match, conditions)
34
- if match.bang? && result.blank?
35
- raise ActiveRecord::RecordNotFound, "Couldn't find #{self.name} with #{conditions.to_a.collect {|p| p.join(' = ')}.join(', ')}"
36
- else
37
- yield(result) if block_given?
38
- result
39
- end
40
- end
41
-
42
- def fcrepo_find(match, args)
43
- parms = args.dup
44
- maxResults = (match.nil? or match.finder == :first) ? 1 : 25 # find_all and find_last not yet supported
45
- query = ""
46
- parms.each { |key, val|
47
- if SINGLE_VALUE_FIELDS.include? key
48
- query.concat "#{key.to_s}=#{val.to_s} "
49
- else
50
- query.concat "#{key.to_s}~#{val.to_s} "
51
- end
52
- }
53
- query.strip!
54
- results = []
55
- if ActiveFedora.config.sharded?
56
- (0...ActiveFedora.config.credentials.length).each {|ix|
57
- ActiveFedora::Base.fedora_connection[ix] ||= ActiveFedora::RubydoraConnection.new(ActiveFedora.config.credentials[ix])
58
- rubydora = ActiveFedora::Base.fedora_connection[ix].connection
59
- if results.length <= maxResults
60
- results.concat process_results(rubydora.find_objects(:query=>query,:pid=>'true', :maxResults=>maxResults))
61
- end
62
- }
63
- else
64
- ActiveFedora::Base.fedora_connection[0] ||= ActiveFedora::RubydoraConnection.new(ActiveFedora.config.credentials)
65
- rubydora = ActiveFedora::Base.fedora_connection[0].connection
66
- results.concat process_results(rubydora.find_objects(:query=>query,:pid=>'true', :maxResults=>maxResults))
67
- end
68
- return (maxResults == 1) ? results[0] : results
69
- end
70
-
71
- def process_results(results)
72
- results = Nokogiri::XML.parse(results)
73
- results = results.xpath('/f:result/f:resultList/f:objectFields/f:pid',{'f'=>"http://www.fedora.info/definitions/1/0/types/"})
74
- results.collect { |result| find_one(result.text) }
75
- end
76
-
77
- # this method is patterned after an analog in ActiveRecord::DynamicMatchers
78
- def all_attributes_exists?(attribute_names)
79
- attribute_names.reduce(true) {|result, att| ALL_FIELDS.include? att or SUPPORTED_ALTS.include? att}
80
- end
81
-
82
- def normalize_attribute_names!(attribute_names)
83
- field_keys = attribute_names.map {|val| FIELD_KEYS[val] or val}
84
- attribute_names.replace field_keys
85
- end
86
-
87
- # adapted from ActiveRecord::DynamicMatchers
88
- def method_missing(method_id, *arguments, &block)
89
- if match = (ActiveRecord::DynamicFinderMatch.match(method_id) || ActiveRecord::DynamicScopeMatch.match(method_id))
90
- attribute_names = match.attribute_names
91
- normalize_attribute_names!(attribute_names)
92
- super unless all_attributes_exists?(attribute_names)
93
- if !(match.is_a?(ActiveRecord::DynamicFinderMatch) && match.instantiator? && arguments.first.is_a?(Hash)) && arguments.size < attribute_names.size
94
- method_trace = "#{__FILE__}:#{__LINE__}:in `#{method_id}'"
95
- backtrace = [method_trace] + caller
96
- raise ArgumentError, "wrong number of arguments (#{arguments.size} for #{attribute_names.size})", backtrace
97
- end
98
- if match.respond_to?(:scope?) && match.scope?
99
- self.class_eval <<-METHOD, __FILE__, __LINE__ + 1
100
- def self.#{method_id}(*args) # def self.scoped_by_user_name_and_password(*args)
101
- attributes = Hash[[:#{attribute_names.join(',:')}].zip(args)] # attributes = Hash[[:user_name, :password].zip(args)]
102
- #
103
- scoped(:conditions => attributes) # scoped(:conditions => attributes)
104
- end # end
105
- METHOD
106
- send(method_id, *arguments)
107
- elsif match.finder?
108
- find_by_attributes(match, attribute_names, *arguments, &block)
109
- elsif match.instantiator?
110
- find_or_instantiator_by_attributes(match, attribute_names, *arguments, &block)
111
- end
112
- else
113
- super
114
- end
115
- end
116
-
6
+ module ActiveFedora::FinderMethods::RepositoryMethods
7
+ autoload :Version, 'active_fedora_finders/version'
8
+ autoload :Relation, 'active_fedora_finders/relation'
9
+ extend ActiveSupport::Concern
10
+ module ClassMethods
11
+ def search_repo(conditions={})
12
+ Relation.new(self).where!(conditions)
117
13
  end
118
14
  end
15
+ end
16
+ module ActiveFedora::Finders
17
+ extend ActiveSupport::Concern
18
+ included do
19
+ ActiveSupport::Deprecation.warn("ActiveFedora::Finders will be removed in favor of ActiveFedora::FinderMethods::RepositoryMethods")
20
+ include ActiveFedora::FinderMethods::RepositoryMethods
21
+ end
119
22
  end
@@ -0,0 +1,152 @@
1
+ require 'active_record/errors'
2
+ module ActiveFedora::FinderMethods::RepositoryMethods
3
+ class Relation
4
+
5
+ SINGLE_VALUE_FIELDS = [:pid, :cDate, :mDate, :label]
6
+ SYSTEM_FIELDS = [:ownerId].concat(SINGLE_VALUE_FIELDS)
7
+ DC_FIELDS = [:contributor, :coverage, :creator, :date, :description, :format,
8
+ :identifier, :language, :publisher, :relation, :rights, :source,
9
+ :subject, :title, :type ]
10
+ SUPPORTED_ALTS = [:cdate, :create_date, :mdate, :modified_date, :owner_id]
11
+ ALL_FIELDS = [].concat(SYSTEM_FIELDS).concat(DC_FIELDS)
12
+ FIELD_KEYS = begin
13
+ fk = Hash[ALL_FIELDS.map {|a| [a.to_s, a]}]
14
+ fk["cdate"] = :cDate
15
+ fk["create_date"] = :cDate
16
+ fk["mdate"] = :mDate
17
+ fk["modified_date"] = :mDate
18
+ fk["owner_id"] = :ownerId
19
+ fk
20
+ end
21
+
22
+ attr_reader :loaded
23
+ attr_accessor :default_scoped
24
+ alias :loaded? :loaded
25
+
26
+ def initialize(klass, values = nil)
27
+ @klass = klass
28
+ @loaded = false
29
+ @values = values || {}
30
+ end
31
+
32
+ def reset
33
+ spawn.reset!
34
+ end
35
+
36
+ def reset!
37
+ @values.delete_if {|k,v| true}
38
+ @loaded = false
39
+ @records = nil
40
+ self
41
+ end
42
+
43
+ def spawn
44
+ self.class.new(@klass, @values.dup)
45
+ end
46
+
47
+ def where(conditions={})
48
+ spawn.where!(conditions)
49
+ end
50
+
51
+ def where!(conditions={})
52
+ query = (@values[:query] ||= {})
53
+ conditions.each do |k,v|
54
+ k = FIELD_KEYS[k.to_s]
55
+ v = Array(v)
56
+ if query[k] and not SINGLE_VALUE_FIELDS.include?(k)
57
+ query[k] = (Array(query[k]) + v).uniq
58
+ else
59
+ query[k] = v[1] ? v : v.first
60
+ end
61
+ end
62
+ self
63
+ end
64
+
65
+ def limit(limit_value)
66
+ spawn.limit!(limit_value)
67
+ end
68
+
69
+ def limit!(limit_value)
70
+ @values[:maxResults] = limit_value
71
+ self
72
+ end
73
+
74
+ def to_a
75
+ load
76
+ @records
77
+ end
78
+
79
+ def load
80
+ @records = fcrepo_find(@values)
81
+ @loaded = true
82
+ end
83
+
84
+ def first
85
+ if loaded?
86
+ @records.first
87
+ else
88
+ @first ||= limit(1).to_a[0]
89
+ end
90
+ end
91
+
92
+ def first!
93
+ r = first()
94
+ raise ActiveRecord::RecordNotFound.new(@values.inspect) unless r
95
+ r
96
+ end
97
+
98
+ def find_by(conditions={})
99
+ where(conditions).to_a.first
100
+ end
101
+
102
+ def find_by!(conditions={})
103
+ r = find_by(conditions)
104
+ raise ActiveRecord::RecordNotFound.new(conditions.inspect) unless r
105
+ r
106
+ end
107
+
108
+ private
109
+ def fcrepo_find(args)
110
+ parms = args.dup
111
+ parms[:query] ||= {}
112
+ if parms[:query][:pid] and parms[:query].size == 1
113
+ return [@klass.find(parms[:query][:pid], cast: false)]
114
+ end
115
+ maxResults = parms[:maxResults] || 25 # find_all and find_last not yet supported
116
+
117
+ query = ""
118
+ parms.fetch(:query, {}).each { |key, val|
119
+ if SINGLE_VALUE_FIELDS.include? key
120
+ query.concat "#{key.to_s}=#{val.to_s} "
121
+ else
122
+ Array(val).each do |v|
123
+ query.concat "#{key.to_s}~#{v.to_s} "
124
+ end
125
+ end
126
+ }
127
+ query.strip!
128
+ results = []
129
+ if ActiveFedora.config.sharded?
130
+ (0...ActiveFedora.config.credentials.length).each {|ix|
131
+ ActiveFedora::Base.fedora_connection[ix] ||= ActiveFedora::RubydoraConnection.new(ActiveFedora.config.credentials[ix])
132
+ rubydora = ActiveFedora::Base.fedora_connection[ix].connection
133
+ if results.length <= maxResults
134
+ results.concat process_results(rubydora.find_objects(:query=>query,:pid=>'true', :maxResults=>maxResults))
135
+ end
136
+ }
137
+ else
138
+ ActiveFedora::Base.fedora_connection[0] ||= ActiveFedora::RubydoraConnection.new(ActiveFedora.config.credentials)
139
+ rubydora = ActiveFedora::Base.fedora_connection[0].connection
140
+ results.concat process_results(rubydora.find_objects(:query=>query,:pid=>'true', :maxResults=>maxResults))
141
+ end
142
+ return results
143
+ end
144
+
145
+ def process_results(results)
146
+ results = Nokogiri::XML.parse(results)
147
+ results = results.xpath('/f:result/f:resultList/f:objectFields/f:pid',{'f'=>"http://www.fedora.info/definitions/1/0/types/"})
148
+ results.collect { |result| @klass.find(result.text, cast: false) }
149
+ end
150
+
151
+ end
152
+ end
@@ -1,5 +1,5 @@
1
1
  module ActiveFedora
2
- module Finders
3
- VERSION = '0.4.0'
2
+ module Finders
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
@@ -2,53 +2,128 @@ require 'spec_helper'
2
2
  require 'config_helper'
3
3
 
4
4
  describe ActiveFedora::Finders do
5
- class TestBase < ActiveFedora::Base
6
- include ActiveFedora::Finders
5
+ before( :all) do
6
+ class SpecModel < ::ActiveFedora::Base
7
+ include ActiveFedora::Finders
8
+ end
9
+ expect(SpecModel.new).to be_kind_of ActiveFedora::Base
10
+ expect(SpecModel).to respond_to :find
11
+ end
12
+ after(:all) do
13
+ Object.send(:remove_const, :SpecModel)
7
14
  end
15
+
8
16
  FCREPO_ID = 'fedora-system:ContentModel-3.0'
9
17
  FCREPO_DATE = '2012-06-01T12:34:56.000Z'
10
18
 
11
19
  describe "finder methods" do
20
+ let(:connection) { double('ActiveFedora::RubydoraConnection') }
21
+ let(:rubydora) { double('Rubydora::Connection') }
22
+ before :each do
23
+ connection.stub(:connect) { rubydora }
24
+ connection.stub(:connection) { rubydora }
25
+ ActiveFedora::Base.fedora_connection[0]= connection
26
+ end
27
+
12
28
  describe "default find method" do
13
29
  it "should call the normal find method when passed a string" do
14
- TestBase.expects(:find_one).returns TestBase.new
15
- TestBase.find(FCREPO_ID)
30
+ all = double('ActiveFedora::Relation')
31
+ SpecModel.stub(:all) {all}
32
+ all.should_receive(:find).with(FCREPO_ID).and_return(SpecModel.new)
33
+ SpecModel.find(FCREPO_ID)
16
34
  end
17
35
  end
36
+
18
37
  describe "dynamic finder methods" do
19
- it "should call .find_by_conditions with correct attributes" do
20
- TestBase.expects(:fcrepo_find).with(is_a(ActiveRecord::DynamicFinderMatch), :identifier => FCREPO_ID).returns(TestBase.new)
21
- TestBase.find_by_identifier(FCREPO_ID)
22
- TestBase.expects(:fcrepo_find).with(is_a(ActiveRecord::DynamicFinderMatch), :cDate => FCREPO_DATE, :identifier => FCREPO_ID).returns(TestBase.new)
23
- TestBase.find_by_create_date_and_identifier(FCREPO_DATE, FCREPO_ID)
38
+ it "should shortcut if only given a PID" do
39
+ SpecModel.should_receive(:find).with(FCREPO_ID, :cast=>false).and_return(SpecModel.new)
40
+ expect(SpecModel.search_repo.where(:pid => FCREPO_ID).first).to be_a SpecModel
41
+ end
42
+ it "should call .find_objects with correct attributes" do
43
+ rubydora.should_receive(:find_objects).with(hash_including(query: "identifier~#{FCREPO_ID}")).and_return(fixture('find_one.xml'))
44
+ SpecModel.should_receive(:find).with(FCREPO_ID, cast: false).and_return(SpecModel.new)
45
+ SpecModel.search_repo.where(:identifier => FCREPO_ID).load
46
+ end
47
+ it "should call .find_objects with multiple attributes" do
48
+ rubydora.should_receive(:find_objects).with(hash_including(query: "cDate=#{FCREPO_DATE} date~#{FCREPO_DATE} identifier~#{FCREPO_ID}")).and_return(fixture('find_one.xml'))
49
+ SpecModel.should_receive(:find).with(FCREPO_ID, cast: false).and_return(SpecModel.new)
50
+ SpecModel.search_repo.where(create_date: FCREPO_DATE).where(date: FCREPO_DATE, identifier: FCREPO_ID).load
24
51
  end
25
52
  it "should return an ActiveFedora::Base when there is a single result" do
26
- stubfedora = mock("Fedora")
27
- stubfedora.expects(:connection).returns(mock("Connection", :find_objects =>fixture('find_one.xml')))
28
- TestBase.expects(:find_one).with(FCREPO_ID).returns TestBase.new(:pid=>FCREPO_ID)
29
- ActiveFedora::Base.fedora_connection = [stubfedora]
30
- TestBase.find_by_identifier(FCREPO_ID).should be_a TestBase
53
+ rubydora.stub(:find_objects =>fixture('find_one.xml'))
54
+ SpecModel.should_receive(:find).with(FCREPO_ID, cast: false).and_return SpecModel.new(:pid=>FCREPO_ID)
55
+ expect(SpecModel.search_repo.find_by(:identifier => FCREPO_ID)).to be_a SpecModel
31
56
  end
32
57
  it "should return an array when there are multiple results" do
33
- stubfedora = mock("Fedora")
34
- stubfedora.expects(:connection).returns(mock("Connection", :find_objects =>fixture('find_multiple.xml')))
35
- ActiveFedora::Base.fedora_connection = [stubfedora]
36
- TestBase.expects(:find_one).with(FCREPO_ID).returns TestBase.new(:pid=>FCREPO_ID)
37
- TestBase.expects(:find_one).with("demo:1").returns TestBase.new(:pid=>"demo:1")
38
- TestBase.find_all_by_source("test").should be_a Array
39
- end
40
- it "should throw an error when no results and a bang" do
41
- stubfedora = mock("Fedora")
42
- stubfedora.expects(:connection).returns(mock("Connection", :find_objects =>fixture('find_none.xml')))
43
- ActiveFedora::Base.fedora_connection = [stubfedora]
44
- #ActiveRecord::Base
58
+ SpecModel.stub(:find).with(FCREPO_ID, cast: false) {SpecModel.new(:pid=>FCREPO_ID)}
59
+ SpecModel.stub(:find).with("demo:1", cast: false) {SpecModel.new(:pid=>"demo:1")}
60
+ rubydora.should_receive(:find_objects).with(query: "source~test", pid: "true", maxResults: 25).and_return(fixture('find_multiple.xml'))
61
+ expect(SpecModel.search_repo.where(source: "test").to_a).to be_a Array
62
+ end
63
+ end
64
+ describe "#first" do
65
+ let(:pid) {'dummy:1'}
66
+ it "should return nil when no results" do
67
+ rubydora.stub(:find_objects) {fixture('find_none.xml')}
68
+ expect(SpecModel.search_repo.where(:identifier =>pid).first).to be_nil
69
+ end
70
+ it "should work with one result" do
71
+ rubydora.stub(:find_objects) {fixture('find_one.xml')}
72
+ SpecModel.stub(:find).with(FCREPO_ID, cast: false) {(SpecModel.new)}
73
+ expect(SpecModel.search_repo.where(:identifier =>pid).first).to be_a SpecModel
74
+ end
75
+ it "should work with multiple results" do
76
+ rubydora.stub(:find_objects) {fixture('find_multiple.xml')}
77
+ SpecModel.stub(:find).with(FCREPO_ID, cast: false) {(SpecModel.new)}
78
+ SpecModel.stub(:find).with('demo:1', cast: false) {(SpecModel.new)}
79
+ expect(SpecModel.search_repo.where(:identifier =>pid).first).to be_a SpecModel
80
+ end
81
+ end
82
+ describe "#find_by!" do
83
+ let(:pid) {'dummy:1'}
84
+ it "should throw an error when no results" do
85
+ rubydora.stub(:find_objects) {fixture('find_none.xml')}
86
+ begin
87
+ SpecModel.search_repo.find_by!(:identifier =>pid)
88
+ fail "should not successfully return from bang method with no results"
89
+ rescue Exception => e
90
+ e.should be_a ActiveRecord::RecordNotFound
91
+ end
92
+ end
93
+ it "should with one result" do
94
+ rubydora.stub(:find_objects) {fixture('find_one.xml')}
95
+ SpecModel.stub(:find).with(FCREPO_ID, cast: false) {(SpecModel.new)}
96
+ expect(SpecModel.search_repo.find_by!(:identifier =>pid)).to be_a SpecModel
97
+ end
98
+ it "should with multiple results" do
99
+ rubydora.stub(:find_objects) {fixture('find_multiple.xml')}
100
+ SpecModel.stub(:find).with(FCREPO_ID, cast: false) {(SpecModel.new)}
101
+ SpecModel.stub(:find).with('demo:1', cast: false) {(SpecModel.new)}
102
+ expect(SpecModel.search_repo.find_by!(:identifier =>pid)).to be_a SpecModel
103
+ end
104
+ end
105
+ describe "#first!" do
106
+ let(:pid) {'demo:1'}
107
+ it "should throw an error when no results" do
108
+ rubydora.stub(:find_objects) {fixture('find_none.xml')}
45
109
  begin
46
- TestBase.find_by_identifier!("dummy:1")
110
+ SpecModel.search_repo.where(:identifier =>pid).first!
47
111
  fail "should not successfully return from bang method with no results"
48
112
  rescue Exception => e
49
113
  e.should be_a ActiveRecord::RecordNotFound
50
114
  end
51
115
  end
116
+ it "should work with one result" do
117
+ rubydora.stub(:find_objects) {fixture('find_one.xml')}
118
+ SpecModel.stub(:find).with(FCREPO_ID, cast: false) {(SpecModel.new)}
119
+ expect(SpecModel.search_repo.where(:identifier =>pid).first!).to be_a SpecModel
120
+ end
121
+ it "should work with multiple results" do
122
+ rubydora.stub(:find_objects) {fixture('find_multiple.xml')}
123
+ SpecModel.stub(:find).with(FCREPO_ID, cast: false) {(SpecModel.new)}
124
+ SpecModel.stub(:find).with('demo:1', cast: false) {(SpecModel.new)}
125
+ expect(SpecModel.search_repo.where(:identifier =>pid).first!).to be_a SpecModel
126
+ end
52
127
  end
53
128
  end
54
129
  end
@@ -12,12 +12,11 @@ end
12
12
 
13
13
  require 'active-fedora'
14
14
  require 'rspec'
15
-
15
+ include RSpec::Mocks::ArgumentMatchers
16
16
  require 'support/mock_fedora'
17
17
  require 'active_fedora_finders'
18
18
 
19
19
  RSpec.configure do |config|
20
- config.mock_with :mocha
21
20
  config.color_enabled = true
22
21
  end
23
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_fedora_finders
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-21 00:00:00.000000000 Z
12
+ date: 2014-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active-fedora
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 6.7.0
21
+ version: 7.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 6.7.0
29
+ version: 7.0.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activerecord
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -139,8 +139,8 @@ dependencies:
139
139
  - - '='
140
140
  - !ruby/object:Gem::Version
141
141
  version: 0.10.5
142
- description: A mixin library for ActiveFedora. Generates dynamic finder methods operating
143
- against the FCRepo object search terms (DCES elements and object properties).
142
+ description: A mixin library for ActiveFedora. Realtion methods operating against
143
+ the FCRepo object search terms (DCES elements and object properties).
144
144
  email:
145
145
  - armintor@gmail.com
146
146
  executables: []
@@ -155,6 +155,7 @@ files:
155
155
  - Rakefile
156
156
  - active_fedora_finders.gemspec
157
157
  - lib/active_fedora_finders.rb
158
+ - lib/active_fedora_finders/relation.rb
158
159
  - lib/active_fedora_finders/version.rb
159
160
  - lib/tasks/af_finders_dev.rake
160
161
  - spec/config_helper.rb
@@ -187,8 +188,7 @@ rubyforge_project:
187
188
  rubygems_version: 1.8.24
188
189
  signing_key:
189
190
  specification_version: 3
190
- summary: A library for adding ActiveRecord-style dynamic finders to ActiveFedora::Base
191
- subclasses.
191
+ summary: A library for adding ActiveRecord-style relations to ActiveFedora::Base subclasses.
192
192
  test_files:
193
193
  - spec/config_helper.rb
194
194
  - spec/finders_spec.rb