active-fedora 12.1.1 → 12.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +20 -26
  3. data/.solr_wrapper +1 -1
  4. data/active-fedora.gemspec +0 -1
  5. data/lib/active_fedora/file.rb +1 -3
  6. data/lib/active_fedora/indexing.rb +3 -0
  7. data/lib/active_fedora/indexing/descriptor.rb +1 -1
  8. data/lib/active_fedora/indexing/field_mapper.rb +2 -2
  9. data/lib/active_fedora/indexing/suffix.rb +4 -2
  10. data/lib/active_fedora/rake_support.rb +2 -2
  11. data/lib/active_fedora/version.rb +1 -1
  12. data/lib/generators/active_fedora/config/solr/templates/.solr_wrapper.yml +1 -1
  13. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/_rest_managed.json +0 -0
  14. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/admin-extra.html +0 -0
  15. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/elevate.xml +0 -0
  16. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/mapping-ISOLatin1Accent.txt +0 -0
  17. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/protwords.txt +0 -0
  18. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/schema.xml +0 -0
  19. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/scripts.conf +0 -0
  20. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/solrconfig.xml +0 -0
  21. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/spellings.txt +0 -0
  22. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/stopwords.txt +0 -0
  23. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/stopwords_en.txt +0 -0
  24. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/synonyms.txt +0 -0
  25. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/xslt/example.xsl +0 -0
  26. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/xslt/example_atom.xsl +0 -0
  27. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/xslt/example_rss.xsl +0 -0
  28. data/lib/generators/active_fedora/config/solr/templates/solr/{config → conf}/xslt/luke.xsl +0 -0
  29. data/lib/generators/active_fedora/config/solr/templates/solr_wrapper_test.yml +1 -1
  30. data/spec/unit/active_fedora/indexing/inserter_spec.rb +5 -0
  31. data/spec/unit/file_spec.rb +17 -0
  32. metadata +19 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39f4306f380a75205db4e89173c7640cef6f8c1cbc2206f9738f93d6d3cce02c
4
- data.tar.gz: cc5a995014b8f08ab1ac7682f4000ac751329ece7170db4f114ab1017b3f6b47
3
+ metadata.gz: 67b87aed8ed8788a3a2fc65662dc569e0d01f49880795e88c22d120132a57245
4
+ data.tar.gz: dffb8c5c4286c855ba631c2f23ca7bca8c4125eaa937822b1bb5729bb49dd7e4
5
5
  SHA512:
6
- metadata.gz: f292ba19b60b37d2fd884c94fb359a64f33b4fa02e9fb9e922671fdff00cf969bbefe1fc51e58f9b956c8320d7ba0b8063d47b7eaf61577c3b51ea20ecf081b8
7
- data.tar.gz: 57024bf075eb041d99eb47ec20c05e1c9df7cb038d4a73b873429f286cd5a9089ca2d5af7c3fd43e2a42dcd7d783500f03a0ab33d195c422d60b4989915f7c13
6
+ metadata.gz: 9180480c4806e794130ffb4403dad540e88d197af319fdd709e7f2bd493dc260356eebf87cda17595152e9f2932cdc4dc66844853669af07fd5a2009bae475f3
7
+ data.tar.gz: 362078e96780bd6b3a69aee573e747996969e7fe3abfa119709e67f41f8f7f91be4b883058b2b3472539247d212e832518408f602ca8173024e772268734a529
@@ -6,15 +6,14 @@ jobs:
6
6
  parameters:
7
7
  ruby_version:
8
8
  type: string
9
- default: 2.5.5
10
9
  bundler_version:
11
10
  type: string
12
- default: '2.0.1'
11
+ default: 2.0.1
13
12
  rails_version:
14
13
  type: string
15
- default: '5.1.6.2'
16
14
  solr_config_path:
17
15
  type: string
16
+ default: lib/generators/active_fedora/config/solr/templates/solr/conf
18
17
  executor:
19
18
  name: 'samvera/ruby_fcrepo_solr'
20
19
  ruby_version: << parameters.ruby_version >>
@@ -39,31 +38,26 @@ workflows:
39
38
  ci:
40
39
  jobs:
41
40
  - bundle_lint_test:
42
- ruby_version: "2.3.8"
43
- name: "ruby2-3-8"
44
- bundler_version: '1.17.3'
45
- rails_version: '4.2.11.1'
46
- solr_config_path: 'lib/generators/active_fedora/config/solr/templates/solr/config'
41
+ name: ruby2-6_rails5-2
42
+ ruby_version: 2.6.3
43
+ rails_version: 5.2.3
47
44
  - bundle_lint_test:
48
- ruby_version: "2.5.5"
49
- name: "ruby2-5-5"
50
- solr_config_path: 'lib/generators/active_fedora/config/solr/templates/solr/config'
45
+ name: ruby2-5_rails5-2
46
+ ruby_version: 2.5.5
47
+ rails_version: 5.2.3
51
48
  - bundle_lint_test:
52
- ruby_version: "2.6.2"
53
- name: "ruby2-6-2"
54
- solr_config_path: 'lib/generators/active_fedora/config/solr/templates/solr/config'
49
+ name: ruby2-4_rails5-2
50
+ ruby_version: 2.4.6
51
+ rails_version: 5.2.3
55
52
  - bundle_lint_test:
56
- ruby_version: "2.4.5"
57
- name: "ruby2-4-5_rails5.0"
58
- rails_version: '5.0.7.2'
59
- solr_config_path: 'lib/generators/active_fedora/config/solr/templates/solr/config'
53
+ name: ruby2-6_rails5-1
54
+ ruby_version: 2.6.3
55
+ rails_version: 5.1.7
60
56
  - bundle_lint_test:
61
- ruby_version: "2.4.5"
62
- name: "ruby2-4-5_rails5.1"
63
- rails_version: '5.1.6.2'
64
- solr_config_path: 'lib/generators/active_fedora/config/solr/templates/solr/config'
57
+ name: ruby2-5_rails5.1
58
+ ruby_version: 2.5.5
59
+ rails_version: 5.1.7
65
60
  - bundle_lint_test:
66
- ruby_version: "2.4.5"
67
- name: "ruby2-4-5_rails5.2"
68
- rails_version: '5.2.2.1'
69
- solr_config_path: 'lib/generators/active_fedora/config/solr/templates/solr/config'
61
+ name: ruby2-4_rails5-1
62
+ ruby_version: 2.4.6
63
+ rails_version: 5.1.7
@@ -2,5 +2,5 @@
2
2
  # version: 6.1.0
3
3
  port: 8985
4
4
  collection:
5
- dir: lib/generators/active_fedora/config/solr/templates/solr/config/
5
+ dir: lib/generators/active_fedora/config/solr/templates/solr/conf/
6
6
  name: hydra-test
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.required_ruby_version = '~> 2.0'
16
16
 
17
17
  s.add_dependency 'rsolr', '>= 1.1.2', '< 3'
18
- s.add_dependency 'solrizer', '>= 3.4', '< 5'
19
18
  s.add_dependency "activesupport", '>= 4.2.4', '< 5.3'
20
19
  s.add_dependency "activemodel", '>= 4.2.10', '< 5.3'
21
20
  s.add_dependency "active-triples", '>= 0.11.0', '< 2.0.0'
@@ -196,9 +196,7 @@ module ActiveFedora
196
196
  end
197
197
 
198
198
  def local_or_remote_content(ensure_fetch = true)
199
- return @content if new_record?
200
-
201
- @content ||= ensure_fetch ? remote_content : @ds_content
199
+ @content ||= ensure_fetch ? remote_content : @ds_content unless new_record?
202
200
  @content.rewind if behaves_like_io?(@content)
203
201
  @content
204
202
  end
@@ -21,6 +21,9 @@ module ActiveFedora
21
21
  autoload :Suffix
22
22
  end
23
23
 
24
+ # Error to be raised for encountering unsupported field types
25
+ class InvalidIndexDescriptor < RuntimeError; end
26
+
24
27
  included do
25
28
  # Because the previous method of setting indexer was to override
26
29
  # the class method, we must ensure that we aren't using the instance
@@ -9,7 +9,7 @@ module ActiveFedora
9
9
  @type_required = opts[:requires_type]
10
10
  end
11
11
  @index_type = args
12
- raise Solrizer::InvalidIndexDescriptor, "Invalid index type passed to Sorizer.solr_name. It should be an array like [:string, :indexed, :stored, :multivalued]. You provided: `#{@index_type}'" unless index_type.is_a? Array
12
+ raise InvalidIndexDescriptor, "Invalid index type passed. It should be an array like [:string, :indexed, :stored, :multivalued]. You provided: `#{@index_type}'" unless index_type.is_a? Array
13
13
  end
14
14
 
15
15
  def name_and_converter(field_name, args = nil)
@@ -89,7 +89,7 @@ module ActiveFedora
89
89
  values = (results[name] ||= [])
90
90
  values << value unless value.nil? || values.include?(value)
91
91
  else
92
- Solrizer.logger.warn "Setting #{name} to `#{value}', but it already had `#{results[name]}'" if results[name] && Solrizer.logger
92
+ Rails.logger.warn "Setting #{name} to `#{value}', but it already had `#{results[name]}'" if results[name]
93
93
  results[name] = value
