activefedora-aggregation 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 031bef619d22d1ec3213adf373c87d88cdf8d3fe
4
- data.tar.gz: 5bca5027dfaba99cd2fd5cd12bd88d652011351b
3
+ metadata.gz: 1bb8da4f1630029337549d9975113e80a7882d7a
4
+ data.tar.gz: da0dc596fba4be563217e0eba4b066c9230bfdae
5
5
  SHA512:
6
- metadata.gz: 1c364682160e0e65964868af415481c339a48930f69a0f579b432ece3bdecc0c2d264976bff1686a05a23ab885e2ab04ce98a2c9a7ed58893d00640ee89b7625
7
- data.tar.gz: cecb2ee08d6d81d7f641ca0f7f3e204926e699ef57f3c31a909551889c574aed667df3de25984762768e8db508bdeb4708f802e9cc91d00f3b6665b3da5d468a
6
+ metadata.gz: a1760935368d3699da0320d8e768f653ca31434f59df34d7e5a6377d0994b38adfc02d101839e31219f21fc83263164a705b63acc24efc8a9d6e4286e999f280
7
+ data.tar.gz: 8a6e54cb29ba1821be04b8d4c9f63684a8133bcce86fd3182a81b0c3e89691e40e16888a85b934b257f38f12d74e65b50d75d717708271b8f86280a473c4b21b
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
  /tmp/
10
10
  /jetty
11
11
  logfile.log
12
+ fcrepo4-data/
13
+ fcrepo4-test-data/
data/Gemfile CHANGED
@@ -3,4 +3,3 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in activefedora-aggregation.gemspec
4
4
  gemspec
5
5
  gem 'byebug' unless ENV['CI']
6
- gem 'active-fedora', github: "projecthydra/active_fedora"
data/README.md CHANGED
@@ -15,7 +15,7 @@ end
15
15
 
16
16
  generic_file1 = GenericFile.create(id: 'file1')
17
17
  generic_file2 = GenericFile.create(id: 'file2')
18
- generic_file3 = GenericFile.create(id: 'file2')
18
+ generic_file3 = GenericFile.create(id: 'file3')
19
19
 
20
20
  class Image < ActiveFedora::Base
21
21
  ordered_aggregation :generic_files, through: :list_source
@@ -25,20 +25,21 @@ image = Image.create(id: 'my_image')
25
25
  image.ordered_generic_file_proxies.append_target generic_file2
26
26
  image.ordered_generic_file_proxies.append_target generic_file1
27
27
  image.save
28
- image.generic_files # => [generic_file2, generic_file]
29
- image.ordered_generic_files # => [generic_file2, generic_file]
28
+ image.generic_files # => [#<GenericFile id: "file2">, #<GenericFile id: "file1">]
29
+ image.ordered_generic_files.to_a # => [#<GenericFile id: "file2">, #<GenericFile id: "file1">]
30
30
 
31
31
  # Not all generic files must be ordered.
32
32
  image.generic_files += [generic_file3]
