arclight 0.0.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. checksums.yaml +5 -5
  2. data/.all-contributorsrc +450 -0
  3. data/.codeclimate.yml +5 -0
  4. data/.eslintrc +22 -0
  5. data/.github/workflows/ruby.yml +51 -0
  6. data/.gitignore +7 -0
  7. data/.rspec +0 -1
  8. data/.rubocop.yml +521 -0
  9. data/.rubocop_todo.yml +122 -0
  10. data/.solr_wrapper +6 -0
  11. data/CONTRIBUTING.md +43 -0
  12. data/CONTRIBUTORS.md +79 -0
  13. data/Gemfile +41 -0
  14. data/LICENSE.txt +1 -0
  15. data/README.md +100 -12
  16. data/Rakefile +13 -3
  17. data/app/assets/images/arclight/logo.png +0 -0
  18. data/app/assets/images/blacklight/bookmark.svg +1 -0
  19. data/app/assets/images/blacklight/collection.svg +5 -0
  20. data/app/assets/images/blacklight/compact.svg +1 -0
  21. data/app/assets/images/blacklight/container.svg +5 -0
  22. data/app/assets/images/blacklight/ead.svg +1 -0
  23. data/app/assets/images/blacklight/file.svg +5 -0
  24. data/app/assets/images/blacklight/folder.svg +1 -0
  25. data/app/assets/images/blacklight/list.svg +1 -0
  26. data/app/assets/images/blacklight/minus.svg +1 -0
  27. data/app/assets/images/blacklight/online.svg +5 -0
  28. data/app/assets/images/blacklight/pdf.svg +1 -0
  29. data/app/assets/images/blacklight/plus.svg +1 -0
  30. data/app/assets/images/blacklight/repository.svg +1 -0
  31. data/app/assets/javascripts/arclight/arclight.js +4 -0
  32. data/app/assets/javascripts/arclight/oembed_controller.js +58 -0
  33. data/app/assets/javascripts/arclight/truncate_controller.js +27 -0
  34. data/app/assets/stylesheets/arclight/application.scss +14 -0
  35. data/app/assets/stylesheets/arclight/build.scss +4 -0
  36. data/app/assets/stylesheets/arclight/modules/collection_search.scss +3 -0
  37. data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +155 -0
  38. data/app/assets/stylesheets/arclight/modules/highlights.scss +11 -0
  39. data/app/assets/stylesheets/arclight/modules/icons.scss +20 -0
  40. data/app/assets/stylesheets/arclight/modules/layout.scss +220 -0
  41. data/app/assets/stylesheets/arclight/modules/mastheads.scss +42 -0
  42. data/app/assets/stylesheets/arclight/modules/repositories.scss +25 -0
  43. data/app/assets/stylesheets/arclight/modules/repository_card.scss +9 -0
  44. data/app/assets/stylesheets/arclight/modules/search_form.scss +9 -0
  45. data/app/assets/stylesheets/arclight/modules/search_results.scss +250 -0
  46. data/app/assets/stylesheets/arclight/modules/show_collection.scss +38 -0
  47. data/app/assets/stylesheets/arclight/modules/truncator.scss +58 -0
  48. data/app/assets/stylesheets/arclight/responsive.scss +13 -0
  49. data/app/assets/stylesheets/arclight/variables.scss +25 -0
  50. data/app/components/arclight/access_component.html.erb +14 -0
  51. data/app/components/arclight/access_component.rb +25 -0
  52. data/app/components/arclight/bookmark_component.html.erb +25 -0
  53. data/app/components/arclight/bookmark_component.rb +9 -0
  54. data/app/components/arclight/breadcrumb_component.rb +50 -0
  55. data/app/components/arclight/breadcrumbs_hierarchy_component.html.erb +34 -0
  56. data/app/components/arclight/breadcrumbs_hierarchy_component.rb +25 -0
  57. data/app/components/arclight/collection_context_component.html.erb +12 -0
  58. data/app/components/arclight/collection_context_component.rb +27 -0
  59. data/app/components/arclight/collection_info_component.html.erb +28 -0
  60. data/app/components/arclight/collection_info_component.rb +26 -0
  61. data/app/components/arclight/collection_sidebar_component.html.erb +15 -0
  62. data/app/components/arclight/collection_sidebar_component.rb +39 -0
  63. data/app/components/arclight/constraints_component.html.erb +7 -0
  64. data/app/components/arclight/constraints_component.rb +17 -0
  65. data/app/components/arclight/document_collection_context_component.html.erb +29 -0
  66. data/app/components/arclight/document_collection_context_component.rb +28 -0
  67. data/app/components/arclight/document_collection_hierarchy_component.html.erb +50 -0
  68. data/app/components/arclight/document_collection_hierarchy_component.rb +62 -0
  69. data/app/components/arclight/document_component.html.erb +39 -0
  70. data/app/components/arclight/document_component.rb +49 -0
  71. data/app/components/arclight/document_components_hierarchy_component.html.erb +20 -0
  72. data/app/components/arclight/document_components_hierarchy_component.rb +34 -0
  73. data/app/components/arclight/document_download_component.html.erb +24 -0
  74. data/app/components/arclight/document_download_component.rb +71 -0
  75. data/app/components/arclight/embed_component.html.erb +10 -0
  76. data/app/components/arclight/embed_component.rb +43 -0
  77. data/app/components/arclight/expand_hierarchy_button_component.html.erb +5 -0
  78. data/app/components/arclight/expand_hierarchy_button_component.rb +16 -0
  79. data/app/components/arclight/group_component.html.erb +34 -0
  80. data/app/components/arclight/group_component.rb +23 -0
  81. data/app/components/arclight/header_component.html.erb +5 -0
  82. data/app/components/arclight/header_component.rb +10 -0
  83. data/app/components/arclight/index_metadata_field_component.html.erb +16 -0
  84. data/app/components/arclight/index_metadata_field_component.rb +20 -0
  85. data/app/components/arclight/masthead_component.html.erb +17 -0
  86. data/app/components/arclight/masthead_component.rb +10 -0
  87. data/app/components/arclight/metadata_section_component.html.erb +13 -0
  88. data/app/components/arclight/metadata_section_component.rb +22 -0
  89. data/app/components/arclight/oembed_viewer_component.html.erb +5 -0
  90. data/app/components/arclight/oembed_viewer_component.rb +16 -0
  91. data/app/components/arclight/online_content_filter_component.html.erb +15 -0
  92. data/app/components/arclight/online_content_filter_component.rb +17 -0
  93. data/app/components/arclight/online_status_indicator_component.rb +19 -0
  94. data/app/components/arclight/repository_breadcrumb_component.html.erb +10 -0
  95. data/app/components/arclight/repository_breadcrumb_component.rb +17 -0
  96. data/app/components/arclight/repository_location_component.html.erb +20 -0
  97. data/app/components/arclight/repository_location_component.rb +10 -0
  98. data/app/components/arclight/search_bar_component.html.erb +27 -0
  99. data/app/components/arclight/search_bar_component.rb +32 -0
  100. data/app/components/arclight/search_result_breadcrumbs_component.html.erb +6 -0
  101. data/app/components/arclight/search_result_breadcrumbs_component.rb +37 -0
  102. data/app/components/arclight/search_result_component.html.erb +20 -0
  103. data/app/components/arclight/search_result_component.rb +18 -0
  104. data/app/components/arclight/search_result_title_component.html.erb +15 -0
  105. data/app/components/arclight/search_result_title_component.rb +15 -0
  106. data/app/components/arclight/sidebar_component.html.erb +9 -0
  107. data/app/components/arclight/sidebar_component.rb +19 -0
  108. data/app/components/arclight/upper_metadata_layout_component.rb +10 -0
  109. data/app/components/blacklight/icons/bookmark_component.rb +12 -0
  110. data/app/components/blacklight/icons/collection_component.rb +14 -0
  111. data/app/components/blacklight/icons/compact_component.rb +12 -0
  112. data/app/components/blacklight/icons/container_component.rb +14 -0
  113. data/app/components/blacklight/icons/ead_component.rb +12 -0
  114. data/app/components/blacklight/icons/file_component.rb +14 -0
  115. data/app/components/blacklight/icons/folder_component.rb +12 -0
  116. data/app/components/blacklight/icons/online_component.rb +15 -0
  117. data/app/components/blacklight/icons/pdf_component.rb +12 -0
  118. data/app/components/blacklight/icons/repository_component.rb +12 -0
  119. data/app/controllers/arclight/repositories_controller.rb +40 -0
  120. data/app/helpers/arclight/ead_format_helpers.rb +309 -0
  121. data/app/helpers/arclight/field_config_helpers.rb +26 -0
  122. data/app/helpers/arclight_helper.rb +108 -0
  123. data/app/models/arclight/document_downloads.rb +122 -0
  124. data/app/models/arclight/parent.rb +24 -0
  125. data/app/models/arclight/parents.rb +39 -0
  126. data/app/models/arclight/requests/aeon_external_request.rb +42 -0
  127. data/app/models/arclight/requests/aeon_web_ead.rb +52 -0
  128. data/app/models/arclight/requests/google_form.rb +49 -0
  129. data/app/models/concerns/arclight/catalog.rb +44 -0
  130. data/app/models/concerns/arclight/search_behavior.rb +47 -0
  131. data/app/models/concerns/arclight/solr_document.rb +160 -0
  132. data/app/presenters/arclight/index_presenter.rb +10 -0
  133. data/app/presenters/arclight/show_presenter.rb +54 -0
  134. data/app/views/arclight/.keep +0 -0
  135. data/app/views/arclight/_requests.html.erb +7 -0
  136. data/app/views/arclight/repositories/_repository.html.erb +43 -0
  137. data/app/views/arclight/repositories/index.html.erb +9 -0
  138. data/app/views/arclight/repositories/show.html.erb +37 -0
  139. data/app/views/arclight/requests/_aeon_external_request_endpoint.html.erb +8 -0
  140. data/app/views/arclight/requests/_aeon_web_ead.html.erb +6 -0
  141. data/app/views/arclight/requests/_google_form.html.erb +10 -0
  142. data/app/views/catalog/_document_list.html.erb +8 -0
  143. data/app/views/catalog/_group.html.erb +4 -0
  144. data/app/views/catalog/_group_toggle.html.erb +10 -0
  145. data/app/views/catalog/_search_results_header.html.erb +3 -0
  146. data/app/views/catalog/hierarchy.html.erb +19 -0
  147. data/app/views/catalog/index.html.erb +17 -0
  148. data/app/views/shared/_breadcrumbs.html.erb +3 -0
  149. data/app/views/shared/_main_menu_links.html.erb +6 -0
  150. data/arclight.gemspec +29 -11
  151. data/bin/rails +13 -0
  152. data/config/breadcrumbs.rb +24 -0
  153. data/config/i18n-tasks.yml +134 -0
  154. data/config/importmap.rb +3 -0
  155. data/config/locales/arclight.en.yml +100 -0
  156. data/config/repositories.yml +0 -0
  157. data/config/routes.rb +6 -0
  158. data/docker-compose.yml +16 -0
  159. data/lib/arclight/digital_object.rb +27 -0
  160. data/lib/arclight/engine.rb +47 -0
  161. data/lib/arclight/exceptions.rb +19 -0
  162. data/lib/arclight/hash_absolute_xpath.rb +62 -0
  163. data/lib/arclight/level_label.rb +46 -0
  164. data/lib/arclight/missing_id_strategy.rb +21 -0
  165. data/lib/arclight/normalized_date.rb +49 -0
  166. data/lib/arclight/normalized_id.rb +30 -0
  167. data/lib/arclight/normalized_title.rb +33 -0
  168. data/lib/arclight/repository.rb +116 -0
  169. data/lib/arclight/routes/hierarchy.rb +19 -0
  170. data/lib/arclight/routes.rb +8 -0
  171. data/lib/arclight/traject/ead2_component_config.rb +335 -0
  172. data/lib/arclight/traject/ead2_config.rb +316 -0
  173. data/lib/arclight/traject/nokogiri_namespaceless_reader.rb +22 -0
  174. data/lib/arclight/version.rb +3 -1
  175. data/lib/arclight/year_range.rb +111 -0
  176. data/lib/arclight.rb +11 -1
  177. data/lib/generators/arclight/install_generator.rb +163 -0
  178. data/lib/generators/arclight/templates/arclight.scss +6 -0
  179. data/lib/generators/arclight/templates/catalog_controller.rb +423 -0
  180. data/lib/generators/arclight/templates/config/downloads.yml +25 -0
  181. data/lib/generators/arclight/templates/config/locales/arclight.en.yml +61 -0
  182. data/lib/generators/arclight/templates/config/repositories.yml +53 -0
  183. data/lib/generators/arclight/update_generator.rb +22 -0
  184. data/lib/tasks/index.rake +84 -0
  185. data/package.json +30 -0
  186. data/solr/conf/_rest_managed.json +3 -0
  187. data/solr/conf/admin-extra.html +31 -0
  188. data/solr/conf/elevate.xml +36 -0
  189. data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  190. data/solr/conf/protwords.txt +21 -0
  191. data/solr/conf/schema.xml +400 -0
  192. data/solr/conf/solrconfig.xml +328 -0
  193. data/solr/conf/spellings.txt +2 -0
  194. data/solr/conf/stopwords.txt +58 -0
  195. data/solr/conf/stopwords_en.txt +58 -0
  196. data/solr/conf/synonyms.txt +31 -0
  197. data/solr/conf/xslt/example.xsl +132 -0
  198. data/solr/conf/xslt/example_atom.xsl +67 -0
  199. data/solr/conf/xslt/example_rss.xsl +66 -0
  200. data/solr/conf/xslt/luke.xsl +337 -0
  201. data/tasks/arclight.rake +79 -0
  202. data/template.rb +10 -0
  203. metadata +440 -20
  204. data/.travis.yml +0 -5
@@ -0,0 +1,66 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+
3
+ <!--
4
+ * Licensed to the Apache Software Foundation (ASF) under one or more
5
+ * contributor license agreements. See the NOTICE file distributed with
6
+ * this work for additional information regarding copyright ownership.
7
+ * The ASF licenses this file to You under the Apache License, Version 2.0
8
+ * (the "License"); you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ -->
19
+
20
+ <!--
21
+ Simple transform of Solr query results to RSS
22
+ -->
23
+
24
+ <xsl:stylesheet version='1.0'
25
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
26
+
27
+ <xsl:output
28
+ method="xml"
29
+ encoding="utf-8"
30
+ media-type="text/xml; charset=UTF-8"
31
+ />
32
+ <xsl:template match='/'>
33
+ <rss version="2.0">
34
+ <channel>
35
+ <title>Example Solr RSS 2.0 Feed</title>
36
+ <link>http://localhost:8983/solr</link>
37
+ <description>
38
+ This has been formatted by the sample "example_rss.xsl" transform -
39
+ use your own XSLT to get a nicer RSS feed.
40
+ </description>
41
+ <language>en-us</language>
42
+ <docs>http://localhost:8983/solr</docs>
43
+ <xsl:apply-templates select="response/result/doc"/>
44
+ </channel>
45
+ </rss>
46
+ </xsl:template>
47
+
48
+ <!-- search results xslt -->
49
+ <xsl:template match="doc">
50
+ <xsl:variable name="id" select="str[@name='id']"/>
51
+ <xsl:variable name="timestamp" select="date[@name='timestamp']"/>
52
+ <item>
53
+ <title><xsl:value-of select="str[@name='name']"/></title>
54
+ <link>
55
+ http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
56
+ </link>
57
+ <description>
58
+ <xsl:value-of select="arr[@name='features']"/>
59
+ </description>
60
+ <pubDate><xsl:value-of select="$timestamp"/></pubDate>
61
+ <guid>
62
+ http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
63
+ </guid>
64
+ </item>
65
+ </xsl:template>
66
+ </xsl:stylesheet>
@@ -0,0 +1,337 @@
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
+ <!--
21
+ Display the luke request handler with graphs
22
+ -->
23
+ <xsl:stylesheet
24
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
25
+ xmlns="http://www.w3.org/1999/xhtml"
26
+ version="1.0"
27
+ >
28
+ <xsl:output
29
+ method="html"
30
+ encoding="UTF-8"
31
+ media-type="text/html; charset=UTF-8"
32
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
33
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
34
+ />
35
+
36
+ <xsl:variable name="title">Solr Luke Request Handler Response</xsl:variable>
37
+
38
+ <xsl:template match="/">
39
+ <html xmlns="http://www.w3.org/1999/xhtml">
40
+ <head>
41
+ <link rel="stylesheet" type="text/css" href="solr-admin.css"/>
42
+ <link rel="icon" href="favicon.ico" type="image/ico"/>
43
+ <link rel="shortcut icon" href="favicon.ico" type="image/ico"/>
44
+ <title>
45
+ <xsl:value-of select="$title"/>
46
+ </title>
47
+ <xsl:call-template name="css"/>
48
+
49
+ </head>
50
+ <body>
51
+ <h1>
52
+ <xsl:value-of select="$title"/>
53
+ </h1>
54
+ <div class="doc">
55
+ <ul>
56
+ <xsl:if test="response/lst[@name='index']">
57
+ <li>
58
+ <a href="#index">Index Statistics</a>
59
+ </li>
60
+ </xsl:if>
61
+ <xsl:if test="response/lst[@name='fields']">
62
+ <li>
63
+ <a href="#fields">Field Statistics</a>
64
+ <ul>
65
+ <xsl:for-each select="response/lst[@name='fields']/lst">
66
+ <li>
67
+ <a href="#{@name}">
68
+ <xsl:value-of select="@name"/>
69
+ </a>
70
+ </li>
71
+ </xsl:for-each>
72
+ </ul>
73
+ </li>
74
+ </xsl:if>
75
+ <xsl:if test="response/lst[@name='doc']">
76
+ <li>
77
+ <a href="#doc">Document statistics</a>
78
+ </li>
79
+ </xsl:if>
80
+ </ul>
81
+ </div>
82
+ <xsl:if test="response/lst[@name='index']">
83
+ <h2><a name="index"/>Index Statistics</h2>
84
+ <xsl:apply-templates select="response/lst[@name='index']"/>
85
+ </xsl:if>
86
+ <xsl:if test="response/lst[@name='fields']">
87
+ <h2><a name="fields"/>Field Statistics</h2>
88
+ <xsl:apply-templates select="response/lst[@name='fields']"/>
89
+ </xsl:if>
90
+ <xsl:if test="response/lst[@name='doc']">
91
+ <h2><a name="doc"/>Document statistics</h2>
92
+ <xsl:apply-templates select="response/lst[@name='doc']"/>
93
+ </xsl:if>
94
+ </body>
95
+ </html>
96
+ </xsl:template>
97
+
98
+ <xsl:template match="lst">
99
+ <xsl:if test="parent::lst">
100
+ <tr>
101
+ <td colspan="2">
102
+ <div class="doc">
103
+ <xsl:call-template name="list"/>
104
+ </div>
105
+ </td>
106
+ </tr>
107
+ </xsl:if>
108
+ <xsl:if test="not(parent::lst)">
109
+ <div class="doc">
110
+ <xsl:call-template name="list"/>
111
+ </div>
112
+ </xsl:if>
113
+ </xsl:template>
114
+
115
+ <xsl:template name="list">
116
+ <xsl:if test="count(child::*)>0">
117
+ <table>
118
+ <thead>
119
+ <tr>
120
+ <th colspan="2">
121
+ <p>
122
+ <a name="{@name}"/>
123
+ </p>
124
+ <xsl:value-of select="@name"/>
125
+ </th>
126
+ </tr>
127
+ </thead>
128
+ <tbody>
129
+ <xsl:choose>
130
+ <xsl:when
131
+ test="@name='histogram'">
132
+ <tr>
133
+ <td colspan="2">
134
+ <xsl:call-template name="histogram"/>
135
+ </td>
136
+ </tr>
137
+ </xsl:when>
138
+ <xsl:otherwise>
139
+ <xsl:apply-templates/>
140
+ </xsl:otherwise>
141
+ </xsl:choose>
142
+ </tbody>
143
+ </table>
144
+ </xsl:if>
145
+ </xsl:template>
146
+
147
+ <xsl:template name="histogram">
148
+ <div class="doc">
149
+ <xsl:call-template name="barchart">
150
+ <xsl:with-param name="max_bar_width">50</xsl:with-param>
151
+ <xsl:with-param name="iwidth">800</xsl:with-param>
152
+ <xsl:with-param name="iheight">160</xsl:with-param>
153
+ <xsl:with-param name="fill">blue</xsl:with-param>
154
+ </xsl:call-template>
155
+ </div>
156
+ </xsl:template>
157
+
158
+ <xsl:template name="barchart">
159
+ <xsl:param name="max_bar_width"/>
160
+ <xsl:param name="iwidth"/>
161
+ <xsl:param name="iheight"/>
162
+ <xsl:param name="fill"/>
163
+ <xsl:variable name="max">
164
+ <xsl:for-each select="int">
165
+ <xsl:sort data-type="number" order="descending"/>
166
+ <xsl:if test="position()=1">
167
+ <xsl:value-of select="."/>
168
+ </xsl:if>
169
+ </xsl:for-each>
170
+ </xsl:variable>
171
+ <xsl:variable name="bars">
172
+ <xsl:value-of select="count(int)"/>
173
+ </xsl:variable>
174
+ <xsl:variable name="bar_width">
175
+ <xsl:choose>
176
+ <xsl:when test="$max_bar_width &lt; ($iwidth div $bars)">
177
+ <xsl:value-of select="$max_bar_width"/>
178
+ </xsl:when>
179
+ <xsl:otherwise>
180
+ <xsl:value-of select="$iwidth div $bars"/>
181
+ </xsl:otherwise>
182
+ </xsl:choose>
183
+ </xsl:variable>
184
+ <table class="histogram">
185
+ <tbody>
186
+ <tr>
187
+ <xsl:for-each select="int">
188
+ <td>
189
+ <xsl:value-of select="."/>
190
+ <div class="histogram">
191
+ <xsl:attribute name="style">background-color: <xsl:value-of select="$fill"/>; width: <xsl:value-of select="$bar_width"/>px; height: <xsl:value-of select="($iheight*number(.)) div $max"/>px;</xsl:attribute>
192
+ </div>
193
+ </td>
194
+ </xsl:for-each>
195
+ </tr>
196
+ <tr>
197
+ <xsl:for-each select="int">
198
+ <td>
199
+ <xsl:value-of select="@name"/>
200
+ </td>
201
+ </xsl:for-each>
202
+ </tr>
203
+ </tbody>
204
+ </table>
205
+ </xsl:template>
206
+
207
+ <xsl:template name="keyvalue">
208
+ <xsl:choose>
209
+ <xsl:when test="@name">
210
+ <tr>
211
+ <td class="name">
212
+ <xsl:value-of select="@name"/>
213
+ </td>
214
+ <td class="value">
215
+ <xsl:value-of select="."/>
216
+ </td>
217
+ </tr>
218
+ </xsl:when>
219
+ <xsl:otherwise>
220
+ <xsl:value-of select="."/>
221
+ </xsl:otherwise>
222
+ </xsl:choose>
223
+ </xsl:template>
224
+
225
+ <xsl:template match="int|bool|long|float|double|uuid|date">
226
+ <xsl:call-template name="keyvalue"/>
227
+ </xsl:template>
228
+
229
+ <xsl:template match="arr">
230
+ <tr>
231
+ <td class="name">
232
+ <xsl:value-of select="@name"/>
233
+ </td>
234
+ <td class="value">
235
+ <ul>
236
+ <xsl:for-each select="child::*">
237
+ <li>
238
+ <xsl:apply-templates/>
239
+ </li>
240
+ </xsl:for-each>
241
+ </ul>
242
+ </td>
243
+ </tr>
244
+ </xsl:template>
245
+
246
+ <xsl:template match="str">
247
+ <xsl:choose>
248
+ <xsl:when test="@name='schema' or @name='index' or @name='flags'">
249
+ <xsl:call-template name="schema"/>
250
+ </xsl:when>
251
+ <xsl:otherwise>
252
+ <xsl:call-template name="keyvalue"/>
253
+ </xsl:otherwise>
254
+ </xsl:choose>
255
+ </xsl:template>
256
+
257
+ <xsl:template name="schema">
258
+ <tr>
259
+ <td class="name">
260
+ <xsl:value-of select="@name"/>
261
+ </td>
262
+ <td class="value">
263
+ <xsl:if test="contains(.,'unstored')">
264
+ <xsl:value-of select="."/>
265
+ </xsl:if>
266
+ <xsl:if test="not(contains(.,'unstored'))">
267
+ <xsl:call-template name="infochar2string">
268
+ <xsl:with-param name="charList">
269
+ <xsl:value-of select="."/>
270
+ </xsl:with-param>
271
+ </xsl:call-template>
272
+ </xsl:if>
273
+ </td>
274
+ </tr>
275
+ </xsl:template>
276
+
277
+ <xsl:template name="infochar2string">
278
+ <xsl:param name="i">1</xsl:param>
279
+ <xsl:param name="charList"/>
280
+
281
+ <xsl:variable name="char">
282
+ <xsl:value-of select="substring($charList,$i,1)"/>
283
+ </xsl:variable>
284
+ <xsl:choose>
285
+ <xsl:when test="$char='I'">
286
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='I']"/> - </xsl:when>
287
+ <xsl:when test="$char='T'">
288
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='T']"/> - </xsl:when>
289
+ <xsl:when test="$char='S'">
290
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='S']"/> - </xsl:when>
291
+ <xsl:when test="$char='M'">
292
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='M']"/> - </xsl:when>
293
+ <xsl:when test="$char='V'">
294
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='V']"/> - </xsl:when>
295
+ <xsl:when test="$char='o'">
296
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='o']"/> - </xsl:when>
297
+ <xsl:when test="$char='p'">
298
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='p']"/> - </xsl:when>
299
+ <xsl:when test="$char='O'">
300
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='O']"/> - </xsl:when>
301
+ <xsl:when test="$char='L'">
302
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='L']"/> - </xsl:when>
303
+ <xsl:when test="$char='B'">
304
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='B']"/> - </xsl:when>
305
+ <xsl:when test="$char='C'">
306
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='C']"/> - </xsl:when>
307
+ <xsl:when test="$char='f'">
308
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='f']"/> - </xsl:when>
309
+ <xsl:when test="$char='l'">
310
+ <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='l']"/> -
311
+ </xsl:when>
312
+ </xsl:choose>
313
+
314
+ <xsl:if test="not($i>=string-length($charList))">
315
+ <xsl:call-template name="infochar2string">
316
+ <xsl:with-param name="i">
317
+ <xsl:value-of select="$i+1"/>
318
+ </xsl:with-param>
319
+ <xsl:with-param name="charList">
320
+ <xsl:value-of select="$charList"/>
321
+ </xsl:with-param>
322
+ </xsl:call-template>
323
+ </xsl:if>
324
+ </xsl:template>
325
+ <xsl:template name="css">
326
+ <style type="text/css">
327
+ <![CDATA[
328
+ td.name {font-style: italic; font-size:80%; }
329
+ .doc { margin: 0.5em; border: solid grey 1px; }
330
+ .exp { display: none; font-family: monospace; white-space: pre; }
331
+ div.histogram { background: none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;}
332
+ table.histogram { width: auto; vertical-align: bottom; }
333
+ table.histogram td, table.histogram th { text-align: center; vertical-align: bottom; border-bottom: 1px solid #ff9933; width: auto; }
334
+ ]]>
335
+ </style>
336
+ </xsl:template>
337
+ </xsl:stylesheet>
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'solr_wrapper'
4
+ require 'engine_cart/rake_task'
5
+ require 'rspec/core/rake_task'
6
+ require 'arclight'
7
+
8
+ class DependencyNotInstalled < StandardError; end
9
+
10
+ # Build with our opinionated defaults if none are provided.
11
+ rails_options = ENV.fetch('ENGINE_CART_RAILS_OPTIONS', '')
12
+ rails_options = "#{rails_options} -a propshaft" unless rails_options.match?(/-a\s|--asset-pipeline/)
13
+ rails_options = "#{rails_options} -j importmap" unless rails_options.match?(/-j\s|--javascript/)
14
+ rails_options = "#{rails_options} --css bootstrap" unless rails_options.match?(/--css/)
15
+ ENV['ENGINE_CART_RAILS_OPTIONS'] = rails_options
16
+
17
+ desc 'Run test suite'
18
+ task ci: %w[arclight:generate] do
19
+ SolrWrapper.wrap do |solr|
20
+ solr.with_collection do
21
+ Rake::Task['arclight:seed'].invoke
22
+ within_test_app do
23
+ system 'bin/rake spec:prepare'
24
+ end
25
+ Rake::Task['spec'].invoke
26
+ end
27
+ end
28
+ end
29
+
30
+ desc 'Run Eslint'
31
+ task :eslint do
32
+ raise DependencyNotInstalled, 'ESLint not found. Please run yarn install.' unless File.exist?('./node_modules/.bin/eslint')
33
+
34
+ exit 1 unless system './node_modules/.bin/eslint app/assets/javascripts'
35
+ end
36
+
37
+ namespace :arclight do
38
+ desc 'Generate a test application'
39
+ task generate: %w[engine_cart:generate]
40
+
41
+ desc 'Run Solr and Blacklight for interactive development'
42
+ task :server, %i[rails_server_args] do |_t, args|
43
+ if File.exist? EngineCart.destination
44
+ within_test_app do
45
+ system 'bundle update'
46
+ end
47
+ else
48
+ Rake::Task['engine_cart:generate'].invoke
49
+ end
50
+
51
+ print 'Starting Solr...'
52
+ SolrWrapper.wrap do |solr|
53
+ puts 'done.'
54
+ solr.with_collection do
55
+ Rake::Task['arclight:seed'].invoke
56
+ within_test_app do
57
+ system "bin/dev #{args[:rails_server_args]}"
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ desc 'Seed fixture data to Solr'
64
+ task :seed do
65
+ puts 'Seeding index with data from spec/fixtures/ead...'
66
+ Dir.glob('spec/fixtures/ead/*').each do |dir|
67
+ next unless File.directory?(dir)
68
+
69
+ within_test_app do
70
+ # Sets the REPOSITORY_ID to the name of the file's containing directory
71
+ system("REPOSITORY_ID=#{File.basename(dir)} " \
72
+ "REPOSITORY_FILE=#{Arclight::Engine.root}/spec/fixtures/config/repositories.yml " \
73
+ "DIR=#{Arclight::Engine.root}/#{dir} " \
74
+ 'SOLR_URL=http://127.0.0.1:8983/solr/blacklight-core ' \
75
+ 'rake arclight:index_dir')
76
+ end
77
+ end
78
+ end
79
+ end
data/template.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ gem 'arclight'
4
+
5
+ after_bundle do
6
+ generate 'blacklight:install', '--devise'
7
+ generate 'arclight:install', '-f'
8
+
9
+ rake 'db:migrate'
10
+ end