94
94
  end
95
95
  end
@@ -111,7 +111,7 @@ module ActiveFedora
111
111
  when Descriptor
112
112
  index_type
113
113
  else
114
- raise Solrizer::InvalidIndexDescriptor, "#{index_type.class} is not a valid indexer_type. Use a String, Symbol or Descriptor."
114
+ raise InvalidIndexDescriptor, "#{index_type.class} is not a valid indexer_type. Use a String, Symbol or Descriptor."
115
115
  end
116
116
 
117
117
  raise InvalidIndexDescriptor, "index type should be an Descriptor, you passed: #{index_type.class}" unless index_type.is_a? Descriptor
@@ -28,7 +28,7 @@ module ActiveFedora
28
28
  end
29
29
 
30
30
  def to_s
31
- raise Solrizer::InvalidIndexDescriptor, "Missing datatype for #{@fields}" unless data_type
31
+ raise InvalidIndexDescriptor, "Missing datatype for #{@fields}" unless data_type
32
32
 
33
33
  field_suffix = [config.suffix_delimiter]
34
34
 
@@ -66,8 +66,10 @@ module ActiveFedora
66
66
  'b'
67
67
  when :long
68
68
  'lt'
69
+ when :float, :big_decimal
70
+ 'f'
69
71
  else
70
- raise Solrizer::InvalidIndexDescriptor, "Invalid datatype `#{type.inspect}'. Must be one of: :date, :time, :text, :text_en, :string, :symbol, :integer, :boolean"
72
+ raise InvalidIndexDescriptor, "Invalid datatype `#{type.inspect}'. Must be one of: :date, :time, :text, :text_en, :string, :symbol, :integer, :boolean"
71
73
  end
72
74
  end),
73
75
  stored_suffix: 's',
@@ -16,12 +16,12 @@ def with_server(environment)
16
16
 
17
17
  SolrWrapper.wrap(load_config(:solr, environment, solr_defaults)) do |solr|
18
18
  ENV["SOLR_#{environment.upcase}_PORT"] = solr.port.to_s
19
- solr_config_path = File.join('solr', 'config')
19
+ solr_config_path = File.join('solr', 'conf')
20
20
  # Check to see if configs exist in a path relative to the working directory
21
21
  unless Dir.exist?(solr_config_path)
22
22
  $stderr.puts "Solr configuration not found at #{solr_config_path}. Using ActiveFedora defaults"
23
23
  # Otherwise use the configs delivered with ActiveFedora.
24
- solr_config_path = File.join(File.expand_path("../..", File.dirname(__FILE__)), 'lib', 'generators', 'active_fedora', 'config', 'solr', 'templates', 'solr', 'config')
24
+ solr_config_path = File.join(File.expand_path("../..", File.dirname(__FILE__)), 'lib', 'generators', 'active_fedora', 'config', 'solr', 'templates', 'solr', 'conf')
25
25
  end
26
26
  solr.with_collection(name: "hydra-#{environment}", dir: solr_config_path) do
27
27
  FcrepoWrapper.wrap(load_config(:fcrepo, environment, fcrepo_defaults)) do |fcrepo|
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "12.1.1".freeze
2
+ VERSION = "12.2.1".freeze
3
3
  end
@@ -4,5 +4,5 @@
4
4
  instance_dir: tmp/solr-development
5
5
  collection:
6
6
  persist: true
7
- dir: solr/config/
7
+ dir: solr/conf/
8
8
  name: hydra-development
@@ -4,5 +4,5 @@ port: 8985
4
4
  instance_dir: tmp/solr-test
5
5
  collection:
6
6
  persist: false
7
- dir: solr/config
7
+ dir: solr/conf
8
8
  name: hydra-test
@@ -27,4 +27,9 @@ RSpec.describe ActiveFedora::Indexing::Inserter do
27
27
  described_class.create_and_insert_terms('my_name', Date.parse('2013-01-10'), [:sortable], solr_doc)
28
28
  expect(solr_doc).to eq('my_name_dti' => '2013-01-10T00:00:00Z')
29
29
  end
30
+
31
+ it "handles floating point integers" do
32
+ described_class.create_and_insert_terms('my_number', (6.022140857*10**23).to_f, [:displayable, :searchable], solr_doc)
33
+ expect(solr_doc).to eq('my_number_ssm' => ['6.0221408569999995e+23'], 'my_number_fim' => ['6.0221408569999995e+23'])
34
+ end
30
35
  end
@@ -192,6 +192,23 @@ describe ActiveFedora::File do
192
192
  end
