browse-everything 1.4.0 → 1.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1bbd0aea13e58513c925280595410ffeba0ceef0e8788edd2c91464e2c9ed23
4
- data.tar.gz: ee947852e47f4ffd65373df2c9e07639a79dcac7630024f180b2aaeddb3052a0
3
+ metadata.gz: eedf3447096af5429b239653b707bf23e881fcd43a097cbe25804c7d48bc16e2
4
+ data.tar.gz: 1ccf9adb1e189a413ae6ceb9a4e67bccfae3a5179c84f583c1b165f4e051cf00
5
5
  SHA512:
6
- metadata.gz: 4b7849dc7f82467af80ff48502e4c585bbfece43c9b3c688460af3a9ab64b3de7dc4ccde0eac8921d3cd20c8212affe68fd49b83ff725167113b0fca73c52e7a
7
- data.tar.gz: b4a3532171ab1fd2b65575445aa9a1d83713ee29e6f0d3903090db010c2548a77e51a077cf5a49a20cdb744a2d7d6eb3523cc48313cffd70e7d456bf2304f38d
6
+ metadata.gz: 58511d9c04085a4a9d72246c906bb20cb46bac2e980d17bf90276807b67fe4c38eab79dbae89c10a69e735da6ee2e0acffe0399fe7993526a0454886cc3555ee
7
+ data.tar.gz: 5484761c6ed0b148ba8a10852dea363a1c6860b146271dd0b8bedbad65f37dfb50b0644f3da2ae533c0b84c782fadea9d808f8d1f2d10d1acb00e3ee8f9d6b34
data/.circleci/config.yml CHANGED
@@ -13,7 +13,7 @@ jobs:
13
13
  type: string
14
14
  bundler_version:
15
15
  type: string
16
- default: 2.4.3
16
+ default: 2.5.21
17
17
  executor:
18
18
  name: 'samvera/ruby'
19
19
  ruby_version: << parameters.ruby_version >>
@@ -45,52 +45,30 @@ jobs:
45
45
  workflows:
46
46
  ci:
47
47
  jobs:
48
+ - build:
49
+ name: "ruby3-3_rails8-0"
50
+ ruby_version: 3.3.6
51
+ rails_version: 8.0.0.1
48
52
  - build:
49
53
  name: "ruby3-3_rails7-2"
50
- ruby_version: 3.3.3
51
- rails_version: "7.2.0"
52
-
53
-
54
+ ruby_version: 3.3.6
55
+ rails_version: 7.2.1
54
56
  - build:
55
57
  name: "ruby3-2_rails7-1"
56
- ruby_version: 3.2.1
57
- rails_version: 7.1.1
58
+ ruby_version: 3.2.5
59
+ rails_version: 7.1.4
58
60
  - build:
59
61
  name: "ruby3-2_rails7-0"
60
- ruby_version: 3.2.0
61
- rails_version: 7.0.4
62
+ ruby_version: 3.2.5
63
+ rails_version: 7.0.8.4
62
64
  - build:
63
65
  name: "ruby3-1_rails7-0"
64
- ruby_version: 3.1.2
65
- rails_version: 7.0.4
66
-
66
+ ruby_version: 3.1.6
67
+ rails_version: 7.0.8.4
67
68
  - build:
68
69
  name: "ruby3-1_rails6-1"
69
- ruby_version: 3.1.2
70
- rails_version: 6.1.6
71
- - build:
72
- name: "ruby3-0_rails6-1"
73
- ruby_version: 3.0.3
74
- rails_version: 6.1.6
75
-
76
- - build:
77
- name: "ruby3-0_rails6-0"
78
- ruby_version: 3.0.3
79
- rails_version: 6.0.4.7
80
- - build:
81
- name: "ruby2-7_rails6-0"
82
- ruby_version: 2.7.7
83
- rails_version: 6.0.4.7
84
-
85
- - build:
86
- name: "ruby2-7_rails5-2"
87
- ruby_version: 2.7.7
88
- rails_version: 5.2.7
89
-
90
- - build:
91
- name: "ruby2-7_rails5-1"
92
- ruby_version: 2.7.7
93
- rails_version: 5.1.7
70
+ ruby_version: 3.1.6
71
+ rails_version: 6.1.7.8
94
72
 
95
73
  nightly:
96
74
  triggers:
@@ -101,45 +79,28 @@ workflows:
101
79
  only:
102
80
  - main
103
81
  jobs:
82
+ - build:
83
+ name: "ruby3-3_rails8-0"
84
+ ruby_version: 3.3.6
85
+ rails_version: 8.0.0.1
104
86
  - build:
