active-fedora 6.0.0.rc1 → 6.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,8 +5,8 @@ source "http://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  group :development, :test do
8
- gem 'simplecov', :platform => :mri_19
9
- gem 'simplecov-rcov', :platform => :mri_19
8
+ gem 'simplecov', :platforms => [:mri_19, :mri_20]
9
+ gem 'simplecov-rcov', :platforms => [:mri_19, :mri_20]
10
10
  end
11
11
 
12
12
  gem 'jruby-openssl', :platform=> :jruby
@@ -23,10 +23,11 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency("activesupport", '>= 3.0.0')
24
24
  s.add_dependency("builder", '~> 3.0.0')
25
25
  s.add_dependency("mediashelf-loggable")
26
- s.add_dependency("rubydora", '~>1.3')
26
+ s.add_dependency("rubydora", '~>1.4')
27
27
  s.add_dependency("rdf")
28
28
  s.add_dependency("rdf-rdfxml", '~>1.0.0')
29
29
  s.add_dependency("deprecation")
30
+ s.add_development_dependency("rdoc")
30
31
  s.add_development_dependency("yard")
31
32
  s.add_development_dependency("RedCloth") # for RDoc formatting
32
33
  s.add_development_dependency("rake")
data/config/jetty.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  default:
2
+ startup_wait: 45
2
3
  jetty_port: 8983
3
4
  java_opts:
4
5
  - "-Xmx256m"
@@ -181,7 +181,7 @@ module ActiveFedora
181
181
 
182
182
  def construct_query
183
183
  clauses = {@reflection.options[:property] => @owner.internal_uri}
184
- clauses[:has_model] = @reflection.class_name.constantize.to_class_uri if @reflection.class_name
184
+ clauses[:has_model] = @reflection.class_name.constantize.to_class_uri if @reflection.class_name && @reflection.class_name != 'ActiveFedora::Base'
185
185
  @counter_query = @finder_query = ActiveFedora::SolrService.construct_query_for_rel(clauses)
186
186
  end
187
187
 
@@ -3,7 +3,7 @@ module ActiveFedora
3
3
  module Serializers
4
4
 
5
5
  ## This allows you to use date_select helpers in rails views
6
- # @param [Hash] parms parameters hash
6
+ # @param [Hash] params parameters hash
7
7
  # @return [Hash] a parameters list with the date select parameters replaced with dates
8
8
  def deserialize_dates_from_form(params)
9
9
  dates = {}
@@ -214,8 +214,8 @@ module ActiveFedora
214
214
  credentials = ActiveFedora.config.credentials
215
215
  end
216
216
  fedora_connection[0] ||= ActiveFedora::RubydoraConnection.new(credentials)
217
- d = REXML::Document.new( fedora_connection[0].connection.next_pid(args))
218
- pid =d.elements['//pid'].text
217
+ d = Nokogiri::XML( fedora_connection[0].connection.next_pid(args))
218
+ pid = d.xpath('//fedora:pid', 'fedora' => 'http://www.fedora.info/definitions/1/0/management/').text
219
219
  pid
220
220
  end
221
221
 
@@ -1,10 +1,12 @@
1
1
  #this class represents a xml metadata datastream
2
2
  module ActiveFedora
3
3
  class NokogiriDatastream < OmDatastream
4
+ extend Deprecation
4
5
  def initialize(digital_object=nil, dsid=nil, options={})
5
- Deprecation.warn("NokogiriDatastream is deprecated and will be removed in active-fedora 7.0, use OmDatastream instead", caller)
6
6
  super
7
7
  end
8
+ self.deprecation_horizon= "hydra-head 7.0"
9
+ deprecation_deprecate :initialize
8
10
  end
9
11
  end
10
12
 
@@ -100,7 +100,7 @@ module ActiveFedora
100
100
  end
101
101
  end
102
102
 
103
- # @param [Symbol, RDF::URI] predicate the predicate to insert into the graph
103
+ # @param [Symbol, RDF::URI] term predicate the predicate to insert into the graph
104
104
  def find_predicate(term)
105
105
  conf = config_for_term_or_uri(term)
106
106
  conf ? conf[:predicate] : nil
@@ -79,9 +79,8 @@ module ActiveFedora
79
79
  # called on
80
80
  #
81
81
  # @param[String,Symbol,Hash] args either a pid or :all or a hash of conditions
82
- # @param [Hash] opts the options to create a message with.
83
- # @option opts [Integer] :rows when :all is passed, the maximum number of rows to load from solr
84
- # @option opts [Boolean] :cast when true, examine the model and cast it to the first known cModel
82
+ # @option args [Integer] :rows when :all is passed, the maximum number of rows to load from solr
83
+ # @option args [Boolean] :cast when true, examine the model and cast it to the first known cModel
85
84
  def find(*args)
86
85
  return to_a.find { |*block_args| yield(*block_args) } if block_given?
87
86
  options = args.extract_options!
@@ -42,8 +42,8 @@ module ActiveFedora
42
42
 
43
43
  # Populate a RelsExtDatastream object based on the "datastream" content
44
44
  # Assumes that the datastream contains RDF XML from a Fedora RELS-EXT datastream
45
+ # @param [String] xml the "rdf" node
45
46
  # @param [ActiveFedora::Datastream] tmpl the Datastream object that you are populating
46
- # @param [String] the "rdf" node
47
47
  def self.from_xml(xml, tmpl)
48
48
  if (xml.nil?)
49
49
  ### maybe put the template here?
@@ -26,7 +26,7 @@ module ActiveFedora
26
26
 
27
27
  # Add a relationship to the Object.
28
28
  # @param predicate