193
193
  end
194
194
 
195
+ context 'when file is new and content behaves like io' do
196
+ let(:file_content) { "hello world" }
197
+
198
+ before do
199
+ af_file.uri = "http://localhost:8983/fedora/rest/test/1234/abcd"
200
+ af_file.content = StringIO.new(file_content)
201
+ allow(af_file).to receive(:new_record?).and_return(true)
202
+ end
203
+
204
+ describe "#content" do
205
+ it 'can be re-read' do
206
+ expect(af_file.content.read).to eq file_content
207
+ expect(af_file.content.read).to eq file_content
208
+ end
209
+ end
210
+ end
211
+
195
212
  describe "#mime_type" do
196
213
  let(:parent) { ActiveFedora::Base.create }
197
214
  before do
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: 12.1.1
4
+ version: 12.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-04-04 00:00:00.000000000 Z
13
+ date: 2020-01-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr
@@ -32,26 +32,6 @@ dependencies:
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '3'
35
- - !ruby/object:Gem::Dependency
36
- name: solrizer
37
- requirement: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '3.4'
42
- - - "<"
43
- - !ruby/object:Gem::Version
44
- version: '5'
45
- type: :runtime
46
- prerelease: false
47
- version_requirements: !ruby/object:Gem::Requirement
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- version: '3.4'
52
- - - "<"
53
- - !ruby/object:Gem::Version
54
- version: '5'
55
35
  - !ruby/object:Gem::Dependency
56
36
  name: activesupport
57
37
  requirement: !ruby/object:Gem::Requirement
@@ -574,22 +554,22 @@ files:
574
554
  - lib/generators/active_fedora/config/solr/solr_generator.rb
575
555
  - lib/generators/active_fedora/config/solr/templates/.solr_wrapper.yml
576
556
  - lib/generators/active_fedora/config/solr/templates/solr.yml
577
- - lib/generators/active_fedora/config/solr/templates/solr/config/_rest_managed.json
578
- - lib/generators/active_fedora/config/solr/templates/solr/config/admin-extra.html
579
- - lib/generators/active_fedora/config/solr/templates/solr/config/elevate.xml
580
- - lib/generators/active_fedora/config/solr/templates/solr/config/mapping-ISOLatin1Accent.txt
581
- - lib/generators/active_fedora/config/solr/templates/solr/config/protwords.txt
582
- - lib/generators/active_fedora/config/solr/templates/solr/config/schema.xml
583
- - lib/generators/active_fedora/config/solr/templates/solr/config/scripts.conf
584
- - lib/generators/active_fedora/config/solr/templates/solr/config/solrconfig.xml
585
- - lib/generators/active_fedora/config/solr/templates/solr/config/spellings.txt
586
- - lib/generators/active_fedora/config/solr/templates/solr/config/stopwords.txt
587
- - lib/generators/active_fedora/config/solr/templates/solr/config/stopwords_en.txt
588
- - lib/generators/active_fedora/config/solr/templates/solr/config/synonyms.txt
589
- - lib/generators/active_fedora/config/solr/templates/solr/config/xslt/example.xsl
590
- - lib/generators/active_fedora/config/solr/templates/solr/config/xslt/example_atom.xsl
591
- - lib/generators/active_fedora/config/solr/templates/solr/config/xslt/example_rss.xsl
592
- - lib/generators/active_fedora/config/solr/templates/solr/config/xslt/luke.xsl
557
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/_rest_managed.json
558
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/admin-extra.html
559
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/elevate.xml
560
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/mapping-ISOLatin1Accent.txt
561
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/protwords.txt
562
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/schema.xml
563
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/scripts.conf
564
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/solrconfig.xml
565
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/spellings.txt
566
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/stopwords.txt
567
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/stopwords_en.txt
568
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/synonyms.txt
569
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/xslt/example.xsl
570
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/xslt/example_atom.xsl
571
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/xslt/example_rss.xsl
572
+ - lib/generators/active_fedora/config/solr/templates/solr/conf/xslt/luke.xsl
593
573
  - lib/generators/active_fedora/config/solr/templates/solr_wrapper_test.yml
594
574
  - lib/generators/active_fedora/model/USAGE
595
575
  - lib/generators/active_fedora/model/model_generator.rb
@@ -752,8 +732,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
752
732
  - !ruby/object:Gem::Version
753
733
  version: '0'
754
734
  requirements: []
755
- rubyforge_project:
756
- rubygems_version: 2.7.7
735
+ rubygems_version: 3.0.3
757
736
  signing_key:
758
737
  specification_version: 4
759
738
  summary: A convenience libary for manipulating documents in the Fedora Repository.