105
87
  name: "ruby3-3_rails7-2"
106
- ruby_version: 3.3.3
107
- rails_version: "7.2.0"
108
-
88
+ ruby_version: 3.3.5
89
+ rails_version: 7.2.1
90
+ - build:
91
+ name: "ruby3-2_rails7-1"
92
+ ruby_version: 3.2.5
93
+ rails_version: 7.1.4
109
94
  - build:
110
95
  name: "ruby3-2_rails7-0"
111
- ruby_version: 3.2.0
112
- rails_version: 7.0.4
96
+ ruby_version: 3.2.5
97
+ rails_version: 7.0.8.4
113
98
  - build:
114
99
  name: "ruby3-1_rails7-0"
115
- ruby_version: 3.1.2
116
- rails_version: 7.0.4
117
-
100
+ ruby_version: 3.1.6
101
+ rails_version: 7.0.8.4
118
102
  - build:
119
103
  name: "ruby3-1_rails6-1"
120
- ruby_version: 3.1.2
121
- rails_version: 6.1.6
122
- - build:
123
- name: "ruby3-0_rails6-1"
124
- ruby_version: 3.0.3
125
- rails_version: 6.1.6
126
-
127
- - build:
128
- name: "ruby3-0_rails6-0"
129
- ruby_version: 3.0.3
130
- rails_version: 6.0.4.7
131
- - build:
132
- name: "ruby2-7_rails6-0"
133
- ruby_version: 2.7.7
134
- rails_version: 6.0.4.7
135
-
136
- - build:
137
- name: "ruby2-7_rails5-2"
138
- ruby_version: 2.7.7
139
- rails_version: 5.2.7
140
-
141
- - build:
142
- name: "ruby2-7_rails5-1"
143
- ruby_version: 2.7.7
144
- rails_version: 5.1.7
104
+ ruby_version: 3.1.6
105
+ rails_version: 6.1.7.8
145
106
 
data/.tool-versions CHANGED
@@ -1,2 +1,2 @@
1
- ruby 2.7.5
2
- nodejs lts-fermium
1
+ ruby 3.1.6
2
+ nodejs lts-gallium
data/Gemfile CHANGED
@@ -23,7 +23,7 @@ end
23
23
 
24
24
  # Set a default RAILS_VERSION so we make sure to get extra dependencies for it...
25
25
 
26
- ENV['RAILS_VERSION'] ||= "7.1.1"
26
+ ENV['RAILS_VERSION'] ||= "8.0.0"
27
27
 
28
28
  if ENV['RAILS_VERSION']
29
29
  if ENV['RAILS_VERSION'] == 'edge'
@@ -33,22 +33,42 @@ if ENV['RAILS_VERSION']
33
33
  end
34
34
 
35
35
  case ENV['RAILS_VERSION']
36
+ when /^8./
37
+ # sprockets is not usually included in Rails 8, but we currently require it, and test with it.
38
+ gem "sprockets-rails"
36
39
  when /^7\.1\./
37
40
  # sprockets is optional for rails 7, but we currently require it, and test with it.
38
41
  gem "sprockets-rails"
39
42
  when /^7\.0\./
43
+ # rails previous to 7.1 can't use sqlite 2
44
+ gem "sqlite3", "~> 1.4"
45
+
40
46
  # sprockets is optional for rails 7, but we currently require it, and test with it.
41
47
  gem "sprockets-rails"
48
+
49
+ # workaround bug in old rails
50
+ # https://github.com/rails/rails/pull/54264
51
+ gem "concurrent-ruby", "< 1.3.5"
42
52
  when /^6\.1\./
53
+ # rails previous to 7.1 can't use sqlite 2
54
+ gem "sqlite3", "~> 1.4"
55
+
43
56
  # opt into mail 2.8.0.rc1 so we get extra dependencies required for rails 6.1
44
57
  # Once mail 2.8.0 final is released this will not be required.
45
58
  # https://github.com/mikel/mail/pull/1472
46
59
  gem "mail", ">= 2.8.0.rc1"
60
+
61
+ # workaround bug in old rails
62
+ # https://github.com/rails/rails/pull/54264
63
+ gem "concurrent-ruby", "< 1.3.5"
47
64
  when /^6\.0\./
65
+ # rails previous to 7.1 can't use sqlite 2
66
+ gem "sqlite3", "~> 1.4"
67
+
48
68
  gem 'sass-rails', '>= 6'