33
- image.generic_files # => [generic_file2, generic_file, generic_file3]
34
- image.ordered_generic_files # => [generic_file2, generic_file]
33
+ image.generic_files => [#<GenericFile id: "file2">, #<GenericFile id: "file1">, #<GenericFile id: "file3">]
34
+ image.ordered_generic_files.to_a => [#<GenericFile id: "file2">, #<GenericFile id: "file1">]
35
35
 
36
36
  # non-ordered accessor is not ordered.
37
- image.ordered_generic_file_proxies.insert_at(0, generic_file3)
38
- image.generic_files # => [generic_file2, generic_file, generic_file3]
39
- image.ordered_generic_files # => [generic_file3, generic_file2, generic_file]
37
+ image.ordered_generic_file_proxies.insert_target_at(0, generic_file3)
38
+ image.generic_files # => [#<GenericFile id: "file2">, #<GenericFile id: "file1">, #<GenericFile id: "file3">]
39
+ image.ordered_generic_files.to_a # => [#<GenericFile id: "file3">, #<GenericFile id: "file2">, #<GenericFile id: "file1">]
40
40
 
41
41
  # Deletions
42
- image.ordered_generic_file_proxies.delete_at(1)
43
- image.ordered_generic_files # => [generic_file3, generic_file]
42
+ image.ordered_generic_file_proxies.delete_at(1) => #<GenericFile id: "file2">
43
+ image.ordered_generic_files.to_a # => [#<GenericFile id: "file3">, #<GenericFile id: "file1">]
44
+ image.generic_files # => [#<GenericFile id: "file2">, #<GenericFile id: "file1">, #<GenericFile id: "file3">]
44
45
  ```
data/Rakefile CHANGED
@@ -3,21 +3,18 @@ require "bundler/gem_tasks"
3
3
 
4
4
  require 'rspec/core'
5
5
  require 'rspec/core/rake_task'
6
- RSpec::Core::RakeTask.new(:spec)
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.rspec_opts = '--backtrace'
8
+ end
7
9
 
8
- require 'jettywrapper'
9
- Jettywrapper.hydra_jetty_version = "v8.3.1"
10
+ require 'solr_wrapper/rake_task'
11
+ require 'fcrepo_wrapper'
12
+ require 'active_fedora/rake_support'
10
13
 
11
- desc 'Spin up hydra-jetty and run specs'
12
- task ci: ['jetty:clean'] do
13
- puts 'running continuous integration'
14
- jetty_params = Jettywrapper.load_config
15
- jetty_params[:startup_wait]= 90
16
- error = Jettywrapper.wrap(jetty_params) do
14
+ desc 'Start Fedora and Solr and run specs'
15
+ task :ci do
16
+ with_test_server do
17
17
  Rake::Task['spec'].invoke
18
18
  end
19
- raise "test failures: #{error}" if error
20
19
  end
21
-
22
-
23
20
  task default: :ci
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_dependency 'activesupport'
20
- spec.add_dependency 'active-fedora', '~> 9.5'
20
+ spec.add_dependency 'active-fedora', '~> 9.9.0'
21
21
  spec.add_dependency 'rdf-vocab', '~> 0.8.1'
22
22
  # Avoid RDF 1.1.17 because of a bug from ruby 2.2
23
23
  # https://github.com/ruby-rdf/rdf/pull/213
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "bundler", "~> 1.8"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "rspec", "~> 3.2"
29
- spec.add_development_dependency "jettywrapper"
30
29
  spec.add_development_dependency "pry-byebug"
30
+ spec.add_development_dependency "solr_wrapper", "~> 0.4"
31
+ spec.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
31
32
  end
data/circle.yml CHANGED
@@ -1,11 +1,11 @@
1
1
  machine:
2
2
  ruby:
3
3
  version: 2.2.0
4
+ java:
5
+ version: oraclejdk8
4
6
  dependencies:
5
7
  pre:
6
8
  - gem install bundler
7
- post:
8
- - bundle exec rake jetty:clean
9
- - cd jetty && java -Djetty.port=8983 -Dsolr.solr.home=/home/ubuntu/activefedora-aggregation/jetty/solr -XX:MaxPermSize=128m -Xmx256m -jar start.jar:
10
- background: true
11
- - bin/jetty_wait
9
+ test:
10
+ override:
11
+ - bundle exec rake
@@ -1,5 +1,5 @@
1
1
  module ActiveFedora
2
2
  module Aggregation
3
- VERSION = "0.8.1"
3
+ VERSION = "0.9.0"
4
4
  end
5
5
  end
@@ -22,10 +22,35 @@ module ActiveFedora::Orders
22
22
  super
23
23
  end
24
24
 
25
+ module FixFirstLast
26
+ def save(*args)
27
+ super.tap do |result|
28
+ if result
29
+ apply_first_and_last
30
+ end
31
+ end
32
+ end
33
+ def save!(*args)
34
+ super.tap do |result|
35
+ if result
36
+ apply_first_and_last
37
+ end
38
+ end
39
+ end
40
+ end
41
+
25
42
  def build
26
- super.tap do
43
+ super.tap do |result|
27
44
  model.property :head, predicate: ::RDF::Vocab::IANA['first']
28
45
  model.property :tail, predicate: ::RDF::Vocab::IANA.last
46
+ model.send(:define_method, :apply_first_and_last) do
47
+ source = send(result.options[:through])
48
+ return if head.map(&:rdf_subject) == source.head_id && tail.map(&:rdf_subject) == source.tail_id
49
+ self.head = source.head_id
50
+ self.tail = source.tail_id
51
+ save! if changed?
52
+ end
53
+ model.include ActiveFedora::Orders::Builder::FixFirstLast
29
54
  end
30
55
  end
31
56
 
@@ -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"