krikri 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/krikri/parser.rb +13 -0
  3. data/lib/krikri/parsers/json_parser.rb +9 -5
  4. data/lib/krikri/version.rb +1 -1
  5. data/spec/internal/Gemfile +44 -0
  6. data/spec/internal/Gemfile.lock +416 -0
  7. data/spec/internal/README.rdoc +28 -0
  8. data/spec/internal/Rakefile +6 -0
  9. data/spec/internal/app/assets/javascripts/application.js +19 -0
  10. data/spec/internal/app/assets/javascripts/blacklight_gallery.js +1 -0
  11. data/spec/internal/app/assets/javascripts/openseadragon.js +2 -0
  12. data/spec/internal/app/assets/stylesheets/application.css +15 -0
  13. data/spec/internal/app/assets/stylesheets/blacklight.css.scss +5 -0
  14. data/spec/internal/app/assets/stylesheets/blacklight_gallery.css.scss +3 -0
  15. data/spec/internal/app/assets/stylesheets/openseadragon.css +3 -0
  16. data/spec/internal/app/controllers/application_controller.rb +13 -0
  17. data/spec/internal/app/controllers/catalog_controller.rb +7 -0
  18. data/spec/internal/app/helpers/application_helper.rb +2 -0
  19. data/spec/internal/app/models/solr_document.rb +23 -0
  20. data/spec/internal/app/models/user.rb +10 -0
  21. data/spec/internal/app/views/layouts/application.html.erb +14 -0
  22. data/spec/internal/bin/bundle +3 -0
  23. data/spec/internal/bin/rails +4 -0
  24. data/spec/internal/bin/rake +4 -0
  25. data/spec/internal/config.ru +4 -0
  26. data/spec/internal/config/application.rb +23 -0
  27. data/spec/internal/config/boot.rb +4 -0
  28. data/spec/internal/config/database.yml +25 -0
  29. data/spec/internal/config/environment.rb +5 -0
  30. data/spec/internal/config/environments/development.rb +37 -0
  31. data/spec/internal/config/environments/production.rb +78 -0
  32. data/spec/internal/config/environments/test.rb +39 -0
  33. data/spec/internal/config/initializers/assets.rb +8 -0
  34. data/spec/internal/config/initializers/backtrace_silencers.rb +7 -0
  35. data/spec/internal/config/initializers/blacklight_initializer.rb +7 -0
  36. data/spec/internal/config/initializers/cookies_serializer.rb +3 -0
  37. data/spec/internal/config/initializers/devise.rb +259 -0
  38. data/spec/internal/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/spec/internal/config/initializers/inflections.rb +16 -0
  40. data/spec/internal/config/initializers/mime_types.rb +4 -0
  41. data/spec/internal/config/initializers/session_store.rb +3 -0
  42. data/spec/internal/config/initializers/wrap_parameters.rb +14 -0
  43. data/spec/internal/config/jetty.yml +7 -0
  44. data/spec/internal/config/locales/blacklight.en.yml +3 -0
  45. data/spec/internal/config/locales/devise.en.yml +60 -0
  46. data/spec/internal/config/locales/en.yml +23 -0
  47. data/spec/internal/config/routes.rb +60 -0
  48. data/spec/internal/config/secrets.yml +22 -0
  49. data/spec/internal/config/solr.yml +18 -0
  50. data/spec/internal/db/development.sqlite3 +0 -0
  51. data/spec/internal/db/migrate/20160909235528_devise_create_users.rb +42 -0
  52. data/spec/internal/db/migrate/20160909235614_create_searches.blacklight.rb +19 -0
  53. data/spec/internal/db/migrate/20160909235615_create_bookmarks.blacklight.rb +18 -0
  54. data/spec/internal/db/migrate/20160909235616_add_polymorphic_type_to_bookmarks.blacklight.rb +9 -0
  55. data/spec/internal/db/schema.rb +92 -0
  56. data/spec/internal/db/seeds.rb +7 -0
  57. data/spec/internal/db/test.sqlite3 +0 -0
  58. data/spec/internal/lib/generators/test_app_generator.rb +14 -0
  59. data/spec/internal/log/development.log +167 -0
  60. data/spec/internal/log/test.log +8681 -0
  61. data/spec/internal/public/404.html +67 -0
  62. data/spec/internal/public/422.html +67 -0
  63. data/spec/internal/public/500.html +66 -0
  64. data/spec/internal/public/favicon.ico +0 -0
  65. data/spec/internal/public/robots.txt +5 -0
  66. data/spec/internal/solr_conf/schema.xml +729 -0
  67. data/spec/internal/solr_conf/solrconfig.xml +160 -0
  68. data/spec/internal/test/factories/users.rb +6 -0
  69. data/spec/internal/test/models/user_test.rb +7 -0
  70. data/spec/internal/test/test_helper.rb +10 -0
  71. data/spec/lib/krikri/mapper_spec.rb +9 -0
  72. data/spec/lib/krikri/parser_value_array_spec.rb +16 -0
  73. metadata +134 -3
@@ -0,0 +1,160 @@
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
+ <!--
20
+ This is a stripped down config file used for a simple example...
21
+ It is *not* a good example to work from.
22
+ -->
23
+ <config>
24
+ <luceneMatchVersion>LUCENE_40</luceneMatchVersion>
25
+ <!-- The DirectoryFactory to use for indexes.
26
+ solr.StandardDirectoryFactory, the default, is filesystem based.
27
+ solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
28
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
29
+
30
+ <lib dir="../lib/contrib/analysis-extras/lib" />
31
+ <lib dir="../lib/contrib/analysis-extras/lucene-libs" />
32
+
33
+ <dataDir>${solr.blacklight-core.data.dir:}</dataDir>
34
+
35
+ <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
36
+
37
+ <requestDispatcher handleSelect="true" >
38
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
39
+ </requestDispatcher>
40
+
41
+ <requestHandler name="standard" class="solr.StandardRequestHandler" />
42
+ <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
43
+ <requestHandler name="/update" class="solr.UpdateRequestHandler" />
44
+ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
45
+
46
+ <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
47
+ <lst name="invariants">
48
+ <str name="q">solrpingquery</str>
49
+ </lst>
50
+ <lst name="defaults">
51
+ <str name="echoParams">all</str>
52
+ </lst>
53
+ </requestHandler>
54
+
55
+ <!-- config for the admin interface -->
56
+ <admin>
57
+ <defaultQuery>solr</defaultQuery>
58
+ </admin>
59
+
60
+ <!-- SearchHandler
61
+
62
+ http://wiki.apache.org/solr/SearchHandler
63
+
64
+ For processing Search Queries, the primary Request Handler
65
+ provided with Solr is "SearchHandler" It delegates to a sequent
66
+ of SearchComponents (see below) and supports distributed
67
+ queries across multiple shards
68
+ -->
69
+ <requestHandler name="search" class="solr.SearchHandler" default="true">
70
+ <!-- default values for query parameters can be specified, these
71
+ will be overridden by parameters in the request
72
+ -->
73
+ <lst name="defaults">
74
+ <str name="defType">dismax</str>
75
+ <str name="echoParams">explicit</str>
76
+ <int name="rows">10</int>
77
+
78
+ <str name="q.alt">*:*</str>
79
+ <str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
80
+
81
+ <!-- TODO: Configure qf and pf for better search results -->
82
+
83
+ <!-- this qf and pf are used by default, if not otherwise specified by
84
+ client. The default blacklight_config will use these for the
85
+ "keywords" search. See the author_qf/author_pf, title_qf, etc
86
+ below, which the default blacklight_config will specify for
87
+ those searches. You may also be interested in:
88
+ http://wiki.apache.org/solr/LocalParams
89
+ -->
90
+
91
+ <str name="qf">
92
+ dataProvider_providedLabel
93
+ sourceResource_collection_title
94
+ sourceResource_creator_providedLabel
95
+ sourceResource_date_providedLabel
96
+ sourceResource_description
97
+ sourceResource_format
98
+ sourceResource_rights
99
+ sourceResource_spatial_providedLabel
100
+ sourceResource_subject_providedLabel
101
+ sourceResource_title
102
+ sourceResource_type_name
103
+ text
104
+ </str>
105
+
106
+ <str name="pf">
107
+ dataProvider_providedLabel
108
+ sourceResource_collection_title
109
+ sourceResource_creator_providedLabel
110
+ sourceResource_date_providedLabel
111
+ sourceResource_description
112
+ sourceResource_format
113
+ sourceResource_rights
114
+ sourceResource_spatial_providedLabel
115
+ sourceResource_subject_providedLabel
116
+ sourceResource_title
117
+ sourceResource_type_name
118
+ text
119
+ </str>
120
+
121
+ <int name="ps">3</int>
122
+ <float name="tie">0.01</float>
123
+
124
+ <str name="fl">
125
+ id,
126
+ dataProvider_providedLabel,
127
+ preview_id,
128
+ sourceResource_collection_title,
129
+ sourceResource_creator_providedLabel,
130
+ sourceResource_date_providedLabel,
131
+ sourceResource_description,
132
+ sourceResource_format,
133
+ sourceResource_rights,
134
+ sourceResource_spatial_providedLabel,
135
+ sourceResource_subject_providedLabel,
136
+ sourceResource_title,
137
+ sourceResource_type_name
138
+ </str>
139
+
140
+ <str name="facet">true</str>
141
+ <str name="facet.mincount">1</str>
142
+ <str name="facet.limit">10</str>
143
+ <str name="facet.field">dataProvider_providedLabel</str>
144
+
145
+ </lst>
146
+
147
+ </requestHandler>
148
+
149
+ <!-- for requests to get a single document; use id=666 instead of q=id:666 -->
150
+ <requestHandler name="document" class="solr.SearchHandler" >
151
+ <lst name="defaults">
152
+ <str name="echoParams">all</str>
153
+ <str name="fl">*</str>
154
+ <str name="rows">1</str>
155
+ <str name="q">{!raw f=id v=$id}</str> <!-- use id=666 instead of q=id:666 -->
156
+ </lst>
157
+ </requestHandler>
158
+
159
+ </config>
160
+
@@ -0,0 +1,6 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :user do
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,10 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7
+ fixtures :all
8
+
9
+ # Add more helper methods to be used by all tests here...
10
+ end
@@ -25,6 +25,12 @@ describe Krikri::Mapper do
25
25
  providedLabel ident
26
26
  end
27
27
 
28
+ relation :class => DPLA::MAP::Agent,
29
+ :each => record.field_names,
30
+ :as => :rel do
31
+ providedLabel rel
32
+ end
33
+
28
34
  spatial :class => DPLA::MAP::Place,
29
35
  :each => %w('nyc bos pdx'),
30
36
  :as => :place do
@@ -62,6 +68,9 @@ describe Krikri::Mapper do
62
68
  .contributor.map(&:providedLabel).flatten)
63
69
  .to eq record.root['dc:creator'].to_a.map(&:value)
64
70
 
71
+ expect(mapped.sourceResource.first.relation.map(&:providedLabel).flatten)
72
+ .to contain_exactly(*record.root.children.uniq)
73
+
65
74
  expect(mapped.sourceResource.first.spatial.map(&:providedLabel).flatten)
66
75
  .to eq %w('nyc bos pdx')
67
76
 
@@ -254,6 +254,22 @@ describe Krikri::Parser::ValueArray do
254
254
  end
255
255
  end
256
256
 
257
+ describe '#field_names' do
258
+ include_context 'with fields'
259
+
260
+ let(:child_nodes) { ['first:child', 'second:child']}
261
+
262
+ before do
263
+ values.each do |val|
264
+ allow(val).to receive(:children).and_return(child_nodes)
265
+ end
266
+ end
267
+
268
+ it 'contains immediate child node field names' do
269
+ expect(subject.field_names).to contain_exactly(*child_nodes)
270
+ end
271
+ end
272
+
257
273
  describe '#first_value' do
258
274
  it 'returns a single item ValueArray without an arguments' do
259
275
  expect(subject.first_value).to contain_exactly values[0]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: krikri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Audrey Altman
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-08-22 00:00:00.000000000 Z
15
+ date: 2016-09-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -611,6 +611,72 @@ files:
611
611
  - spec/factories/krikri_users.rb
612
612
  - spec/helpers/krikri/application_helper_spec.rb
613
613
  - spec/helpers/krikri/records_helper_spec.rb
614
+ - spec/internal/Gemfile
615
+ - spec/internal/Gemfile.lock
616
+ - spec/internal/README.rdoc
617
+ - spec/internal/Rakefile
618
+ - spec/internal/app/assets/javascripts/application.js
619
+ - spec/internal/app/assets/javascripts/blacklight_gallery.js
620
+ - spec/internal/app/assets/javascripts/openseadragon.js
621
+ - spec/internal/app/assets/stylesheets/application.css
622
+ - spec/internal/app/assets/stylesheets/blacklight.css.scss
623
+ - spec/internal/app/assets/stylesheets/blacklight_gallery.css.scss
624
+ - spec/internal/app/assets/stylesheets/openseadragon.css
625
+ - spec/internal/app/controllers/application_controller.rb
626
+ - spec/internal/app/controllers/catalog_controller.rb
627
+ - spec/internal/app/helpers/application_helper.rb
628
+ - spec/internal/app/models/solr_document.rb
629
+ - spec/internal/app/models/user.rb
630
+ - spec/internal/app/views/layouts/application.html.erb
631
+ - spec/internal/bin/bundle
632
+ - spec/internal/bin/rails
633
+ - spec/internal/bin/rake
634
+ - spec/internal/config.ru
635
+ - spec/internal/config/application.rb
636
+ - spec/internal/config/boot.rb
637
+ - spec/internal/config/database.yml
638
+ - spec/internal/config/environment.rb
639
+ - spec/internal/config/environments/development.rb
640
+ - spec/internal/config/environments/production.rb
641
+ - spec/internal/config/environments/test.rb
642
+ - spec/internal/config/initializers/assets.rb
643
+ - spec/internal/config/initializers/backtrace_silencers.rb
644
+ - spec/internal/config/initializers/blacklight_initializer.rb
645
+ - spec/internal/config/initializers/cookies_serializer.rb
646
+ - spec/internal/config/initializers/devise.rb
647
+ - spec/internal/config/initializers/filter_parameter_logging.rb
648
+ - spec/internal/config/initializers/inflections.rb
649
+ - spec/internal/config/initializers/mime_types.rb
650
+ - spec/internal/config/initializers/session_store.rb
651
+ - spec/internal/config/initializers/wrap_parameters.rb
652
+ - spec/internal/config/jetty.yml
653
+ - spec/internal/config/locales/blacklight.en.yml
654
+ - spec/internal/config/locales/devise.en.yml
655
+ - spec/internal/config/locales/en.yml
656
+ - spec/internal/config/routes.rb
657
+ - spec/internal/config/secrets.yml
658
+ - spec/internal/config/solr.yml
659
+ - spec/internal/db/development.sqlite3
660
+ - spec/internal/db/migrate/20160909235528_devise_create_users.rb
661
+ - spec/internal/db/migrate/20160909235614_create_searches.blacklight.rb
662
+ - spec/internal/db/migrate/20160909235615_create_bookmarks.blacklight.rb
663
+ - spec/internal/db/migrate/20160909235616_add_polymorphic_type_to_bookmarks.blacklight.rb
664
+ - spec/internal/db/schema.rb
665
+ - spec/internal/db/seeds.rb
666
+ - spec/internal/db/test.sqlite3
667
+ - spec/internal/lib/generators/test_app_generator.rb
668
+ - spec/internal/log/development.log
669
+ - spec/internal/log/test.log
670
+ - spec/internal/public/404.html
671
+ - spec/internal/public/422.html
672
+ - spec/internal/public/500.html
673
+ - spec/internal/public/favicon.ico
674
+ - spec/internal/public/robots.txt
675
+ - spec/internal/solr_conf/schema.xml
676
+ - spec/internal/solr_conf/solrconfig.xml
677
+ - spec/internal/test/factories/users.rb
678
+ - spec/internal/test/models/user_test.rb
679
+ - spec/internal/test/test_helper.rb
614
680
  - spec/krikri_spec.rb
615
681
  - spec/ldp/resource_spec.rb
616
682
  - spec/lib/krikri/aggregation_entity_behavior_spec.rb
@@ -758,6 +824,72 @@ test_files:
758
824
  - spec/factories/krikri_users.rb
759
825
  - spec/helpers/krikri/application_helper_spec.rb
760
826
  - spec/helpers/krikri/records_helper_spec.rb
827
+ - spec/internal/app/assets/javascripts/application.js
828
+ - spec/internal/app/assets/javascripts/blacklight_gallery.js
829
+ - spec/internal/app/assets/javascripts/openseadragon.js
830
+ - spec/internal/app/assets/stylesheets/application.css
831
+ - spec/internal/app/assets/stylesheets/blacklight.css.scss
832
+ - spec/internal/app/assets/stylesheets/blacklight_gallery.css.scss
833
+ - spec/internal/app/assets/stylesheets/openseadragon.css
834
+ - spec/internal/app/controllers/application_controller.rb
835
+ - spec/internal/app/controllers/catalog_controller.rb
836
+ - spec/internal/app/helpers/application_helper.rb
837
+ - spec/internal/app/models/solr_document.rb
838
+ - spec/internal/app/models/user.rb
839
+ - spec/internal/app/views/layouts/application.html.erb
840
+ - spec/internal/bin/bundle
841
+ - spec/internal/bin/rails
842
+ - spec/internal/bin/rake
843
+ - spec/internal/config/application.rb
844
+ - spec/internal/config/boot.rb
845
+ - spec/internal/config/database.yml
846
+ - spec/internal/config/environment.rb
847
+ - spec/internal/config/environments/development.rb
848
+ - spec/internal/config/environments/production.rb
849
+ - spec/internal/config/environments/test.rb
850
+ - spec/internal/config/initializers/assets.rb
851
+ - spec/internal/config/initializers/backtrace_silencers.rb
852
+ - spec/internal/config/initializers/blacklight_initializer.rb
853
+ - spec/internal/config/initializers/cookies_serializer.rb
854
+ - spec/internal/config/initializers/devise.rb
855
+ - spec/internal/config/initializers/filter_parameter_logging.rb
856
+ - spec/internal/config/initializers/inflections.rb
857
+ - spec/internal/config/initializers/mime_types.rb
858
+ - spec/internal/config/initializers/session_store.rb
859
+ - spec/internal/config/initializers/wrap_parameters.rb
860
+ - spec/internal/config/jetty.yml
861
+ - spec/internal/config/locales/blacklight.en.yml
862
+ - spec/internal/config/locales/devise.en.yml
863
+ - spec/internal/config/locales/en.yml
864
+ - spec/internal/config/routes.rb
865
+ - spec/internal/config/secrets.yml
866
+ - spec/internal/config/solr.yml
867
+ - spec/internal/config.ru
868
+ - spec/internal/db/development.sqlite3
869
+ - spec/internal/db/migrate/20160909235528_devise_create_users.rb
870
+ - spec/internal/db/migrate/20160909235614_create_searches.blacklight.rb
871
+ - spec/internal/db/migrate/20160909235615_create_bookmarks.blacklight.rb
872
+ - spec/internal/db/migrate/20160909235616_add_polymorphic_type_to_bookmarks.blacklight.rb
873
+ - spec/internal/db/schema.rb
874
+ - spec/internal/db/seeds.rb
875
+ - spec/internal/db/test.sqlite3
876
+ - spec/internal/Gemfile
877
+ - spec/internal/Gemfile.lock
878
+ - spec/internal/lib/generators/test_app_generator.rb
879
+ - spec/internal/log/development.log
880
+ - spec/internal/log/test.log
881
+ - spec/internal/public/404.html
882
+ - spec/internal/public/422.html
883
+ - spec/internal/public/500.html
884
+ - spec/internal/public/favicon.ico
885
+ - spec/internal/public/robots.txt
886
+ - spec/internal/Rakefile
887
+ - spec/internal/README.rdoc
888
+ - spec/internal/solr_conf/schema.xml
889
+ - spec/internal/solr_conf/solrconfig.xml
890
+ - spec/internal/test/factories/users.rb
891
+ - spec/internal/test/models/user_test.rb
892
+ - spec/internal/test/test_helper.rb
761
893
  - spec/krikri_spec.rb
762
894
  - spec/ldp/resource_spec.rb
763
895
  - spec/lib/krikri/aggregation_entity_behavior_spec.rb
@@ -862,4 +994,3 @@ test_files:
862
994
  - spec/views/krikri/records/index.html.erb_spec.rb
863
995
  - spec/views/krikri/records/show.html.erb_spec.rb
864
996
  - spec/views/krikri/reports/index.html.erb_spec.rb
865
- has_rdoc: