hydra-works 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.rubocop.yml +0 -1
  4. data/README.md +9 -9
  5. data/Rakefile +12 -12
  6. data/hydra-works.gemspec +3 -3
  7. data/lib/hydra/works/models/characterization/fits_datastream.rb +1 -1
  8. data/lib/hydra/works/models/work.rb +4 -1
  9. data/lib/hydra/works/services/add_file_to_file_set.rb +5 -5
  10. data/lib/hydra/works/services/characterization_service.rb +2 -2
  11. data/lib/hydra/works/version.rb +1 -1
  12. data/lib/hydra/works.rb +1 -1
  13. data/solr/config/_rest_managed.json +3 -0
  14. data/solr/config/admin-extra.html +31 -0
  15. data/solr/config/elevate.xml +36 -0
  16. data/solr/config/mapping-ISOLatin1Accent.txt +246 -0
  17. data/solr/config/protwords.txt +21 -0
  18. data/solr/config/schema.xml +372 -0
  19. data/solr/config/scripts.conf +24 -0
  20. data/solr/config/solrconfig.xml +419 -0
  21. data/solr/config/spellings.txt +2 -0
  22. data/solr/config/stopwords.txt +58 -0
  23. data/solr/config/stopwords_en.txt +58 -0
  24. data/solr/config/synonyms.txt +31 -0
  25. data/solr/config/xslt/example.xsl +132 -0
  26. data/solr/config/xslt/example_atom.xsl +67 -0
  27. data/solr/config/xslt/example_rss.xsl +66 -0
  28. data/solr/config/xslt/luke.xsl +337 -0
  29. data/spec/hydra/works/models/collection_spec.rb +17 -17
  30. data/spec/hydra/works/models/file_set_spec.rb +8 -8
  31. data/spec/hydra/works/models/{generic_work_spec.rb → work_spec.rb} +57 -57
  32. data/spec/hydra/works/services/add_file_to_file_set_spec.rb +23 -23
  33. data/spec/hydra/works/services/upload_file_spec.rb +22 -22
  34. data/spec/hydra/works_spec.rb +18 -18
  35. data/spec/spec_helper.rb +3 -2
  36. metadata +36 -24
  37. data/config/solrconfig.xml +0 -223
  38. data/lib/hydra/works/models/generic_work.rb +0 -9
  39. data/lib/tasks/hydra-works_tasks.rake +0 -89
  40. data/lib/tasks/jetty.rake +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc76ae65e10c75f045b933e2b8de237292821b2d
4
- data.tar.gz: 20c76bd9fb5e0002a74f279efa932ab0685618e5
3
+ metadata.gz: 56fe0f1919fdd32fe127f5d3e0fc759eb781d74d
4
+ data.tar.gz: a6f9183d56fd7911150ca4ce152bb5280471135c
5
5
  SHA512:
6
- metadata.gz: 7e97285baab41bb01e5ab16541057e6a50fee7630eb48daeb92eb8d7d64ef3cfd50878520533e1ee7e34fe6b5f74b8ad015b7756a99661aa9cd234bdbc0401e6
7
- data.tar.gz: 35363e268e45beaf3331bd7976ad99b8a269850e8a51ef4c00380f98b6f9b8e9526fc3244a59ceb8f79fc0a51b9d36e3ebbe13bb3853f461d0396370a035b911
6
+ metadata.gz: 98a261ed13442400b6f41cb607d4b32e0f9fe8297ddd463d919ee1b69e19cb5704c1d41659566ad0f77b2f521b3ec140f3990b7eddc8b78af203bafbfc562eff
7
+ data.tar.gz: 65a823283ea04b931451b685c8dc19bed6b666ea18199cc7a23c6140e463c243c2eb6b1afa5b47e8df18b2eea0d4839acb632eaf2df3d6ff812162d94169d3e3
data/.gitignore CHANGED
@@ -15,6 +15,7 @@ spec/internal
15
15
  *.a
16
16
  mkmf.log
17
17
  jetty
18
+ fcrepo4-data
18
19
  .DS_Store
19
20
  .ruby-gemset
20
- .ruby-version
21
+ .ruby-version
data/.rubocop.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
- RunRailsCops: true
5
4
  DisplayCopNames: true
6
5
  Include:
7
6
  - '**/Rakefile'
data/README.md CHANGED
@@ -11,9 +11,9 @@
11
11
 