29
- # @param object Either a string URI or an object that is a kind of ActiveFedora::Base
29
+ # @param target Either a string URI or an object that is a kind of ActiveFedora::Base
30
30
  def add_relationship(predicate, target, literal=false)
31
31
  object_relations.add(predicate, target, literal)
32
32
  rels_ext.content_will_change! if object_relations.dirty
@@ -47,7 +47,7 @@ module ActiveFedora
47
47
  # 2. kind_of? returns true for the model passed in
48
48
  # This method can most often be used to detect if an object from Fedora that was created
49
49
  # with a different model was then used to populate this object.
50
- # @param [Class] the model class name to check if an object conforms_to that model
50
+ # @param [Class] model_class the model class name to check if an object conforms_to that model
51
51
  # @return [Boolean] true if this object conforms to the given model name
52
52
  def conforms_to?(model_class)
53
53
  if self.kind_of?(model_class)
@@ -72,7 +72,7 @@ module ActiveFedora
72
72
  #
73
73
  # Remove a Rels-Ext relationship from the Object.
74
74
  # @param predicate
75
- # @param object Either a string URI or an object that responds to .pid
75
+ # @param obj Either a string URI or an object that responds to .pid
76
76
  def remove_relationship(predicate, obj, literal=false)
77
77
  object_relations.delete(predicate, obj)
78
78
  self.relationships_are_dirty = true
@@ -94,7 +94,7 @@ module ActiveFedora
94
94
 
95
95
  # Get the count of records that match the query
96
96
  # @param [String] query a solr query
97
- # @returns [Integer] number of records matching
97
+ # @return [Integer] number of records matching
98
98
  def self.count(query)
99
99
  SolrService.query(query, :raw=>true, :rows=>0)['response']['numFound'].to_i
100
100
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "6.0.0.rc1"
2
+ VERSION = "6.0.0.rc2"
3
3
  end
@@ -14,7 +14,7 @@ namespace :active_fedora do
14
14
 
15
15
  YARD::Rake::YardocTask.new(:doc) do |yt|
16
16
  yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
17
- [ File.join(project_root, 'README.textile'),'-', File.join(project_root,'CONSOLE_GETTING_STARTED.textile'),'-', File.join(project_root,'NOKOGIRI_DATASTREAMS.textile') ]
17
+ [ '-', File.join(project_root, 'README.textile'), File.join(project_root,'CONSOLE_GETTING_STARTED.textile'), File.join(project_root,'NOKOGIRI_DATASTREAMS.textile') ]
18
18
  yt.options = ['--output-dir', doc_destination, '--readme', 'README.textile']
19
19
  end
20
20
  rescue LoadError
@@ -4,7 +4,7 @@ describe "When two or more relationships share the same property" do
4
4
  before do
5
5
  class Book < ActiveFedora::Base
6
6
  has_many :collections, :property=>:is_part_of, :class_name=>'Collection'
7
- has_many :people, :property=>:is_part_of#, :class_name=>'Person'
7
+ has_many :people, :property=>:is_part_of
8
8
  end
9
9
 
10
10
  class Person < ActiveFedora::Base
@@ -15,7 +15,7 @@ describe "When two or more relationships share the same property" do
15
15
  belongs_to :book, :property=>:is_part_of
16
16
  end
17
17
 
18
- @book = Book.create!#(:collections=>[@collection1, @collection2], :people=>[@person1, @person2])
18
+ @book = Book.create!
19
19
  @person1 = Person.create!(:book=>@book)
20
20
  @person2 = Person.create!(:book=>@book)
21
21
  end
@@ -31,3 +31,34 @@ describe "When two or more relationships share the same property" do
31
31
  @book.collections.should == []
32
32
  end
33
33
  end
34
+
35
+ describe "When relationship is restricted to AF::Base" do
36
+ before do
37
+ class Email < ActiveFedora::Base
38
+ has_many :attachments, :property=>:is_part_of, :class_name=>'ActiveFedora::Base'
39
+ end
40
+
41
+ class Image < ActiveFedora::Base
42
+ belongs_to :email, :property=>:is_part_of
43
+ end
44
+
45
+ class PDF < ActiveFedora::Base
46
+ belongs_to :email, :property=>:is_part_of
47
+ end
48
+
49
+ @book = Email.create!
50
+ @image = Image.create!(:email=>@book)
51
+ @pdf = PDF.create!(:email=>@book)
52
+ end
53
+ after do
54
+ Object.send(:remove_const, :Image)
55
+ Object.send(:remove_const, :PDF)
56
+ Object.send(:remove_const, :Email)
57
+ end
58
+
59
+
60
+ it "Should not restrict relationships " do
61
+ @book.reload
62
+ @book.attachments.should == [@image, @pdf]
63
+ end
64
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.rc1
4
+ version: 6.0.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -148,7 +148,7 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '1.3'
151
+ version: '1.4'
152
152
  type: :runtime
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
@@ -156,7 +156,7 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.3'
159
+ version: '1.4'
160
160
  - !ruby/object:Gem::Dependency
161
161
  name: rdf
162
162
  requirement: !ruby/object:Gem::Requirement
@@ -205,6 +205,22 @@ dependencies:
205
205
  - - ">="
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
+ - !ruby/object:Gem::Dependency
209
+ name: rdoc
210
+ requirement: !ruby/object:Gem::Requirement
211
+ none: false
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ none: false
220
+ requirements:
221
+ - - ">="
222
+ - !ruby/object:Gem::Version
223
+ version: '0'
208
224
  - !ruby/object:Gem::Dependency
209
225
  name: yard
210
226
  requirement: !ruby/object:Gem::Requirement