browse-everything 1.1.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +86 -49
  3. data/.gitignore +4 -2
  4. data/.rubocop.yml +12 -0
  5. data/.rubocop_todo.yml +0 -5
  6. data/.tool-versions +2 -0
  7. data/CONTRIBUTING.md +22 -0
  8. data/Gemfile +38 -30
  9. data/README.md +71 -36
  10. data/Rakefile +9 -1
  11. data/app/assets/javascripts/browse_everything/behavior.js +29 -23
  12. data/app/assets/javascripts/browse_everything.js +1 -1
  13. data/bin/rails +14 -0
  14. data/browse-everything.gemspec +13 -11
  15. data/lib/browse_everything/driver/base.rb +1 -0
  16. data/lib/browse_everything/driver/dropbox.rb +5 -2
  17. data/lib/browse_everything/driver/file_system.rb +15 -2
  18. data/lib/browse_everything/engine.rb +10 -3
  19. data/lib/browse_everything/version.rb +1 -1
  20. data/lib/browse_everything.rb +1 -1
  21. data/spec/dummy_test_app/Rakefile +6 -0
  22. data/spec/dummy_test_app/app/assets/config/manifest.js +3 -0
  23. data/spec/dummy_test_app/app/assets/images/.keep +0 -0
  24. data/spec/dummy_test_app/app/assets/javascripts/application.js +25 -0
  25. data/spec/dummy_test_app/app/assets/javascripts/cable.js +13 -0
  26. data/spec/dummy_test_app/app/assets/javascripts/channels/.keep +0 -0
  27. data/spec/dummy_test_app/app/assets/stylesheets/application.scss +18 -0
  28. data/spec/dummy_test_app/app/channels/application_cable/channel.rb +4 -0
  29. data/spec/dummy_test_app/app/channels/application_cable/connection.rb +4 -0
  30. data/spec/dummy_test_app/app/controllers/application_controller.rb +3 -0
  31. data/spec/dummy_test_app/app/controllers/concerns/.keep +0 -0
  32. data/spec/dummy_test_app/app/helpers/application_helper.rb +2 -0
  33. data/spec/dummy_test_app/app/jobs/application_job.rb +2 -0
  34. data/spec/dummy_test_app/app/mailers/application_mailer.rb +4 -0
  35. data/spec/dummy_test_app/app/models/application_record.rb +3 -0
  36. data/spec/dummy_test_app/app/models/concerns/.keep +0 -0
  37. data/spec/dummy_test_app/app/views/file_handler/index.html.erb +10 -0
  38. data/spec/{support → dummy_test_app}/app/views/file_handler/main.html.erb +6 -3
  39. data/spec/dummy_test_app/app/views/layouts/application.html.erb +14 -0
  40. data/spec/dummy_test_app/app/views/layouts/mailer.html.erb +13 -0
  41. data/spec/dummy_test_app/app/views/layouts/mailer.text.erb +1 -0
  42. data/spec/dummy_test_app/bin/bundle +3 -0
  43. data/spec/dummy_test_app/bin/rails +4 -0
  44. data/spec/dummy_test_app/bin/rake +4 -0
  45. data/spec/dummy_test_app/bin/setup +38 -0
  46. data/spec/dummy_test_app/bin/update +29 -0
  47. data/spec/dummy_test_app/bin/yarn +11 -0
  48. data/spec/dummy_test_app/config/application.rb +27 -0
  49. data/spec/dummy_test_app/config/boot.rb +5 -0
  50. data/spec/dummy_test_app/config/browse_everything_providers.yml +25 -0
  51. data/spec/dummy_test_app/config/cable.yml +10 -0
  52. data/spec/dummy_test_app/config/database.yml +25 -0
  53. data/spec/dummy_test_app/config/environment.rb +5 -0
  54. data/spec/dummy_test_app/config/environments/development.rb +54 -0
  55. data/spec/dummy_test_app/config/environments/production.rb +91 -0
  56. data/spec/dummy_test_app/config/environments/test.rb +42 -0
  57. data/spec/dummy_test_app/config/initializers/application_controller_renderer.rb +8 -0
  58. data/spec/dummy_test_app/config/initializers/assets.rb +14 -0
  59. data/spec/dummy_test_app/config/initializers/backtrace_silencers.rb +7 -0
  60. data/spec/dummy_test_app/config/initializers/cookies_serializer.rb +5 -0
  61. data/spec/dummy_test_app/config/initializers/filter_parameter_logging.rb +4 -0
  62. data/spec/dummy_test_app/config/initializers/inflections.rb +16 -0
  63. data/spec/dummy_test_app/config/initializers/mime_types.rb +4 -0
  64. data/spec/dummy_test_app/config/initializers/wrap_parameters.rb +14 -0
  65. data/spec/dummy_test_app/config/locales/en.yml +33 -0
  66. data/spec/dummy_test_app/config/puma.rb +56 -0
  67. data/spec/dummy_test_app/config/routes.rb +9 -0
  68. data/spec/dummy_test_app/config/secrets.yml +32 -0
  69. data/spec/dummy_test_app/config/spring.rb +6 -0
  70. data/spec/dummy_test_app/config.ru +5 -0
  71. data/spec/dummy_test_app/lib/assets/.keep +0 -0
  72. data/spec/dummy_test_app/log/.keep +0 -0
  73. data/spec/dummy_test_app/package.json +5 -0
  74. data/spec/dummy_test_app/public/404.html +67 -0
  75. data/spec/dummy_test_app/public/422.html +67 -0
  76. data/spec/dummy_test_app/public/500.html +66 -0
  77. data/spec/dummy_test_app/public/apple-touch-icon-precomposed.png +0 -0
  78. data/spec/dummy_test_app/public/apple-touch-icon.png +0 -0
  79. data/spec/dummy_test_app/public/favicon.ico +0 -0
  80. data/spec/dummy_test_app/tmp/.gitkeep +0 -0
  81. data/spec/features/select_files_spec.rb +8 -1
  82. data/spec/features/test_compiling_stylesheets_spec.rb +7 -1
  83. data/spec/lib/browse_everything/auth/google/credentials_spec.rb +1 -1
  84. data/spec/spec_helper.rb +2 -27
  85. data/spec/views/browse_everything/_files.html.erb_spec.rb +8 -7
  86. data/tasks/ci.rake +1 -1
  87. metadata +175 -76
  88. data/karma.conf.js +0 -71
  89. data/spec/javascripts/behavior_spec.js +0 -7
  90. data/spec/javascripts/helpers/jasmine-jquery.js +0 -838
  91. data/spec/javascripts/helpers/jquery.js +0 -11008
  92. data/spec/javascripts/karma_spec.rb +0 -16
  93. data/spec/support/app/views/file_handler/index.html.erb +0 -6
  94. data/spec/test_app_templates/Gemfile.extra +0 -18
  95. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -112
  96. /data/spec/{support → dummy_test_app}/app/controllers/file_handler_controller.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b80226009720a599afbe1c801e626b294a6d904ac29cfae3728b01bdb647424e