12
12
  The Hydra::Works gem provides a set of [Portland Common Data Model](https://github.com/duraspace/pcdm/wiki)-compliant ActiveFedora models and associated behaviors around the broad concept of multi-file "works", the need for which was expressed by a variety of [community use cases](https://github.com/projecthydra-labs/hydra-works/tree/master/use-cases). The Hydra::Works domain model includes:
13
13
 
14
- * **FileSet**: a *Hydra::PCDM::Object* that encapsulates one or more directly related *Hydra::PCDM::File*s, such as a PDF document, its derivatives, and extracted full-text
15
- * **GenericWork**: a *Hydra::PCDM::Object* that holds zero or more **FileSets**s and zero or more **Work**s (often you won't use GenericWork, but instead write your own Work class)
16
- * **Collection**: a *Hydra::PCDM::Collection* that indirectly contains zero or more **Work**s and zero or more **Collection**s
14
+ * **FileSet**: a *Hydra::PCDM::Object* that encapsulates one or more directly related *Hydra::PCDM::Files*, such as a PDF document, its derivatives, and extracted full-text
15
+ * **Work**: a *Hydra::PCDM::Object* that holds zero or more **FileSets** and zero or more **Works** (often you won't use Work directly, but instead write your own class that mixes in `Hydra::Works::WorkBehavior`)
16
+ * **Collection**: a *Hydra::PCDM::Collection* that indirectly contains zero or more **Works** and zero or more **Collection**s
17
17
 
18
18
  View [a diagram of the domain model](https://docs.google.com/drawings/d/1-NkkRPpGpZGoTimEpYTaGM1uUPRaT0SamuWDITvtG_8/edit).
19
19
 
@@ -51,12 +51,13 @@ class Page < ActiveFedora::Base
51
51
  end
52
52
 
53
53
  collection = Collection.create
54
- book = BookWork.create
54
+ book = Book.create
55
55
  page = Page.create
56
56
 
57
- collection.works << book
57
+ collection.members << book
58
58
  collection.save
59
- book.generic_files << page
59
+
60
+ book.members << page
60
61
  book.save
61
62
 
62
63
  file = page.files.build
@@ -73,7 +74,7 @@ To turn on virus detection, install clamav on your system and add the `clamav` g
73
74
  Then include the `VirusCheck` module in your `FileSet` class:
74
75
 
75
76
  ```ruby
76
- class BookFiles < ActiveFedora::Base
77
+ class Page < ActiveFedora::Base
77
78
  include Hydra::Works::FileSetBehavior
78
79
  include Hydra::Works::VirusCheck
79
80
  end
@@ -92,10 +93,9 @@ If you'd like to contribute to this effort, please check out the [contributing g
92
93
  To set up for running the test suite, you need a copy of jetty
93
94
 
94
95
  $ rake jetty:clean
95
- $ rake jetty:config
96
+ $ rake hydra_works:jetty:config
96
97
 
97
98
  To run the test suite, generate the test app (which goes into spec/internal) and start jetty (if it's not already running)
98
99
 
99
- $ rails engine_cart:generate
100
100
  $ rake jetty:start
101
101
  $ rake spec
data/Rakefile CHANGED
@@ -1,11 +1,9 @@
1
1
  require 'bundler/gem_tasks'
2
- require 'jettywrapper'
3
2
  require 'rspec/core'
4
3
  require 'rspec/core/rake_task'
5
- require 'engine_cart/rake_task'
6
4
  require 'rubocop/rake_task'
7
-
8
- Dir.glob('lib/tasks/*.rake').each { |r| import r }
5
+ require 'solr_wrapper'
6
+ require 'fcrepo_wrapper'
9
7
 
10
8
  desc 'Run style checker'
11
9
  RuboCop::RakeTask.new(:rubocop) do |task|
@@ -19,15 +17,17 @@ task :spec do
19
17
  RSpec::Core::RakeTask.new(:spec)
20
18
  end
21
19
 
22
- desc 'Spin up hydra-jetty and run specs'
23
- task ci: ['jetty:clean', 'jetty:config'] do
24
- puts 'running continuous integration'
25
- jetty_params = Jettywrapper.load_config
26
- jetty_params[:startup_wait] = 90
27
- error = Jettywrapper.wrap(jetty_params) do
28
- Rake::Task['spec'].invoke
20
+ desc 'Spin up Solr & Fedora and run the test suite'
21
+ task :ci do
22
+ solr_params = { port: 8983, verbose: true, managed: true }
23
+ fcrepo_params = { port: 8984, verbose: true, managed: true }
24
+ SolrWrapper.wrap(solr_params) do |solr|
25
+ solr.with_collection(name: 'hydra-test', dir: File.join(File.expand_path('.', File.dirname(__FILE__)), 'solr', 'config')) do
26
+ FcrepoWrapper.wrap(fcrepo_params) do
27
+ Rake::Task['spec'].invoke
28
+ end
29
+ end
29
30
  end
30
- fail "test failures: #{error}" if error
31
31
  end
32
32
 
33
33
  task default: :ci
data/hydra-works.gemspec CHANGED
@@ -18,16 +18,16 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'hydra-pcdm', '~> 0.3'
21
+ spec.add_dependency 'hydra-pcdm', '~> 0.4'
22
22
  spec.add_dependency 'hydra-derivatives', '~> 3.0'
23
23
  spec.add_dependency 'hydra-file_characterization', '~> 0.3', '>= 0.3.3'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.7'
26
26
  spec.add_development_dependency 'rake', '~> 10.0'
27
27
  spec.add_development_dependency 'rspec-rails', '~> 3.1'
28
- spec.add_development_dependency 'engine_cart', '~> 0'
29
28
  spec.add_development_dependency 'sqlite3'
30
- spec.add_development_dependency 'jettywrapper', '>= 2.0.0'
29
+ spec.add_development_dependency 'solr_wrapper', '~> 0.4'
30
+ spec.add_development_dependency 'fcrepo_wrapper', '~> 0.1'
31
31
  spec.add_development_dependency 'coveralls'
32
32
  spec.add_development_dependency 'rspec'
33
33
  end
@@ -100,7 +100,7 @@ module Hydra::Works::Characterization
100
100
  t.copyright_note(proxy: [:fileinfo, :copyright_note])
101
101
  t.well_formed(proxy: [:filestatus, :well_formed])
102
102
  t.valid(proxy: [:filestatus, :valid])
103
- t.status_message(proxy: [:filestatus, :status_message])
103
+ t.filestatus_message(proxy: [:filestatus, :status_message])
104
104
  t.file_title(proxy: [:metadata, :document, :file_title])
105
105
  t.file_author(proxy: [:metadata, :document, :file_author])
106
106
  t.page_count(proxy: [:metadata, :document, :page_count])
@@ -1,5 +1,8 @@
1
1
  module Hydra::Works
2
- # Namespace for Modules with functionality specific to Works
2
+ # Typically used for very generic applications that don't differentiate
3
+ # between specific content types. If you want a specific type of work
4
+ # extend ActiveFedora::Base and include the following:
5
+ # include Hydra::Works::WorkBehavior
3
6
  class Work < ActiveFedora::Base
4
7
  include Hydra::Works::WorkBehavior
5
8
  end
@@ -8,7 +8,7 @@ module Hydra::Works
8
8
  # @param [Boolean] versioning whether to create new version entries (only applicable if +type+ corresponds to a versionable file)
9
9
 
10
10
  def self.call(file_set, file, type, update_existing: true, versioning: true)
11
- fail ArgumentError, 'supplied object must be a generic file' unless file_set.file_set?
11
+ fail ArgumentError, 'supplied object must be a file set' unless file_set.file_set?
12
12
  fail ArgumentError, 'supplied file must respond to read' unless file.respond_to? :read
13
13
 
14
14
  # TODO: required as a workaround for https://github.com/projecthydra/active_fedora/pull/858
@@ -71,13 +71,13 @@ module Hydra::Works
71
71
  # @param object for original name to be determined. Attempts to use methods: :original_name, :original_filename, and :path.
72
72
  def determine_original_name(file)
73
73
  if file.respond_to? :original_name
74
- return file.original_name
74
+ file.original_name
75
75
  elsif file.respond_to? :original_filename
76
- return file.original_filename
76
+ file.original_filename
77
77
  elsif file.respond_to? :path
78
- return ::File.basename(file.path)
78
+ ::File.basename(file.path)
79
79
  else
80
- return ''
80
+ ''
81
81
  end
82
82
  end
83
83
 
@@ -105,8 +105,8 @@ module Hydra::Works
105
105
  def property_for(term)
106
106
  if mapping.key?(term) && object.respond_to?(mapping[term])
107
107
  mapping[term]
108
- else
109
- term if object.respond_to?(term)
108
+ elsif object.respond_to?(term)
109
+ term
110
110
  end
111
111
  end
112
112
 
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Works
3
- VERSION = '0.6.0'
3
+ VERSION = '0.7.0'.freeze
4
4
  end
5
5
  end
data/lib/hydra/works.rb CHANGED
@@ -27,7 +27,7 @@ module Hydra
27
27
  autoload_under 'models' do
28
28
  autoload :Collection
29
29
  autoload :FileSet
30
- autoload :GenericWork
30
+ autoload :Work
31
31
  end
32
32
 
33
33
  autoload_under 'models/concerns' do
@@ -0,0 +1,3 @@
1
+ {
2
+ "initArgs":{},
3
+ "managedList":[]}
@@ -0,0 +1,31 @@
1
+ <!--
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+
18
+ <!-- The content of this page will be statically included into the top
19
+ of the admin page. Uncomment this as an example to see there the content
20
+ will show up.
21
+
22
+ <hr>
23
+ <i>This line will appear before the first table</i>
24
+ <tr>
25
+ <td colspan="2">
26
+ This row will be appended to the end of the first table
27
+ </td>
28
+ </tr>
29
+ <hr>
30
+
31
+ -->
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+
19
+ <!-- If this file is found in the config directory, it will only be
20
+ loaded once at startup. If it is found in Solr's data
21
+ directory, it will be re-loaded every commit.
22
+ -->
23
+
24
+ <elevate>
25
+ <query text="foo bar">
26
+ <doc id="1" />
27
+ <doc id="2" />
28
+ <doc id="3" />
29
+ </query>
30
+
31
+ <query text="ipod">
32
+ <doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
33
+ <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
34
+ </query>
35
+
36
+ </elevate>
@@ -0,0 +1,246 @@
1
+ # The ASF licenses this file to You under the Apache License, Version 2.0
2
+ # (the "License"); you may not use this file except in compliance with
3
+ # the License. You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ # Syntax:
14
+ # "source" => "target"
15
+ # "source".length() > 0 (source cannot be empty.)
16
+ # "target".length() >= 0 (target can be empty.)
17
+
18
+ # example:
19
+ # "??" => "A"
20
+ # "\u00C0" => "A"
21
+ # "\u00C0" => "\u0041"
22
+ # "??" => "ss"
23
+ # "\t" => " "
24
+ # "\n" => ""
25
+
26
+ # ?? => A
27
+ "\u00C0" => "A"
28
+
29
+ # ?? => A
30
+ "\u00C1" => "A"
31
+
32
+ # ?? => A
33
+ "\u00C2" => "A"
34
+
35
+ # ?? => A
36
+ "\u00C3" => "A"
37
+
38
+ # ?? => A
39
+ "\u00C4" => "A"
40
+
41
+ # ?? => A
42
+ "\u00C5" => "A"
43
+
44
+ # ?? => AE
45
+ "\u00C6" => "AE"
46
+
47
+ # ?? => C
48
+ "\u00C7" => "C"
49
+
50
+ # ?? => E
51
+ "\u00C8" => "E"
52
+
53
+ # ?? => E
54
+ "\u00C9" => "E"
55
+
56
+ # ?? => E
57
+ "\u00CA" => "E"
58
+
59
+ # ?? => E
60
+ "\u00CB" => "E"
61
+
62
+ # ?? => I
63
+ "\u00CC" => "I"
64
+
65
+ # ?? => I
66
+ "\u00CD" => "I"
67
+
68
+ # ?? => I
69
+ "\u00CE" => "I"
70
+
71
+ # ?? => I
72
+ "\u00CF" => "I"
73
+
74
+ # ?? => IJ
75
+ "\u0132" => "IJ"
76
+
77
+ # ?? => D
78
+ "\u00D0" => "D"
79
+
80
+ # ?? => N
81
+ "\u00D1" => "N"
82
+
83
+ # ?? => O
84
+ "\u00D2" => "O"
85
+
86
+ # ?? => O
87
+ "\u00D3" => "O"
88
+
89
+ # ?? => O
90
+ "\u00D4" => "O"
91
+
92
+ # ?? => O
93
+ "\u00D5" => "O"
94
+
95
+ # ?? => O
96
+ "\u00D6" => "O"
97
+
98
+ # ?? => O
99
+ "\u00D8" => "O"
100
+
101
+ # ?? => OE
102
+ "\u0152" => "OE"
103
+
104
+ # ??
105
+ "\u00DE" => "TH"
106
+
107
+ # ?? => U
108
+ "\u00D9" => "U"
109
+
110
+ # ?? => U
111
+ "\u00DA" => "U"
112
+
113
+ # ?? => U
114
+ "\u00DB" => "U"
115
+
116
+ # ?? => U
117
+ "\u00DC" => "U"
118
+
119
+ # ?? => Y
120
+ "\u00DD" => "Y"
121
+
122
+ # ?? => Y
123
+ "\u0178" => "Y"
124
+
125
+ # ?? => a
126
+ "\u00E0" => "a"
127
+
128
+ # ?? => a
129
+ "\u00E1" => "a"
130
+
131
+ # ?? => a
132
+ "\u00E2" => "a"
133
+
134
+ # ?? => a
135
+ "\u00E3" => "a"
136
+
137
+ # ?? => a
138
+ "\u00E4" => "a"
139
+
140
+ # ?? => a
141
+ "\u00E5" => "a"
142
+
143
+ # ?? => ae
144
+ "\u00E6" => "ae"
145
+
146
+ # ?? => c
147
+ "\u00E7" => "c"
148
+
149
+ # ?? => e
150
+ "\u00E8" => "e"
151
+
152
+ # ?? => e
153
+ "\u00E9" => "e"
154
+
155
+ # ?? => e
156
+ "\u00EA" => "e"
157
+
158
+ # ?? => e
159
+ "\u00EB" => "e"
160
+
161
+ # ?? => i
162
+ "\u00EC" => "i"
163
+
164
+ # ?? => i
165
+ "\u00ED" => "i"
166
+
167
+ # ?? => i
168
+ "\u00EE" => "i"
169
+
170
+ # ?? => i
171
+ "\u00EF" => "i"
172
+
173
+ # ?? => ij
174
+ "\u0133" => "ij"
175
+
176
+ # ?? => d
177
+ "\u00F0" => "d"
178
+
179
+ # ?? => n
180
+ "\u00F1" => "n"
181
+
182
+ # ?? => o
183
+ "\u00F2" => "o"
184
+
185
+ # ?? => o
186
+ "\u00F3" => "o"
187
+
188
+ # ?? => o
189
+ "\u00F4" => "o"
190
+
191
+ # ?? => o
192
+ "\u00F5" => "o"
193
+
194
+ # ?? => o
195
+ "\u00F6" => "o"
196
+
197
+ # ?? => o
198
+ "\u00F8" => "o"
199
+
200
+ # ?? => oe
201
+ "\u0153" => "oe"
202
+
203
+ # ?? => ss
204
+ "\u00DF" => "ss"
205
+
206
+ # ?? => th
207
+ "\u00FE" => "th"
208
+
209
+ # ?? => u
210
+ "\u00F9" => "u"
211
+
212
+ # ?? => u
213
+ "\u00FA" => "u"
214
+
215
+ # ?? => u
216
+ "\u00FB" => "u"
217
+
218
+ # ?? => u
219
+ "\u00FC" => "u"
220
+
221
+ # ?? => y
222
+ "\u00FD" => "y"
223
+
224
+ # ?? => y
225
+ "\u00FF" => "y"
226
+
227
+ # ??? => ff
228
+ "\uFB00" => "ff"
229
+
230
+ # ??? => fi
231
+ "\uFB01" => "fi"
232
+
233
+ # ??? => fl
234
+ "\uFB02" => "fl"
235
+
236
+ # ??? => ffi
237
+ "\uFB03" => "ffi"
238
+
239
+ # ??? => ffl
240
+ "\uFB04" => "ffl"
241
+
242
+ # ??? => ft
243
+ "\uFB05" => "ft"
244
+
245
+ # ??? => st
246
+ "\uFB06" => "st"
@@ -0,0 +1,21 @@
1
+ # The ASF licenses this file to You under the Apache License, Version 2.0
2
+ # (the "License"); you may not use this file except in compliance with
3
+ # the License. You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ #-----------------------------------------------------------------------
14
+ # Use a protected word file to protect against the stemmer reducing two
15
+ # unrelated words to the same base word.
16
+
17
+ # Some non-words that normally won't be encountered,
18
+ # just to test that they won't be stemmed.
19
+ dontstems
20
+ zwhacky
21
+