blacklight_allmaps 0.3.0 → 0.4.0

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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +107 -0
  3. data/.gitignore +20 -0
  4. data/.standard.yml +1 -0
  5. data/Gemfile +50 -0
  6. data/app/assets/images/blacklight_allmaps/.keep +0 -0
  7. data/app/assets/stylesheets/blacklight/allmaps/base.scss +4 -1
  8. data/app/assets/stylesheets/blacklight/allmaps/modules/leaflet.opacity.css +76 -0
  9. data/app/jobs/blacklight/allmaps/store_sidecar_annotation.rb +3 -0
  10. data/app/models/concerns/.keep +0 -0
  11. data/blacklight_allmaps.gemspec +34 -0
  12. data/doc/Proposal_Eric_Larson_Ian_Spangler_4CE510.pdf +0 -0
  13. data/doc/allmaps_branding_screenshot.png +0 -0
  14. data/doc/allmaps_screenshot.png +0 -0
  15. data/doc/allmaps_screenshot_window.png +0 -0
  16. data/doc/development.md +72 -0
  17. data/doc/gbl_screenshot.png +0 -0
  18. data/doc/gbl_screenshot_window.png +0 -0
  19. data/doc/georeferenced_facet.png +0 -0
  20. data/doc/screenshot_layers.acorn +0 -0
  21. data/doc/screenshot_layers.png +0 -0
  22. data/lib/blacklight/allmaps/tasks/index.rake +1 -0
  23. data/lib/blacklight/allmaps/version.rb +1 -1
  24. data/lib/blacklight/allmaps.rb +10 -2
  25. data/lib/generators/blacklight/allmaps/blacklight_generator.rb +9 -3
  26. data/lib/generators/blacklight/allmaps/config_generator.rb +7 -1
  27. data/lib/generators/blacklight/allmaps/geoblacklight_generator.rb +10 -1
  28. data/lib/generators/blacklight/allmaps/templates/package.json +6 -0
  29. data/package.json +43 -0
  30. data/rollup.config.js +43 -0
  31. data/solr/blacklight/conf/_rest_managed.json +3 -0
  32. data/solr/blacklight/conf/admin-extra.html +31 -0
  33. data/solr/blacklight/conf/elevate.xml +36 -0
  34. data/solr/blacklight/conf/mapping-ISOLatin1Accent.txt +246 -0
  35. data/solr/blacklight/conf/protwords.txt +21 -0
  36. data/solr/blacklight/conf/schema.xml +388 -0
  37. data/solr/blacklight/conf/scripts.conf +24 -0
  38. data/solr/blacklight/conf/solrconfig.xml +265 -0
  39. data/solr/blacklight/conf/spellings.txt +2 -0
  40. data/solr/blacklight/conf/stopwords.txt +58 -0
  41. data/solr/blacklight/conf/stopwords_en.txt +58 -0
  42. data/solr/blacklight/conf/synonyms.txt +31 -0
  43. data/solr/blacklight/conf/xslt/example.xsl +132 -0
  44. data/solr/blacklight/conf/xslt/example_atom.xsl +67 -0
  45. data/solr/blacklight/conf/xslt/example_rss.xsl +66 -0
  46. data/solr/blacklight/conf/xslt/luke.xsl +337 -0
  47. data/solr/geoblacklight/conf/_rest_managed.json +3 -0
  48. data/solr/geoblacklight/conf/admin-extra.html +31 -0
  49. data/solr/geoblacklight/conf/core.properties +5 -0
  50. data/solr/geoblacklight/conf/elevate.xml +36 -0
  51. data/solr/geoblacklight/conf/mapping-ISOLatin1Accent.txt +246 -0
  52. data/solr/geoblacklight/conf/protwords.txt +21 -0
  53. data/solr/geoblacklight/conf/schema.xml +198 -0
  54. data/solr/geoblacklight/conf/scripts.conf +24 -0
  55. data/solr/geoblacklight/conf/solrconfig.xml +243 -0
  56. data/solr/geoblacklight/conf/spellings.txt +2 -0
  57. data/solr/geoblacklight/conf/stopwords.txt +58 -0
  58. data/solr/geoblacklight/conf/stopwords_en.txt +58 -0
  59. data/solr/geoblacklight/conf/synonyms.txt +31 -0
  60. data/solr/geoblacklight/conf/xslt/example.xsl +132 -0
  61. data/solr/geoblacklight/conf/xslt/example_atom.xsl +67 -0
  62. data/solr/geoblacklight/conf/xslt/example_rss.xsl +66 -0
  63. data/solr/geoblacklight/conf/xslt/luke.xsl +337 -0
  64. data/spec/controllers/annotations_controller_spec.rb +74 -0
  65. data/spec/factories/annotations.rb +12 -0
  66. data/spec/features/show_page_spec.rb +35 -0
  67. data/spec/features/sidebar_spec.rb +28 -0
  68. data/spec/fixtures/blacklight_allmaps_sidecars.yml +1203 -0
  69. data/spec/fixtures/solr_documents/README.md +15 -0
  70. data/spec/fixtures/solr_documents/blacklight/README.md +9 -0
  71. data/spec/fixtures/solr_documents/blacklight/bl_georeferenced.json +40 -0
  72. data/spec/fixtures/solr_documents/geoblacklight/gbl_btaa_northwestern_georeferenced.json +57 -0
  73. data/spec/fixtures/solr_documents/geoblacklight/gbl_harvard-g4124-m2-1855-m3_georefereneced.json +68 -0
  74. data/spec/fixtures/solr_documents/geoblacklight/gbl_not_georeferenced.json +67 -0
  75. data/spec/fixtures/solr_documents/geoblacklight/gbl_osu-0r967h708_georeferenced.json +60 -0
  76. data/spec/fixtures/solr_documents/geoblacklight/gbl_p16022coll230:1933_georeferenced.json +60 -0
  77. data/spec/fixtures/solr_documents/geoblacklight/gbl_p16022coll230:360_georeferenced.json +67 -0
  78. data/spec/fixtures/solr_documents/geoblacklight/gbl_p16022coll230:4038_georeferenced.json +53 -0
  79. data/spec/helpers/blacklight/allmaps/application_helper_spec.rb +28 -0
  80. data/spec/models/blacklight/allmaps/sidecar_allmaps_spec.rb +22 -0
  81. data/spec/spec_helper.rb +53 -0
  82. data/spec/test_app_templates/Gemfile.extra +2 -0
  83. data/spec/test_app_templates/lib/generators/test_app_generator.rb +48 -0
  84. data/vendor/assets/images/fullscreen.png +0 -0
  85. data/vendor/assets/images/fullscreen@2x.png +0 -0
  86. data/vendor/assets/images/layers-2x.png +0 -0
  87. data/vendor/assets/images/layers.png +0 -0
  88. data/vendor/assets/images/marker-icon-2x.png +0 -0
  89. data/vendor/assets/images/marker-icon.png +0 -0
  90. data/vendor/assets/images/marker-shadow.png +0 -0
  91. data/vendor/assets/stylesheets/leaflet.css +640 -0
  92. data/vendor/assets/stylesheets/leaflet.fullscreen.css +40 -0
  93. metadata +85 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b77dce03fda3d3aab9db13861e8e1fc6b0dc8e39db47dcf75a8dc8ee34a27f2