4
- data.tar.gz: 9b461e46201ee1c1b2c5a7a3bf10b525da5cf943c7930ac7fb2adae5933f2a1f
3
+ metadata.gz: b7cb857160ebc811eafac9247c7cec49eeac9b46edc453a2bb50eba106e58caf
4
+ data.tar.gz: 85551cebc8b3f2ae374b224e3fba8fd4f72126d58d12bab307977407119c5f75
5
5
  SHA512:
6
- metadata.gz: 5fe833958e65c9cab265e07253277fca93b3f34ca49fec14c60933c673d0affeb04a9546bc47a6da80a3bb4fe660e9f408a022b2092d907ff4595a00bc2fcc53
7
- data.tar.gz: 4950e8b37b3c5d2832733de91350bd9d9dcd41c35cafeab2cec61d1500fbe537bbf441eea2bbc3d20156cdfdc0a8b261e0712387173e7f8f40cfe5f45cd3e359
6
+ metadata.gz: b75481a9a77c377a58a97b40eca87fe8f5fc1465db82bc1043ce0380674666a4ff80e0459554ba3f042c9bf210add815d176bbbce41255d9fafb9642f123ce34
7
+ data.tar.gz: a1118f1b26cf47d276fb47194dedc13f3006ffa632613f7df1022445b37e12f2451c307e38bd07c3c22d4151cd7f71e580448caf7461a4ff02f499486e605a0b
data/.circleci/config.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  version: 2.1
3
3
  orbs:
4
- samvera: samvera/circleci-orb@0
4
+ samvera: samvera/circleci-orb@1.0
5
+ browser-tools: circleci/browser-tools@1.1
5
6
 
6
7
  jobs:
7
8
  build:
@@ -12,86 +13,122 @@ jobs:
12
13
  type: string
13
14
  bundler_version:
14
15
  type: string
15
- default: 2.1.4
16
+ default: 2.4.3
16
17
  executor:
17
18
  name: 'samvera/ruby'
18
19
  ruby_version: << parameters.ruby_version >>
19
20
  environment:
20
21
  RAILS_VERSION: << parameters.rails_version >>
21
22
  steps:
22
- - samvera/cached_checkout
23
+ - browser-tools/install-chrome
23
24
 
24
- - samvera/bundle_for_gem:
25
- bundler_version: << parameters.bundler_version >>
26
- ruby_version: << parameters.ruby_version >>
27
- project: 'browse-everything'
28
-
29
- - samvera/engine_cart_generate:
30
- cache_key: v1-internal-test-app-{{ checksum "browse-everything.gemspec" }}-{{ checksum "Gemfile" }}-{{ checksum "spec/test_app_templates/lib/generators/test_app_generator.rb" }}-{{ checksum "lib/generators/browse_everything/install_generator.rb" }}-{{ checksum "lib/generators/browse_everything/config_generator.rb" }}--<< parameters.rails_version >>-<< parameters.ruby_version >>
25
+ - samvera/cached_checkout
31
26
 
32
27
  - run:
33
- name: Update sprockets to fix version incompatibilities between internal test app and initial bundle install
34
- command: bundle update sprockets
28
+ name: Check for a branch named 'master'
29
+ command: |
30
+ git fetch --all --quiet --prune --prune-tags
31
+ if [[ -n "$(git branch --all --list master */master)" ]]; then
32
+ echo "A branch named 'master' was found. Please remove it."
33
+ echo "$(git branch --all --list master */master)"
34
+ fi
35
+ [[ -z "$(git branch --all --list master */master)" ]]
35
36
 
36
- - samvera/bundle_for_gem:
37
- ruby_version: << parameters.ruby_version >>
37
+ - samvera/bundle:
38
38
  bundler_version: << parameters.bundler_version >>
39
- project: 'browse-everything'
39
+ ruby_version: << parameters.ruby_version >>
40
40
 
41
41
  - samvera/rubocop
42
42
 
43
- - run:
44
- name: Install Karma for JavaScript and functional tests
45
- command: sudo npm install -g karma karma-jasmine karma-chrome-launcher
46
-
47
43
  - samvera/parallel_rspec
48
44
 
49
45
  workflows:
50
46
  ci:
51
47
  jobs:
52
48
  - build:
53
- name: "ruby2-7_rails6-0"
54
- ruby_version: 2.7.1
55
- rails_version: 6.0.3.1
49
+ name: "ruby3-2_rails7-1"
50
+ ruby_version: 3.2.1
51
+ rails_version: 7.1.1
56
52
  - build:
57
- name: "ruby2-6_rails6-0"
58
- ruby_version: 2.6.6
59
- rails_version: 6.0.3.1
53
+ name: "ruby3-2_rails7-0"
54
+ ruby_version: 3.2.0
55
+ rails_version: 7.0.4
60
56
  - build:
61
- name: "ruby2-5_rails6-0"
62
- ruby_version: 2.5.8
63
- rails_version: 6.0.3.1
57
+ name: "ruby3-1_rails7-0"
58
+ ruby_version: 3.1.2
59
+ rails_version: 7.0.4
64
60
 
65
61
  - build:
66
- name: "ruby2-7_rails5-2"
67
- ruby_version: 2.7.1
68
- rails_version: 5.2.4.3
62
+ name: "ruby3-1_rails6-1"
63
+ ruby_version: 3.1.2
64
+ rails_version: 6.1.6
65
+ - build:
66
+ name: "ruby3-0_rails6-1"
67
+ ruby_version: 3.0.3
68
+ rails_version: 6.1.6
69
+
69
70
  - build:
70
- name: "ruby2-6_rails5-2"
71
- ruby_version: 2.6.6
72
- rails_version: 5.2.4.3
71
+ name: "ruby3-0_rails6-0"
72
+ ruby_version: 3.0.3
73
+ rails_version: 6.0.4.7
73
74
  - build:
74
- name: "ruby2-5_rails5-2"
75
- ruby_version: 2.5.8
76
- rails_version: 5.2.4.3
75
+ name: "ruby2-7_rails6-0"
76
+ ruby_version: 2.7.7
77
+ rails_version: 6.0.4.7
78
+
77
79
  - build:
78
- name: "ruby2-4_rails5-2"
79
- ruby_version: 2.4.10
80
- rails_version: 5.2.4.3
80
+ name: "ruby2-7_rails5-2"
81
+ ruby_version: 2.7.7
82
+ rails_version: 5.2.7
81
83
 
82
84
  - build:
83
85
  name: "ruby2-7_rails5-1"
84
- ruby_version: 2.7.1
86
+ ruby_version: 2.7.7
85
87
  rails_version: 5.1.7
88
+
89
+ nightly:
90
+ triggers:
91
+ - schedule:
92
+ cron: "0 0 * * *"
93
+ filters:
94
+ branches:
95
+ only:
96
+ - main
97
+ jobs:
86
98
  - build:
87
- name: "ruby2-6_rails5-1"
88
- ruby_version: 2.6.6
89
- rails_version: 5.1.7
99
+ name: "ruby3-2_rails7-0"
100
+ ruby_version: 3.2.0
101
+ rails_version: 7.0.4
90
102
  - build:
91
- name: "ruby2-5_rails5-1"
92
- ruby_version: 2.5.8
93
- rails_version: 5.1.7
103
+ name: "ruby3-1_rails7-0"
104
+ ruby_version: 3.1.2
105
+ rails_version: 7.0.4
106
+
107
+ - build:
108
+ name: "ruby3-1_rails6-1"
109
+ ruby_version: 3.1.2
110
+ rails_version: 6.1.6
111
+ - build:
112
+ name: "ruby3-0_rails6-1"
113
+ ruby_version: 3.0.3
114
+ rails_version: 6.1.6
115
+
116
+ - build:
117
+ name: "ruby3-0_rails6-0"
118
+ ruby_version: 3.0.3
119
+ rails_version: 6.0.4.7
94
120
  - build:
95
- name: "ruby2-4_rails5-1"
96
- ruby_version: 2.4.10
121
+ name: "ruby2-7_rails6-0"
122
+ ruby_version: 2.7.7
123
+ rails_version: 6.0.4.7
124
+
125
+ - build:
126
+ name: "ruby2-7_rails5-2"
127
+ ruby_version: 2.7.7
128
+ rails_version: 5.2.7
129
+
130
+ - build:
131
+ name: "ruby2-7_rails5-1"
132
+ ruby_version: 2.7.7
97
133
  rails_version: 5.1.7
134
+
data/.gitignore CHANGED
@@ -16,5 +16,7 @@ spec/reports
16
16
  spec/fixtures/Getting Started.pdf
17
17
  test/tmp
18
18
  test/version_tmp
19
- tmp
20
- .internal_test_app
19
+ spec/dummy_test_app/tmp
20
+ spec/dummy_test_app/db
21
+ spec/dummy_test_app/log
22
+ !spec/dummy_test_app/tmp/.gitkeep
data/.rubocop.yml CHANGED
@@ -7,6 +7,14 @@ AllCops:
7
7
  DisplayCopNames: true
8
8
  Exclude:
9
9
  - 'vendor/**/*'
10
+ - 'spec/dummy_test_app/**/*'
11
+ - 'bin/rails'
12
+
13
+ Style/GuardClause:
14
+ Enabled: false
15
+
16
+ StyleI/IfUnlessModifier:
17
+ Enabled: false
10
18
 
11
19
  Bundler/DuplicatedGem:
12
20
  Exclude:
@@ -79,3 +87,7 @@ Style/NumericLiterals:
79
87
  Style/RedundantBegin:
80
88
  Exclude:
81
89
  - 'lib/browse_everything/browser.rb'
90
+
91
+ Style/IfUnlessModifier:
92
+ Exclude:
93
+ - 'Gemfile'
data/.rubocop_todo.yml CHANGED
@@ -31,11 +31,6 @@ Metrics/MethodLength:
31
31
  Metrics/ParameterLists:
32
32
  Max: 7
33
33
 
34
- # Offense count: 1
35
- RSpec/DescribeClass:
36
- Exclude:
37
- - 'spec/javascripts/jasmine_spec.rb'
38
-
39
34
  # Offense count: 2
40
35
  RSpec/MultipleExpectations:
41
36
  Max: 2
data/.tool-versions ADDED
@@ -0,0 +1,2 @@
1
+ ruby 2.7.5
2
+ nodejs lts-fermium
data/CONTRIBUTING.md CHANGED
@@ -22,6 +22,28 @@ https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Proper
22
22
 
23
23
  You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
24
24
 
25
+ ## Language
26
+
27
+ The language we use matters. Today, tomorrow, and for years to come
28
+ people will read the code we write. They will judge us for our
29
+ design, logic, and the words we use to describe the system.
30
+
31
+ Our words should be accessible. Favor descriptive words that give
32
+ meaning while avoiding reinforcing systemic inequities. For example,
33
+ in the Samvera community, we should favor using allowed\_list instead
34
+ of whitelist, denied\_list instead of blacklist, or source/copy
35
+ instead of master/slave.
36
+
37
+ We're going to get it wrong, but this is a call to keep working to
38
+ make it right. View our code and the words we choose as a chance to
39
+ have a conversation. A chance to grow an understanding of the systems
40
+ we develop as well as the systems in which we live.
41
+
42
+ See [“Blacklists” and “whitelists”: a salutary warning concerning the
43
+ prevalence of racist language in discussions of predatory
44
+ publishing](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6148600/) for
45
+ further details.
46
+
25
47
  ## Contribution Tasks
26
48
 
27
49
  * Reporting Issues
data/Gemfile CHANGED
@@ -9,38 +9,46 @@ group :development, :test do
9
9
  gem 'pry-byebug' unless ENV['CI']
10
10
  end
11
11
 
12
- # BEGIN ENGINE_CART BLOCK
13
- # engine_cart: 0.10.0
14
- # engine_cart stanza: 0.10.0
15
- # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
16
- file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
17
- if File.exist?(file)
18
- begin
19
- eval_gemfile file
20
- rescue Bundler::GemfileError => e
21
- Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
22
- Bundler.ui.warn e.message
23
- end
24
- else
25
- Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
26
-
27
- if ENV['RAILS_VERSION']
28
- if ENV['RAILS_VERSION'] == 'edge'
29
- gem 'rails', github: 'rails/rails'
30
- ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
31
- else
32
- gem 'rails', ENV['RAILS_VERSION']
33
- end
12
+ # == Extra dependencies for dummy test app ==
13
+ #
14
+ # Extra dependencies for dummy test app are in .gemspec as a development dependency
15
+ # where possible. But when dependencies vary for different versions
16
+ # of Rails, rails-version-specific dependencies are here, behind conditionals, for now.
17
+ #
18
+ # TODO switch to use appraisal gem instead, encapsulating these different additional
19
+ # dependencies per Rails version, as well as method of choosing operative rails version.
20
+ #
21
+ # We allow testing under multiple versions of Rails by setting ENV RAILS_VERSION,
22
+ # used in CI, can be used locally too.
23
+
24
+ # Set a default RAILS_VERSION so we make sure to get extra dependencies for it...
25
+
26
+ ENV['RAILS_VERSION'] ||= "7.1.1"
27
+
28
+ if ENV['RAILS_VERSION']
29
+ if ENV['RAILS_VERSION'] == 'edge'
30
+ gem 'rails', github: 'rails/rails'
31
+ else
32
+ gem 'rails', ENV['RAILS_VERSION']
34
33
  end
35
34
 
36
35
  case ENV['RAILS_VERSION']
37
- when /^6\./
38
- gem 'puma', '~> 4.1'
39
- when /^5\./
40
- gem 'capybara', '~> 2.18.0'
41
- gem 'puma', '~> 3.11'
36
+ when /^7\.1\./
37
+ # sprockets is optional for rails 7, but we currently require it, and test with it.
38
+ gem "sprockets-rails"
39
+ when /^7\.0\./
40
+ # sprockets is optional for rails 7, but we currently require it, and test with it.
41
+ gem "sprockets-rails"
42
+ when /^6\.1\./
43
+ # opt into mail 2.8.0.rc1 so we get extra dependencies required for rails 6.1
44
+ # Once mail 2.8.0 final is released this will not be required.
45
+ # https://github.com/mikel/mail/pull/1472
46
+ gem "mail", ">= 2.8.0.rc1"
47
+ when /^6\.0\./
48
+ gem 'sass-rails', '>= 6'
49
+ when /^5\.[12]\./
50
+ gem 'sass-rails', '~> 5.0'
51
+ gem 'sprockets', '~> 3.7'
52
+ gem 'thor', '~> 0.20'
42
53
  end
43
54
  end
44
- # END ENGINE_CART BLOCK
45
-
46
- eval_gemfile File.expand_path('spec/test_app_templates/Gemfile.extra', File.dirname(__FILE__)) unless File.exist?(file)
data/README.md CHANGED
@@ -3,13 +3,12 @@
3
3
  Code:
4
4
  [![Gem Version](https://badge.fury.io/rb/browse-everything.png)](http://badge.fury.io/rb/browse-everything)
5
5
  [![CircleCI](https://circleci.com/gh/samvera/browse-everything.svg?style=svg)](https://circleci.com/gh/samvera/browse-everything)
6
- [![Coverage Status](https://coveralls.io/repos/samvera/browse-everything/badge.svg?branch=master&service=github)](https://coveralls.io/github/samvera/browse-everything?branch=master)
7
6
 
8
7
  Docs:
9
8
  [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
10
9
  [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE.txt)
11
10
 
12
- Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
11
+ Community Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)
13
12
 
14
13
  # What is BrowseEverything?
15
14
 
@@ -25,29 +24,63 @@ download the files.
25
24
 
26
25
  **This gem does not depend on hydra-head**
27
26
 
27
+ ## Technical Debt/Legacy warning
28
+
29
+ This is code with a long history that has a number of known problems;
30
+ we are trying to keep it alive for existing projects using it. But caution is
31
+ advised in introducing it, in it's present form, to new projects.
32
+
33
+ A significant overhaul of this gem may be desirable (with backwards-breaking
34
+ changes), to better accomplish gem goals. But there has not been the
35
+ interest/resources in the community to accomplish that at present.
36
+
37
+ Some known current issues (Jun 2022):
38
+
39
+ * The S3 adapter is known working; but it's not clear if other adapters using
40
+ OAuth2 (main use case for this gem) are in fact working reliably. And there
41
+ is some concern that the current browse-everything integration API may not be
42
+ compatible with proper OAuth/OAuth2 flows to support OAuth integrations --
43
+ originally the main use case of this gem.
44
+
45
+ * The CSS and Javascript were both written for use with the sprockets Rails
46
+ asset pipeline. Recent versions of Rails may require custom configuration
47
+ to use sprockets (especially for JS), which is not currently covered in
48
+ instructions here. Using other means of including CSS and JS may require
49
+ confusing customization also not fully covered here.
50
+
51
+ * Javascript depends on JQuery, bootstrap (3 or 4; 5 untested), as well as a
52
+ vendored copy of a jquery.treetable plugin.
53
+
54
+ * CSS is provided for compatibilty with bootstrap 3 or bootstrap 4, but not
55
+ bootstrap 5 (or no bootstrap at all)
56
+
28
57
  ## Product Owner & Maintenance
29
58
 
30
- BrowseEverything is a Core Component of the Samvera community. The documentation for
31
- what this means can be found
32
- [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
59
+ `browse-everything` was a Core Component of the Samvera Community. Given a decline in available labor required for maintenance, this project no longer has a dedicated Product Owner. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
33
60
 
34
61
  ### Product Owner
35
62
 
36
- [mbklein](https://github.com/mbklein)
63
+ **Vacant**
64
+
65
+ _Until a Product Owner has been identified, we ask that you please direct all requests for support, bug reports, and general questions to the [`#dev` Channel on the Samvera Slack](https://samvera.slack.com/app_redirect?channel=dev)._
37
66
 
38
67
  # Getting Started
39
68
 
40
69
  ## Supported Ruby Releases
41
- Currently, the following releases of Ruby are supported:
42
- - 2.6.3
43
- - 2.5.5
44
- - 2.4.6
70
+ Currently, the following releases of Ruby are tested:
71
+ - 3.1
72
+ - 3.0
73
+ - 2.7
74
+ - 2.6
45
75
 
46
76
  ## Supported Rails Releases
47
77
  The supported Rail releases follow those specified by [the security policy of the Rails Community](https://rubyonrails.org/security/). As is the case with the supported Ruby releases, it is recommended that one upgrades from any Rails release no longer receiving security updates.
48
- - 6.0.3
49
- - 5.2.3
50
- - 5.1.7
78
+ - 7.1
79
+ - 7.0
80
+ - 6.1
81
+ - 6.0
82
+ - 5.2
83
+ - 5.1
51
84
 
52
85
  ## Installation
53
86
 
@@ -99,29 +132,6 @@ If your app has installed a previous version of browse-everything, you may have
99
132
 
100
133
  However, we also recommend merging the contents of this file into your main `application.scss` file, as documented in the current install instructions. With the separate generated file with bootstrap imports, you may likely be including bootstrap CSS in your generated CSS bundle twice, if you also have that import in your main application.scss already.
101
134
 
102
- ## Testing
103
- This is a Rails Engine which is tested using the [engine_cart](https://github.com/cbeer/engine_cart) Gem and rspec.
104
-
105
- One rspec test invokes [karma](https://karma-runner.github.io/latest/index.html) to run Javascript tests. For this test to succeed, you need to install karma on your system, first by making sure `npm` is installed, and then run `npm install -g karma karma-jasmine karma-chrome-launcher`.
106
-
107
- Test suites may be executed with the following invocation:
108
-
109
- ```bash
110
- bundle exec rake
111
- ```
112
-
113
- Tests by default will be run with bootstrap-4 integration. To test bootstrap-3 integration: `TEST_BOOTSTRAP=3 bundle exec rake`.
114
-
115
- ### Testing Problems
116
- Should you attempt to execute the test suite and encounter the following error:
117
- ```bash
118
- Your Ruby version is 2.x.x, but your Gemfile specified 2.y.z
119
- ```
120
- ...then you must clean the internal test app generated by `engine_cart` with the following:
121
- ```bash
122
- bundle exec rake engine_cart:clean
123
- ```
124
-
125
135
  ## Usage
126
136
 
127
137
  ### Adding Providers
@@ -252,6 +262,31 @@ See `spec/support/app/views/file_handler/index.html` for an example use case. Yo
252
262
  create a fully-functioning demo app in `spec/internal` (though you will have to create
253
263
  `spec/internal/config/browse_everything.providers.yml` file with your own configuration info.)
254
264
 
265
+ ## Development Testing
266
+
267
+ This is a Rails Engine which is tested using an in-repo "dummy" app, in the style of skeletons
268
+ generated by `rails plugin new --full`.
269
+
270
+ ### Rails utilities
271
+
272
+ This gives you Rails-provided tools you can run in project home dir, like: `./bin/rails console`, `./bin/rails server` (to start the dummy app in dev mode), `bundle exec rake db:drop db:create db:migrate` (db management in dummy app).
273
+
274
+ ### Test suite
275
+
276
+ Full CI/test suite may be executed with the following invocation:
277
+
278
+ ```bash
279
+ bundle exec rake
280
+ ```
281
+
282
+ Or individually, `bundle exec rubocop`, `bundle exec rspec`.
283
+
284
+ ### Testing with different versions of dependencies
285
+
286
+ You can test with different versions of rails by setting ENV variable `RAILS_VERSION` to a specific version like `"6.1.2"` or `"7.0.0"`, perhaps by `export RAILS_ENV=7.0.0` to set it in your shell session.
287
+
288
+ After changing `RAILS_VERSION` you may have to run `rm Gemfile.lock` and `bundle install` again. If you get a `Bundler could not find compatible versions...` error, for instance.
289
+
255
290
  # Help
256
291
 
257
292
  The Samvera community is here to help. Please see our [support guide](./SUPPORT.md).
data/Rakefile CHANGED
@@ -1,10 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ APP_RAKEFILE = File.expand_path("spec/dummy_test_app/Rakefile", __dir__)
10
+ load 'rails/tasks/engine.rake'
11
+
3
12
  require 'bundler/gem_tasks'
4
13
 
5
14
  Dir.glob('tasks/*.rake').each { |r| import r }
6
15
 
7
16
  require 'rspec/core/rake_task'
8
- require 'engine_cart/rake_task'
9
17
 
10
18
  task default: [:ci]
@@ -2,6 +2,7 @@
2
2
 
3
3
  $(function () {
4
4
  var dialog = $('div#browse-everything');
5
+ var selected_files = new Map(); // { url: input element object }
5
6
 
6
7
  var initialize = function initialize(obj, options) {
7
8
  if ($('div#browse-everything').length === 0) {
@@ -46,25 +47,21 @@ $(function () {
46
47
  return t.replace(/\+/g, ' ').split('=', 2);
47
48
  });
48
49
  var elements = $(fields).map(function () {
49
- return $("<input type='hidden'/>").attr('name', decodeURIComponent(this[0])).val(decodeURIComponent(this[1]))[0].outerHTML;
50
+ return $("<input type='hidden'/>").attr('name', decodeURIComponent(this[0])).val(decodeURIComponent(this[1]))[0];
50
51
  });
51
- return $(elements.toArray().join("\n"));
52
+ return $(elements.toArray());
52
53
  };
53
54
 
54
55
  var indicateSelected = function indicateSelected() {
55
- return $('input.ev-url').each(function () {
56
- return $('*[data-ev-location=\'' + $(this).val() + '\']').addClass('ev-selected');
56
+ return selected_files.forEach(function (value, key) {
57
+ var row = $('*[data-ev-location=\'' + key + '\']');
58
+ row.find('.ev-select-file').prop('checked', true);
59
+ return row.addClass('ev-selected');
57
60
  });
58
61
  };
59
62
 
60
63
  var fileIsSelected = function fileIsSelected(row) {
61
- var result = false;
62
- $('input.ev-url').each(function () {
63
- if (this.value === $(row).data('ev-location')) {
64
- return result = true;
65
- }
66
- });
67
- return result;
64
+ return selected_files.has(row.data('ev-location'));
68
65
  };
69
66
 
70
67
  var toggleFileSelect = function toggleFileSelect(row) {
@@ -77,27 +74,26 @@ $(function () {
77
74
  return updateFileCount();
78
75
  };
79
76
 
77
+ var hidden_input_prototype = $("<input type='hidden' class='ev-url' name='selected_files[]'/>");
80
78
  var selectFile = function selectFile(row) {
81
- var target_form = $('form.ev-submit-form');
82
79
  var file_location = row.data('ev-location');
83
- var hidden_input = $("<input type='hidden' class='ev-url' name='selected_files[]'/>").val(file_location);
84
- target_form.append(hidden_input);
80
+ var hidden_input = hidden_input_prototype.clone().val(file_location);
81
+ selected_files.set(file_location, hidden_input);
85
82
  if (!$(row).find('.ev-select-file').prop('checked')) {
86
83
  return $(row).find('.ev-select-file').prop('checked', true);
87
84
  }
88
85
  };
89
86
 
90
87
  var unselectFile = function unselectFile(row) {
91
- var target_form = $('form.ev-submit-form');
92
88
  var file_location = row.data('ev-location');
93
- $('form.ev-submit-form input[value=\'' + file_location + '\']').remove();
89
+ selected_files.delete(file_location);
94
90
  if ($(row).find('.ev-select-file').prop('checked')) {
95
91
  return $(row).find('.ev-select-file').prop('checked', false);
96
92
  }
97
93
  };
98
94
 
99
95
  var updateFileCount = function updateFileCount() {
100
- var count = $('input.ev-url').length;
96
+ var count = selected_files.size;
101
97
  var files = count === 1 ? "file" : "files";
102
98
  return $('.ev-status').html(count + ' ' + files + ' selected');
103
99
  };
@@ -125,7 +121,7 @@ $(function () {
125
121
  };
126
122
 
127
123
  var selectChildRows = function selectChildRows(row, action) {
128
- return $('table#file-list tr').each(function () {
124
+ var returned_rows = $('table#file-list tr').each(function () {
129
125
  if ($(this).data('tt-parent-id')) {
130
126
  var re = RegExp($(row).data('tt-id'), 'i');
131
127
  if ($(this).data('tt-parent-id').match(re)) {
@@ -149,11 +145,12 @@ $(function () {
149
145
  $(this).removeClass('ev-selected');
150
146
  unselectFile($(this));
151
147
  }
152
- return updateFileCount();
153
148
  }
154
149
  }
155
150
  }
156
151
  });
152
+ updateFileCount();
153
+ return returned_rows;
157
154
  };
158
155
 
159
156
  var tableSetup = function tableSetup(table) {
@@ -320,6 +317,7 @@ $(function () {
320
317
  $(document).on('click', 'button.ev-cancel', function (event) {
321
318
  event.preventDefault();
322
319
  dialog.data('ev-state').callbacks.cancel.fire();
320
+ selected_files.clear();
323
321
  return $('.ev-browser').modal('hide');
324
322
  });
325
323
 
@@ -327,6 +325,7 @@ $(function () {
327
325
  event.preventDefault();
328
326
  $(this).button('loading');
329
327
  startWait();
328
+ $('form.ev-submit-form').append(Array.from(selected_files.values()));
330
329
  var main_form = $(this).closest('form');
331
330
  var resolver_url = main_form.data('resolver');
332
331
  var ctx = dialog.data('ev-state');
@@ -338,12 +337,13 @@ $(function () {
338
337
  }).done(function (data) {
339
338
  if (ctx.opts.target != null) {
340
339
  var fields = toHiddenFields({ selected_files: data });
341
- $(ctx.opts.target).append($(fields));
340
+ $(ctx.opts.target).append(fields);
342
341
  }
343
342
  return ctx.callbacks.done.fire(data);
344
343
  }).fail(function (xhr, status, error) {
345
344
  return ctx.callbacks.fail.fire(status, error, xhr.responseText);
346
345
  }).always(function () {
346
+ selected_files.clear();
347
347
  $('body').css('cursor', 'default');
348
348
  $('.ev-browser').modal('hide');
349
349
  return $('#browse-btn').focus();
@@ -447,10 +447,16 @@ var auto_toggle = function auto_toggle() {
447
447
  if (typeof Turbolinks !== 'undefined' && Turbolinks !== null && Turbolinks.supported) {
448
448
  // Use turbolinks:load for Turbolinks 5, otherwise use the old way
449
449
  if (Turbolinks.BrowserAdapter) {
450
- $(document).on('turbolinks:load', auto_toggle);
450
+ $(document).on('turbolinks:load', function() {
451
+ // make sure turbolinks:load AND jquery onReady have BOTH happened,
452
+ // they could come in any order.
453
+ $(auto_toggle);
454
+ });
451
455
  } else {
452
- $(document).on('page:change', auto_toggle);
456
+ $(document).on('page:change', function() {
457
+ $(auto_toggle);
458
+ });
453
459
  }
454
460
  } else {
455
- $(document).ready(auto_toggle);
461
+ $(auto_toggle);
456
462
  }