49
- when /^5\.[12]\./
50
- gem 'sass-rails', '~> 5.0'
51
- gem 'sprockets', '~> 3.7'
52
- gem 'thor', '~> 0.20'
69
+
70
+ # workaround bug in old rails
71
+ # https://github.com/rails/rails/pull/54264
72
+ gem "concurrent-ruby", "< 1.3.5"
53
73
  end
54
74
  end
data/README.md CHANGED
@@ -26,33 +26,48 @@ download the files.
26
26
 
27
27
  ## Technical Debt/Legacy warning
28
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.
29
+ This project has been receiving very limited maintenance for at least 2-4 years
30
+ now -- just enough to keep it working for present users. Caution is indicated in
31
+ considering adoption for new projects.
32
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.
33
+ ### Known issues (Nov 2024)
36
34
 
37
- Some known current issues (Jun 2022):
35
+ * The S3 local file system adapters are known working. It's not clear if any other
36
+ adapters are working properly -- or if the browse_everything architecture as is
37
+ is sufficient to support OAuth2 integration flows that may be required to get them
38
+ working.
38
39
 
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.
40
+ * CSS and Javascript were both written for use with sprockets asset pipeline, and are
41
+ currently only tested with sprockets -- even in Rails 8, where `rails new` cannot
42
+ generate a sprockets using app.
43
+ * For use with Rails 8, you could consider adding sprockets to your app manually,
44
+ or copying browse_everything JS and CSS assets into your local app and including
45
+ them that way. The browse_everything installer is not capable of doing this
46
+ in an automated fashion.
44
47
 
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.
48
+ * Good news: The `bootstrap4` CSS is tentatively demonstrated working with bootstrap 5
49
+ too.
50
50
 
51
- * Javascript depends on JQuery, bootstrap (3 or 4; 5 untested), as well as a
52
- vendored copy of a jquery.treetable plugin.
51
+ * JS depends on JQuery, which is unfortunate in 2024. As well as a vendored copy of
52
+ a jquery.treetable plugin.
53
53
 