4
- data.tar.gz: 83e85dc411bcacefcb92b0b9b12701e778c58116e6cefda56768de040f0d7c50
3
+ metadata.gz: 36ee8dcecb6fdfe204e03e183438a3a41e09dd802e6efaa42f2e865aacdef99b
4
+ data.tar.gz: ad4a15de994f88bae9597e26761d5ad4aceb7ddfd227a823b68287f44043f75b
5
5
  SHA512:
6
- metadata.gz: b182818f63f0e5a5fca137c8e7fbb8373a8e7955ffb93650a9fb0ccae01fbe2daaecedf29967c73bb5617c86cd92672653c67291bb3fe8244e0459180d4f205a
7
- data.tar.gz: c9419afe74db352bdf7160b3900a856914b73f2171f9f13b0425dbe8087feb8b6142ccf78f000ec8dc4f545ce8064b938dec9452ee72a4417e37fd4ae0899b7b
6
+ metadata.gz: 5699838093c01346ad2dd666d3c930b002fbd00aa65909441c184b8f6b0906957b2a1e0195dddde11502864583273580558ac593e4e10280be028bc01e1ea292
7
+ data.tar.gz: 5fe0001de0341c5289d3914b1df02ec8425e6fe88fa26c28f6b8976a241fca3186e5d82b336776c773d8fc1b215fa34484f021f1f14362daa6a09fcd66e01f88
@@ -0,0 +1,107 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ jobs:
10
+ linter:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 3.3
18
+ - name: Install dependencies
19
+ run: bundle install
20
+ - name: Run linter
21
+ run: bundle exec standardrb
22
+
23
+ test_blacklight:
24
+ runs-on: ubuntu-latest
25
+ strategy:
26
+ matrix:
27
+ ruby_version: [3.3]
28
+ rails_version: [7.1.3.2]
29
+
30
+ name: Test Blacklight / Ruby ${{ matrix.ruby_version }} / Rails ${{ matrix.rails_version }}
31
+ steps:
32
+ - uses: actions/checkout@v3
33
+ - name: Set up Ruby
34
+ uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby_version }}
37
+ - name: Set up Node
38
+ uses: actions/setup-node@v4
39
+ with:
40
+ node-version: '20.x'
41
+ - name: Create Solr container
42
+ run: docker run -d -p 8983:8983 geoblacklight/solr:8.9-v1.0.0 server/scripts/ci-start.sh
43
+ - name: Lock platform version
44
+ run: bundle lock --add-platform ruby
45
+ - name: Install dependencies
46
+ run: bundle install
47
+ env:
48
+ RAILS_VERSION: ${{ matrix.rails_version }}
49
+ LIGHT: geoblacklight
50
+ - name: Setup Yarn
51
+ run: exec "yarnpkg"
52
+ - name: Load config into solr
53
+ run: |
54
+ cd solr/blacklight/conf
55
+ zip -1 -r solr_config.zip ./*
56
+ curl -H "Content-type:application/octet-stream" --data-binary @solr_config.zip "http://solr:SolrRocks@127.0.0.1:8983/solr/admin/configs?action=UPLOAD&name=blacklight"
57
+ curl -H 'Content-type: application/json' http://solr:SolrRocks@127.0.0.1:8983/api/collections/ -d '{create: {name: blacklight-core, config: blacklight, numShards: 1}}'
58
+ - name: Run tests
59
+ run: bundle exec rake ci
60
+ env:
61
+ RAILS_VERSION: ${{ matrix.rails_version }}
62
+ ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
63
+ SOLR_URL: http://solr:SolrRocks@localhost:8983/solr/blacklight-core
64
+ LIGHT: blacklight
65
+
66
+ test_geoblacklight:
67
+ runs-on: ubuntu-latest
68
+ strategy:
69
+ matrix:
70
+ ruby_version: [3.3]
71
+ rails_version: [7.1.3.2]
72
+
73
+ name: Test GeoBlacklight / Ruby ${{ matrix.ruby_version }} / Rails ${{ matrix.rails_version }}
74
+ steps:
75
+ - uses: actions/checkout@v3
76
+ - name: Set up Ruby
77
+ uses: ruby/setup-ruby@v1
78
+ with:
79
+ ruby-version: ${{ matrix.ruby_version }}
80
+ - name: Set up Node
81
+ uses: actions/setup-node@v4
82
+ with:
83
+ node-version: '20.x'
84
+ - name: Create Solr container
85
+ run: docker run -d -p 8983:8983 geoblacklight/solr:8.9-v1.0.0 server/scripts/ci-start.sh
86
+ - name: Lock platform version
87
+ run: bundle lock --add-platform ruby
88
+ - name: Install dependencies
89
+ run: bundle install
90
+ env:
91
+ RAILS_VERSION: ${{ matrix.rails_version }}
92
+ LIGHT: geoblacklight
93
+ - name: Setup Yarn
94
+ run: exec "yarnpkg"
95
+ - name: Load config into solr
96
+ run: |
97
+ cd solr/geoblacklight/conf
98
+ zip -1 -r solr_config.zip ./*
99
+ curl -H "Content-type:application/octet-stream" --data-binary @solr_config.zip "http://solr:SolrRocks@127.0.0.1:8983/solr/admin/configs?action=UPLOAD&name=blacklight"
100
+ curl -H 'Content-type: application/json' http://solr:SolrRocks@127.0.0.1:8983/api/collections/ -d '{create: {name: blacklight-core, config: blacklight, numShards: 1}}'
101
+ - name: Run tests
102
+ run: bundle exec rake ci
103
+ env:
104
+ RAILS_VERSION: ${{ matrix.rails_version }}
105
+ ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
106
+ SOLR_URL: http://solr:SolrRocks@localhost:8983/solr/blacklight-core
107
+ LIGHT: geoblacklight
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ .ruby-version
2
+ *.gem
3
+ Gemfile.lock
4
+ /.bundle/
5
+ /log/*.log
6
+ /pkg/
7
+ /tmp/
8
+
9
+ .internal_test_app
10
+
11
+ # Setup local JavaScript ignores
12
+ /node_modules
13
+ /yarn-error.log
14
+ yarn-debug.log*
15
+ .yarn-integrity
16
+ yarn.lock
17
+
18
+ node_modules
19
+ package-lock.json
20
+ dist
data/.standard.yml ADDED
@@ -0,0 +1 @@
1
+ format: progress
data/Gemfile ADDED
@@ -0,0 +1,50 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Specify your gem's dependencies in blacklight_allmaps.gemspec.
5
+ gemspec
6
+
7
+ group :test do
8
+ gem "capybara", require: false
9
+ gem "engine_cart", require: false
10
+ gem "factory_bot_rails", require: false
11
+ gem "rails-controller-testing", require: false
12
+ gem "rspec-rails", require: false
13
+ gem "standardrb", require: false
14
+ gem "webdrivers", require: false
15
+ end
16
+
17
+ # Start debugger with binding.b [https://github.com/ruby/debug]
18
+ # gem "debug", ">= 1.0.0"
19
+
20
+ # BEGIN ENGINE_CART BLOCK
21
+ # engine_cart: 2.6.0
22
+ # engine_cart stanza: 2.5.0
23
+ # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
24
+ file = File.expand_path("Gemfile", ENV["ENGINE_CART_DESTINATION"] || ENV["RAILS_ROOT"] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
25
+ if File.exist?(file)
26
+ begin
27
+ eval_gemfile file
28
+ rescue Bundler::GemfileError => e
29
+ Bundler.ui.warn "[EngineCart] Skipping Rails application dependencies:"
30
+ Bundler.ui.warn e.message
31
+ end
32
+ else
33
+ Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
34
+
35
+ if ENV["RAILS_VERSION"]
36
+ if ENV["RAILS_VERSION"] == "edge"
37
+ gem "rails", github: "rails/rails"
38
+ ENV["ENGINE_CART_RAILS_OPTIONS"] = "--edge --skip-turbolinks"
39
+ else
40
+ gem "rails", ENV["RAILS_VERSION"]
41
+ end
42
+ end
43
+ end
44
+
45
+ if File.exist?("spec/test_app_templates/Gemfile.extra")
46
+ # rubocop:disable Security/Eval
47
+ eval File.read("spec/test_app_templates/Gemfile.extra"), nil, "spec/test_app_templates/Gemfile.extra"
48
+ # rubocop:enable Security/Eval
49
+ end
50
+ # END ENGINE_CART BLOCK
File without changes
@@ -1,9 +1,12 @@
1
1
  @charset "UTF-8";
2
2
 
3
3
  // Blacklight::Allmaps
4
+ // Via NPM
4
5
  @import "leaflet";
5
6
  @import "leaflet.fullscreen";
6
- @import "leaflet.opacity";
7
+
8
+ // Via
9
+ @import "modules/leaflet.opacity";
7
10
 
8
11
  #blacklight-allmaps-map { height: 400px; }
9
12
  #geoblacklight-allmaps-map { height: 400px; }
@@ -0,0 +1,76 @@
1
+ .leaflet-control.opacity-control {
2
+ background-color: #a9acb1;
3
+ border-radius: 15px;
4
+ color: black;
5
+ font: bold 18px 'Lucida Console', Monaco, monospace;
6
+ display: block;
7
+ height: 200px;
8
+ left: 11px;
9
+ position: relative;
10
+ top: 15px;
11
+ width: 5px;
12
+ }
13
+ .leaflet-control.opacity-control .opacity-handle {
14
+ background-color: #fff;
15
+ border-radius: 4px;
16
+ border: 1px solid #eee;
17
+ cursor: ns-resize;
18
+ font-size: 10px;
19
+ height: 26px;
20
+ left: -11px;
21
+ line-height: 26px;
22
+ position: absolute;
23
+ text-align: center;
24
+ top: 0;
25
+ width: 26px;
26
+ }
27
+ .leaflet-control.opacity-control .opacity-handle:hover {
28
+ background-color: #f4f4f4;
29
+ }
30
+ .leaflet-control.opacity-control .opacity-arrow-up {
31
+ color: #aaa;
32
+ position: absolute;
33
+ top: -11px;
34
+ text-align: center;
35
+ width: 100%;
36
+ }
37
+ .leaflet-control.opacity-control .opacity-arrow-up:before {
38
+ content: '=';
39
+ }
40
+ .leaflet-control.opacity-control .opacity-arrow-down {
41
+ bottom: -10px;
42
+ color: #aaa;
43
+ position: absolute;
44
+ text-align: center;
45
+ width: 100%;
46
+ }
47
+ .leaflet-control.opacity-control .opacity-arrow-down:before {
48
+ content: '=';
49
+ }
50
+ .leaflet-control.opacity-control .opacity-bottom {
51
+ background-color: #017afd;
52
+ border-radius: 15px;
53
+ display: block;
54
+ height: 137px;
55
+ left: 0px;
56
+ position: relative;
57
+ top: 63px;
58
+ width: 5px;
59
+ }
60
+ .leaflet-control.opacity-control .opacity-area {
61
+ padding: 14px;
62
+ cursor: default;
63
+ height: 200px;
64
+ left: -11px;
65
+ position: absolute;
66
+ top: 0px;
67
+ width: 20px;
68
+ }
69
+ .opacity-control.unselectable {
70
+ -webkit-touch-callout: none;
71
+ -webkit-user-select: none;
72
+ -khtml-user-select: none;
73
+ -moz-user-select: none;
74
+ -ms-user-select: none;
75
+ user-select: none;
76
+ }
@@ -10,6 +10,9 @@ module Blacklight
10
10
  sidecar = solr_document.sidecar_allmaps
11
11
 
12
12
  if ApplicationController.helpers.georeferenceable?(solr_document)
13
+ # Sleep for a random amount of time to crawl politely
14
+ sleep(rand(1..5))
15
+
13
16
  # Store the IIIF Manifest
14
17
  response = HTTParty.get(solr_document.iiif_manifest_url, follow_redirects: true)
15
18
  if response.code == 200
File without changes
@@ -0,0 +1,34 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "blacklight/allmaps/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "blacklight_allmaps"
7
+ spec.version = Blacklight::Allmaps::VERSION
8
+ spec.platform = Gem::Platform::RUBY
9
+ spec.authors = ["Eric Larson"]
10
+ spec.email = ["ewlarson@gmail.com"]
11
+ spec.homepage = "https://github.com/bplmaps/blacklight-allmaps"
12
+ spec.summary = "Blacklight::Allmaps plugin"
13
+ spec.description = "Description of Blacklight::Allmaps"
14
+ spec.license = "Apache 2.0"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = spec.homepage
21
+
22
+ spec.add_dependency "blacklight", ">= 7.25.2", "< 9"
23
+ spec.add_dependency "httparty", "~> 0.20"
24
+
25
+ spec.add_development_dependency "solr_wrapper"
26
+ spec.add_development_dependency "rails-controller-testing"
27
+ spec.add_development_dependency "rspec-rails"
28
+ spec.add_development_dependency "engine_cart", "~> 2.1"
29
+ spec.add_development_dependency "factory_bot_rails"
30
+ spec.add_development_dependency "capybara", "~> 3"
31
+ spec.add_development_dependency "webdrivers"
32
+ spec.add_development_dependency "standard", "~> 1.34"
33
+ spec.add_development_dependency "sqlite3"
34
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1,72 @@
1
+ # Development Notes
2
+
3
+ ## Running the Application
4
+
5
+ ### Blacklight / MARC
6
+
7
+ IIIF Manifest URI is likely in 856 4#$u
8
+ https://www.loc.gov/marc/bibliographic/bd856.html
9
+
10
+ Solr Field: iiif_manifest_url_ssi (from Spotlight fixtures)
11
+ Georeferenced Field: georeferenced_bsi (Blacklight dynamicField Schema)
12
+
13
+ @TODO: Use mods_xml_ssm instead of marc_ss?
14
+
15
+ #### TERMINAL 1 / Run Solr
16
+
17
+ ```
18
+ bundle exec rake engine_cart:clean
19
+ LIGHT=blacklight bundle exec rake blacklight_allmaps:solr
20
+ ```
21
+
22
+ #### TERMINAL 2 / Index
23
+ ```
24
+ cd .internal_test_app
25
+ rake blacklight_allmaps:index:bl_fixtures
26
+ rake blacklight_allmaps:sidecars:harvest:allmaps
27
+ rake blacklight_allmaps:index:georeferenced_facet
28
+ rails s
29
+ ```
30
+
31
+ ### GeoBlacklight / Aardvark Schema
32
+
33
+ IIIF Manifest URI is in dct_references_s
34
+ https://opengeometadata.org/ogm-aardvark/#references
35
+ Key: http://iiif.io/api/presentation#manifest
36
+
37
+ Solr Field: dct_references_s
38
+ Georeferenced Field: gbl_georeferenced_b (Aardvark Schema)
39
+
40
+ #### TERMINAL 1 / Run Solr
41
+ ```
42
+ bundle exec rake engine_cart:clean
43
+ LIGHT=geoblacklight bundle exec rake blacklight_allmaps:solr
44
+ ```
45
+
46
+ #### TERMINAL 2 / Index, Harvest, Facet
47
+ ```
48
+ cd .internal_test_app
49
+ rake blacklight_allmaps:index:gbl_fixtures
50
+ rake blacklight_allmaps:sidecars:harvest:allmaps
51
+ rake blacklight_allmaps:index:georeferenced_facet
52
+ rails s
53
+ ```
54
+
55
+ ## Building the Javascript / Publishing the NPM Package
56
+
57
+ The javascript is built by npm from sources in `app/javascript` into a bundle
58
+ in `app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.js`. This file should not be edited by hand as any changes would be overwritten. When any of the javascript
59
+ components in the gem are changed, this bundle should be rebuild with the
60
+ following steps:
61
+ 1. [Install npm](https://www.npmjs.com/get-npm)
62
+ 1. run `npm install` to download dependencies
63
+ 1. run `npm run prepare` to build the bundle
64
+ 1. run `npm publish` to push the javascript package to https://npmjs.org/package/blacklight-allmaps
65
+
66
+ ## Running the Test suite
67
+
68
+ ```LIGHT=blacklight bundle exec rake ci```
69
+
70
+ or
71
+
72
+ ```LIGHT=geoblacklight bundle exec rake ci```
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "blacklight"
4
+ require "blacklight/allmaps/version"
4
5
 
5
6
  namespace :blacklight_allmaps do
6
7
  namespace :index do
@@ -1,6 +1,6 @@
1
1
  module Blacklight
2
2
  module Allmaps
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
 
5
5
  def self.version
6
6
  @version ||= VERSION
@@ -1,8 +1,16 @@
1
1
  require "blacklight"
2
+ require "blacklight/allmaps/version"
3
+ require "blacklight/allmaps/engine"
2
4
 
3
5
  module Blacklight
4
6
  module Allmaps
5
- require "blacklight/allmaps/engine"
6
- require "blacklight/allmaps/version"
7
+ def self.version
8
+ @version ||= VERSION
9
+ end
10
+
11
+ # returns the full path the the plugin installation
12
+ def self.root
13
+ @root ||= __dir__
14
+ end
7
15
  end
8
16
  end
@@ -10,9 +10,10 @@ module Blacklight
10
10
  desc <<-DESCRIPTION
11
11
  This generator makes the following changes to your application:
12
12
  1. Copies stylesheets to Blacklight app
13
- 2. Adds Blacklight::Allmaps configuration to CatalogController
14
- 3. Adds georeferenced facet to CatalogController
15
- 4. Includes Blacklight::Allmaps::SolrDocument in SolrDocument
13
+ 2. Add yarn package
14
+ 3. Adds Blacklight::Allmaps configuration to CatalogController
15
+ 4. Adds georeferenced facet to CatalogController
16
+ 5. Includes Blacklight::Allmaps::SolrDocument in SolrDocument
16
17
  DESCRIPTION
17
18
 
18
19
  def add_bl_stylesheets
@@ -21,6 +22,11 @@ module Blacklight
21
22
  end
22
23
  end
23
24
 
25
+ def add_yarn_package
26
+ copy_file "package.json", "package.json"
27
+ run "yarn install"
28
+ end
29
+
24
30
  def add_configuration
25
31
  inject_into_file "app/controllers/catalog_controller.rb", after: "#config.show.thumbnail_field = 'thumbnail_path_ss'" do
26
32
  "\n
@@ -20,6 +20,7 @@ module Blacklight
20
20
  append_to_file "config/initializers/assets.rb" do
21
21
  "
22
22
  # Blacklight Allmaps
23
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
23
24
  Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'images')
24
25
  Rails.application.config.assets.precompile += %w( blacklight/allmaps/allmaps-logo.svg )"
25
26
  end
@@ -40,6 +41,7 @@ module Blacklight
40
41
  pin "leaflet", to: "https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js", preload: true
41
42
  pin "leaflet-fullscreen", to: "https://cdn.jsdelivr.net/npm/leaflet-fullscreen@1.0.2/dist/Leaflet.fullscreen.min.js", preload: true
42
43
  pin "@allmaps/leaflet", to: "https://cdn.jsdelivr.net/npm/@allmaps/leaflet/dist/bundled/allmaps-leaflet-1.9.umd.js", preload: true
44
+ pin_all_from File.expand_path("../app/javascript/blacklight/allmaps", __dir__), under: "blacklight-allmaps"
43
45
  CONTENT
44
46
  end
45
47
  end
@@ -48,10 +50,14 @@ module Blacklight
48
50
  inject_into_file "app/assets/javascripts/application.js", after: "//= require blacklight/blacklight" do
49
51
  "\n
50
52
  // Required by Blacklight::Allmaps
51
- //= require blacklight/allmaps/blacklight-allmaps"
53
+ //= require blacklight-allmaps/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.js"
52
54
  end
53
55
  end
54
56
 
57
+ def add_yarn_package
58
+ run "yarn add blacklight-allmaps"
59
+ end
60
+
55
61
  def set_routes
56
62
  inject_into_file "config/routes.rb", "mount Blacklight::Allmaps::Engine => '/'\n", before: /^end/
57
63
  end
@@ -22,7 +22,16 @@ module Blacklight
22
22
  end
23
23
 
24
24
  def add_geoblacklight
25
- append_to_file "Gemfile", '"geoblacklight", "~> 4.4"'
25
+ gemfile_path = "Gemfile"
26
+
27
+ # Check if the 'geoblacklight' gem is already included in the Gemfile
28
+ if File.read(gemfile_path).include?("geoblacklight")
29
+ say_status("skipped", "geoblacklight gem already included in the Gemfile", :yellow)
30
+ else
31
+ append_to_file "Gemfile" do
32
+ "\ngem \"geoblacklight\", \"~> 4.4\""
33
+ end
34
+ end
26
35
  end
27
36
 
28
37
  def add_configuration
@@ -0,0 +1,6 @@
1
+ {
2
+ "dependencies": {
3
+ "blacklight-allmaps": "^0.3.1",
4
+ "leaflet": "^1.9.4"
5
+ }
6
+ }
data/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "blacklight-allmaps",
3
+ "version": "0.3.1",
4
+ "description": "The frontend code and styles for Blacklight Allmaps",
5
+ "main": "app/assets/javascripts/blacklight/allmaps",
6
+ "module": "app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.esm.js",
7
+ "author": "Eric Larson",
8
+ "license": "Apache-2.0",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "scripts": {
13
+ "prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/bplmaps/blacklight-allmaps.git"
18
+ },
19
+ "files": [
20
+ "app/assets",
21
+ "app/javascript"
22
+ ],
23
+ "bugs": {
24
+ "url": "https://github.com/bplmaps/blacklight-allmaps/issues"
25
+ },
26
+ "homepage": "https://github.com/bplmaps/blacklight-allmaps#readme",
27
+ "devDependencies": {
28
+ "@rollup/plugin-commonjs": "^25.0.7",
29
+ "@rollup/plugin-node-resolve": "^15.2.3",
30
+ "rollup": "^2.60.0",
31
+ "rollup-plugin-includepaths": "^0.2.4"
32
+ },
33
+ "browserslist": [
34
+ "defaults",
35
+ "not IE 11"
36
+ ],
37
+ "dependencies": {
38
+ "@allmaps/leaflet": "^1.0.0-beta.33",
39
+ "blacklight-allmaps": "^0.3.1",
40
+ "leaflet": "^1.9.4",
41
+ "leaflet-fullscreen": "^1.0.2"
42
+ }
43
+ }
data/rollup.config.js ADDED
@@ -0,0 +1,43 @@
1
+ 'use strict'
2
+
3
+ import nodeResolve from '@rollup/plugin-node-resolve';
4
+ import commonjs from '@rollup/plugin-commonjs';
5
+ import includePaths from 'rollup-plugin-includepaths';
6
+
7
+ const path = require('path')
8
+
9
+ const BUNDLE = process.env.BUNDLE === 'true'
10
+ const ESM = process.env.ESM === 'true'
11
+
12
+ const fileDest = `blacklight-allmaps${ESM ? '.esm' : ''}`
13
+ const external = []
14
+ const globals = {}
15
+
16
+ let includePathOptions = {
17
+ include: {},
18
+ paths: ['app/javascript'],
19
+ external: [],
20
+ extensions: ['.js']
21
+ };
22
+
23
+ const rollupConfig = {
24
+ input: path.resolve(__dirname, `app/javascript/blacklight/allmaps/index.js`),
25
+ output: {
26
+ file: path.resolve(__dirname, `app/assets/javascripts/blacklight/allmaps/${fileDest}.js`),
27
+ format: ESM ? 'esm' : 'umd',
28
+ globals,
29
+ generatedCode: 'es2015'
30
+ },
31
+ external,
32
+ plugins: [
33
+ includePaths(includePathOptions),
34
+ nodeResolve(),
35
+ commonjs()
36
+ ]
37
+ }
38
+
39
+ if (!ESM) {
40
+ rollupConfig.output.name = 'Blacklight'
41
+ }
42
+
43
+ module.exports = rollupConfig
@@ -0,0 +1,3 @@
1
+ {
2
+ "initArgs":{},
3
+ "managedList":[]}