54
- * CSS is provided for compatibilty with bootstrap 3 or bootstrap 4, but not
55
- bootstrap 5 (or no bootstrap at all)
54
+ ### Possible path to a revived gem
55
+
56
+ If there are interest and resources, assuming a major version release.
57
+
58
+ * Rewrite JS from the ground up to be vanilla JS without JQuery.
59
+ * And useable by either `importmap-rails` or an npm-based rails JS bundler.
60
+
61
+ * Figure out what adapters actually work, drop those that don't work from the gem.
62
+ * Possibly find adapters in PR's or forks that work and can be added.
63
+
64
+ * Testing overhaul
65
+ * Adapters have their network communication with cloud mocked for good reason,
66
+ but that makes them false negative and unreliable at detecting breakage.
67
+ * Testing is done with an in-repo Rails app instead of engine_cart, which
68
+ is probably reasonable, but that makes it harder to really test integration
69
+ with differnet rails versions or test the installer works, as Rails has had
70
+ churn in JS. go back to engine_cart, or consider [combustion](https://github.com/pat/combustion)
56
71
 
57
72
  ## Product Owner & Maintenance
58
73
 
@@ -23,10 +23,10 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency 'dropbox_api', '>= 0.1.20'
24
24
  spec.add_dependency 'google-apis-drive_v3'
25
25
  spec.add_dependency 'googleauth', '>= 0.6.6', '< 2.0'
26
- spec.add_dependency 'rails', '>= 4.2', '< 8.0'
26
+ spec.add_dependency 'rails', '>= 4.2', '< 8.1'
27
27
  spec.add_dependency 'ruby-box'
28
28
  spec.add_dependency 'signet', '~> 0.8'
29
- spec.add_dependency 'typhoeus'
29
+ spec.add_dependency 'faraday', "~> 2.0"
30
30
 
31
31
  # Development dependencies include dependencies necessary for running
32
32
  # the dummy test app at ./spec/dummy_test_app
@@ -49,7 +49,7 @@ Gem::Specification.new do |spec|
49
49
  spec.add_development_dependency 'sass-rails'
50
50
  spec.add_development_dependency 'selenium-webdriver'
51
51
  # Rails <= 7.1 can't use sqlite3 gem 2.x yet
52
- spec.add_development_dependency 'sqlite3', "~> 1.4"
52
+ spec.add_development_dependency 'sqlite3'
53
53
  spec.add_development_dependency 'turbolinks'
54
54
  spec.add_development_dependency 'webdrivers'
55
55
  spec.add_development_dependency 'webmock'
@@ -70,7 +70,7 @@ module BrowseEverything
70
70
  # @param path [String] the path (default to the root)
71
71
  # @return [Array<BrowseEverything::FileEntry>] file entries for the path
72
72
  def list_files(drive, request_params, path: '')
73
- drive.list_files(request_params.to_h) do |file_list, error|
73
+ drive.list_files(**request_params.to_h) do |file_list, error|
74
74
  # Raise an exception if there was an error Google API's
75
75
  if error.present?
76
76
  # In order to properly trigger reauthentication, the token must be cleared
@@ -2,25 +2,25 @@
2
2
 
3
3
  require 'addressable'
4
4
  require 'tempfile'
5
- require 'typhoeus'
5
+ require 'faraday'
6
6
 
7
7
  module BrowseEverything
8
8
  # Class for raising errors when a download is invalid
9
9
  class DownloadError < StandardError
10
- attr_reader :response
10
+ attr_accessor :response_body
11
11
 
12
12
  # Constructor
13
13
  # @param msg [String]
14
- # @param response [Typhoeus::Response] response from the server
15
- def initialize(msg, response)
16
- @response = response
14
+ # @param response [String] response from the server
15
+ def initialize(msg, response_body)
16
+ @response_body = response_body
17
17
  super(msg)
18
18
  end
19
19
 
20
20
  # Generate the message for the exception
21
21
  # @return [String]
22
22
  def message
23
- "#{super}: #{response.body}"
23
+ "#{super}: #{response_body}"
24
24
  end
25
25
  end
26
26
 
@@ -36,7 +36,7 @@ module BrowseEverything
36
36
  # @param headers [Hash] any custom headers required to transit the request
37
37
  def can_retrieve?(uri, headers = {})
38
38
  request_headers = headers.merge(Range: 'bytes=0-0')
39
- response = Typhoeus.get(uri, headers: request_headers)
39
+ response = Faraday.get(uri, headers: request_headers)
40
40
  response.success?
41
41
  end
42
42
  end
@@ -133,17 +133,23 @@ module BrowseEverything
133
133
  file_size = options.fetch(:file_size)
134
134
  headers = options.fetch(:headers)
135
135
  url = options.fetch(:url)
136
- retrieved = 0
137
-
138
- request = Typhoeus::Request.new(url.to_s, method: :get, headers: headers)
139
- request.on_headers do |response|
140
- raise DownloadError.new("#{self.class}: Failed to download #{url}: Status Code: #{response.code}", response) unless response.code == 200
136
+ error_response = +""
137
+
138
+ conn = Faraday.new(url.to_s, headers: headers)
139
+ response = conn.get do |req|
140
+ req.options.on_data = proc do |chunk, overall_received_bytes, env|
141
+ if env.status == 200
142
+ # will yield to block passed in to outer retrieve_http, amazing.
143
+ yield(chunk, overall_received_bytes, file_size)
144
+ else
145
+ error_response << chunk
146
+ end
147
+ end
141
148
  end
142
- request.on_body do |chunk|
143
- retrieved += chunk.bytesize
144
- yield(chunk, retrieved, file_size)
149
+
150
+ unless response.status == 200
151
+ raise DownloadError.new("#{self.class}: Failed to download #{url}: Status Code: #{response.status}", error_response)
145
152
  end
146
- request.run
147
153
  end
148
154
 
149
155
  # Retrieve the file size
@@ -158,7 +164,7 @@ module BrowseEverything
158
164
  when 'file'
159
165
  File.size(url.path)
160
166
  when /https?/
161
- response = Typhoeus.head(url.to_s, headers: headers)
167
+ response = Faraday.head(url.to_s, headers: headers)
162
168
  length_value = response.headers['Content-Length'] || file_size
163
169
  length_value.to_i
164
170
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrowseEverything
4
- VERSION = '1.4.0'
4
+ VERSION = '1.6.0'
5
5
  end
@@ -160,12 +160,13 @@ describe BrowseEverything::Retriever do
160
160
  stub_request(
161
161
  :get, "https://retrieve.cloud.example.com/some/dir/file_error.pdf"
162
162
  ).and_return(
163
- status: 403
163
+ status: 403,
164
+ body: "Did not like this"
164
165
  )
165
166
  end
166
167
 
167
168
  it 'raises an exception' do
168
- expect { retriever.download(download_options) }.to raise_error(BrowseEverything::DownloadError, /BrowseEverything::Retriever: Failed to download/)
169
+ expect { retriever.download(download_options) }.to raise_error(BrowseEverything::DownloadError, /BrowseEverything::Retriever: Failed to download.* Status Code: 403.*Did not like this/)
169
170
  end
170
171
  end
171
172
  end
@@ -234,7 +235,7 @@ describe BrowseEverything::Retriever do
234
235
  let(:url) { 'https://retrieve.cloud.example.com/some/dir/can_retrieve.pdf' }
235
236
  before do
236
237
  stub_request(
237
- :get, "https://retrieve.cloud.example.com/some/dir/can_retrieve.pdf"
238
+ :get, %r{^https://retrieve.cloud.example.com/some/dir/can_retrieve.pdf\?}
238
239
  ).to_return(
239
240
  status: 206,
240
241
  body: '%'
@@ -250,7 +251,7 @@ describe BrowseEverything::Retriever do
250
251
  let(:url) { 'https://retrieve.cloud.example.com/some/dir/cannot_retrieve.pdf' }
251
252
  before do
252
253
  stub_request(
253
- :get, "https://retrieve.cloud.example.com/some/dir/cannot_retrieve.pdf"
254
+ :get, %r{^https://retrieve.cloud.example.com/some/dir/cannot_retrieve.pdf\?}
254
255
  ).to_return(
255
256
  status: 403
256
257
  )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browse-everything
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carolyn Cole
@@ -10,10 +10,9 @@ authors:
10
10
  - Thomas Scherz
11
11
  - Xiaoming Wang
12
12
  - Jeremy Friesen
13
- autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2024-08-20 00:00:00.000000000 Z
15
+ date: 1980-01-02 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: addressable
@@ -100,7 +99,7 @@ dependencies:
100
99
  version: '4.2'
101
100
  - - "<"
102
101
  - !ruby/object:Gem::Version
103
- version: '8.0'
102
+ version: '8.1'
104
103
  type: :runtime
105
104
  prerelease: false
106
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -110,7 +109,7 @@ dependencies:
110
109
  version: '4.2'
111
110
  - - "<"
112
111
  - !ruby/object:Gem::Version
113
- version: '8.0'
112
+ version: '8.1'
114
113
  - !ruby/object:Gem::Dependency
115
114
  name: ruby-box
116
115
  requirement: !ruby/object:Gem::Requirement
@@ -140,19 +139,19 @@ dependencies:
140
139
  - !ruby/object:Gem::Version
141
140
  version: '0.8'
142
141
  - !ruby/object:Gem::Dependency
143
- name: typhoeus
142
+ name: faraday
144
143
  requirement: !ruby/object:Gem::Requirement
145
144
  requirements:
146
- - - ">="
145
+ - - "~>"
147
146
  - !ruby/object:Gem::Version
148
- version: '0'
147
+ version: '2.0'
149
148
  type: :runtime
150
149
  prerelease: false
151
150
  version_requirements: !ruby/object:Gem::Requirement
152
151
  requirements:
153
- - - ">="
152
+ - - "~>"
154
153
  - !ruby/object:Gem::Version
155
- version: '0'
154
+ version: '2.0'
156
155
  - !ruby/object:Gem::Dependency
157
156
  name: bixby
158
157
  requirement: !ruby/object:Gem::Requirement
@@ -395,16 +394,16 @@ dependencies:
395
394
  name: sqlite3
396
395
  requirement: !ruby/object:Gem::Requirement
397
396
  requirements:
398
- - - "~>"
397
+ - - ">="
399
398
  - !ruby/object:Gem::Version
400
- version: '1.4'
399
+ version: '0'
401
400
  type: :development
402
401
  prerelease: false
403
402
  version_requirements: !ruby/object:Gem::Requirement
404
403
  requirements:
405
- - - "~>"
404
+ - - ">="
406
405
  - !ruby/object:Gem::Version
407
- version: '1.4'
406
+ version: '0'
408
407
  - !ruby/object:Gem::Dependency
409
408
  name: turbolinks
410
409
  requirement: !ruby/object:Gem::Requirement
@@ -616,7 +615,6 @@ homepage: https://github.com/projecthydra/browse-everything
616
615
  licenses:
617
616
  - Apache 2
618
617
  metadata: {}
619
- post_install_message:
620
618
  rdoc_options: []
621
619
  require_paths:
622
620
  - lib
@@ -631,8 +629,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
631
629
  - !ruby/object:Gem::Version
632
630
  version: '0'
633
631
  requirements: []
634
- rubygems_version: 3.5.9
635
- signing_key:
632
+ rubygems_version: 3.7.1
636
633
  specification_version: 4
637
634
  summary: AJAX/Rails engine file browser for cloud storage services
638
635
  test_files: