browse-everything 1.0.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +82 -133
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +43 -35
  5. data/CONTRIBUTING.md +3 -3
  6. data/Gemfile +3 -6
  7. data/LICENSE.txt +205 -22
  8. data/README.md +7 -6
  9. data/app/assets/javascripts/browse_everything/behavior.js +16 -8
  10. data/app/assets/javascripts/treetable.webpack.js +687 -0
  11. data/app/controllers/browse_everything_controller.rb +60 -60
  12. data/app/helpers/browse_everything_helper.rb +4 -0
  13. data/app/views/browse_everything/_files.html.erb +4 -2
  14. data/browse-everything.gemspec +6 -7
  15. data/lib/browse_everything.rb +2 -1
  16. data/lib/browse_everything/auth/google/credentials.rb +5 -5
  17. data/lib/browse_everything/auth/google/request_parameters.rb +38 -38
  18. data/lib/browse_everything/driver/base.rb +14 -14
  19. data/lib/browse_everything/driver/box.rb +62 -55
  20. data/lib/browse_everything/driver/dropbox.rb +34 -33
  21. data/lib/browse_everything/driver/file_system.rb +30 -18
  22. data/lib/browse_everything/driver/google_drive.rb +40 -39
  23. data/lib/browse_everything/driver/s3.rb +61 -45
  24. data/lib/browse_everything/file_entry.rb +1 -1
  25. data/lib/browse_everything/retriever.rb +69 -69
  26. data/lib/browse_everything/version.rb +1 -1
  27. data/spec/features/test_compiling_stylesheets_spec.rb +1 -1
  28. data/spec/lib/browse_everything/driver_spec.rb +43 -3
  29. data/spec/spec_helper.rb +9 -3
  30. data/spec/support/capybara.rb +0 -5
  31. data/spec/test_app_templates/Gemfile.extra +9 -0
  32. data/spec/test_app_templates/lib/generators/test_app_generator.rb +54 -3
  33. metadata +49 -45
  34. data/.travis.yml +0 -30
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrowseEverything
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.2'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- describe 'Compiling the stylesheets', type: :feature do
3
+ describe 'Compiling the stylesheets', type: :feature, js: true do
4
4
  it 'does not raise errors' do
5
5
  visit '/'
6
6
  expect(page).not_to have_content 'Sass::SyntaxError'
@@ -15,9 +15,49 @@ describe BrowseEverything::Driver do
15
15
  end
16
16
  end
17
17
 
18
- describe '#sorter' do
19
- it 'defaults to nil' do
20
- expect(described_class.sorter).to be nil
18
+ after do
19
+ Object.send(:remove_const, :MyDriver)
20
+ end
21
+
22
+ describe '#default_sorter' do
23
+ let(:file1) do
24
+ instance_double(BrowseEverything::FileEntry)
25
+ end
26
+ let(:file2) do
27
+ instance_double(BrowseEverything::FileEntry)
28
+ end
29
+ let(:file3) do
30
+ instance_double(BrowseEverything::FileEntry)
31
+ end
32
+ let(:files) do
33
+ [
34
+ file1,
35
+ file2,
36
+ file3
37
+ ]
38
+ end
39
+
40
+ before do
41
+ class MyNewDriver < BrowseEverything::Driver::Base; end
42
+
43
+ allow(file1).to receive(:container?).and_return(false)
44
+ allow(file1).to receive(:name).and_return('test file1')
45
+ allow(file2).to receive(:container?).and_return(false)
46
+ allow(file2).to receive(:name).and_return('test file2')
47
+ allow(file3).to receive(:container?).and_return(true)
48
+ allow(file3).to receive(:name).and_return('test container1')
49
+ end
50
+ after do
51
+ Object.send(:remove_const, :MyNewDriver)
52
+ end
53
+
54
+ it 'defaults to proc which sorts by containers' do
55
+ expect(MyNewDriver.default_sorter).to be_a(Proc)
56
+
57
+ results = MyNewDriver.default_sorter.call(files)
58
+ expect(results.first.name).to eq file3.name
59
+ expect(results[1].name).to eq file1.name
60
+ expect(results.last.name).to eq file2.name
21
61
  end
22
62
  end
23
63
 
@@ -4,7 +4,7 @@ ENV['RAILS_ENV'] ||= 'test'
4
4
  require 'bundler/setup'
5
5
 
6
6
  def coverage_needed?
7
- ENV['COVERAGE'] || ENV['TRAVIS']
7
+ ENV['COVERAGE'] || ENV['CI']
8
8
  end
9
9
 
10
10
  if coverage_needed?
@@ -36,7 +36,7 @@ require 'capybara/rspec'
36
36
  require 'rspec'
37
37
  require 'rspec/rails'
38
38
  require 'rspec/its'
39
- require 'chromedriver-helper'
39
+ require 'webdrivers'
40
40
 
41
41
  # Requires supporting ruby files with custom matchers and macros, etc,
42
42
  # in spec/support/ and its subdirectories.
@@ -46,6 +46,12 @@ require 'webmock/rspec'
46
46
  WebMock.disable_net_connect!(allow_localhost: true)
47
47
 
48
48
  RSpec.configure do |config|
49
+ config.before(:each, type: :feature) { WebMock.disable! }
50
+ config.after(:each, type: :feature) do
51
+ WebMock.enable!
52
+ WebMock.disable_net_connect!(allow_localhost: true)
53
+ end
54
+
49
55
  config.expect_with :rspec do |c|
50
56
  c.syntax = %i[should expect]
51
57
  end
@@ -81,7 +87,7 @@ module BrowserConfigHelper
81
87
  app_key: 'S3AppKey',
82
88
  app_secret: 'S3AppSecret',
83
89
  bucket: 's3.bucket',
84
- region: 's3.region'
90
+ region: 'us-east-1'
85
91
  })
86
92
  end
87
93
 
@@ -4,11 +4,6 @@ require 'selenium-webdriver'
4
4
 
5
5
  # Temporary pin until chromedriver-helper patched to deal with change in chromedriver versioning
6
6
  # See https://github.com/flavorjones/chromedriver-helper/pull/63
7
- # @note In January 2018, TravisCI disabled Chrome sandboxing in its Linux
8
- # container build environments to mitigate Meltdown/Spectre
9
- # vulnerabilities, at which point Hyrax could no longer use the
10
- # Capybara-provided :selenium_chrome_headless driver (which does not
11
- # include the `--no-sandbox` argument).
12
7
  Capybara.register_driver :selenium_chrome_headless_sandboxless do |app|
13
8
  browser_options = ::Selenium::WebDriver::Chrome::Options.new
14
9
  browser_options.args << '--headless'
@@ -1,6 +1,15 @@
1
1
  gem 'jquery-rails'
2
2
  gem 'puma-rails'
3
3
 
4
+ if ENV['RAILS_VERSION']
5
+ case ENV['RAILS_VERSION']
6
+ when /6\./
7
+ gem 'webpacker', '~> 4.0'
8
+ when /5\./
9
+ gem 'webpacker', '~> 4.0'
10
+ end
11
+ end
12
+
4
13
  if ENV['TEST_BOOTSTRAP'] == "3"
5
14
  gem "bootstrap-sass"
6
15
  else
@@ -28,11 +28,62 @@ class TestAppGenerator < Rails::Generators::Base
28
28
  end
29
29
 
30
30
  def inject_javascript
31
- insert_into_file 'app/assets/javascripts/application.js', after: '//= require_tree .' do
32
- %(
31
+ if /^6\./.match?(Rails.version)
32
+ # Both jQuery and Twitter Bootstrap 3.x need to be added for legacy JavaScript
33
+ system('yarn add jquery@3.3.1')
34
+ system('yarn add bootstrap@3.4.1')
35
+ system('yarn install')
36
+
37
+ # Adding the JavaScript module dependencies
38
+ insert_into_file 'app/javascript/packs/application.js', after: 'require("channels")' do
39
+ %(
40
+ require("jquery")
41
+ require("bootstrap")
42
+ )
43
+ end
44
+
45
+ # Here the JavaScript needs to be injected for Webpacker
46
+ insert_into_file 'config/webpack/environment.js', after: "const { environment } = require('@rails/webpacker')" do
47
+ %(
48
+ const webpack = require('webpack')
49
+
50
+ environment.plugins.prepend('Provide',
51
+ new webpack.ProvidePlugin({
52
+ $: 'jquery/src/jquery',
53
+ jQuery: 'jquery/src/jquery'
54
+ })
55
+ )
56
+ )
57
+ end
58
+
59
+ # Copy the TreeTable JavaScript
60
+ copy_file('../../app/assets/javascripts/treetable.webpack.js', 'app/javascript/packs/treetable.js')
61
+
62
+ # Copy the browse_everything JavaScript
63
+ copy_file('../../app/assets/javascripts/browse_everything/behavior.js', 'app/javascript/packs/browse-everything.js')
64
+
65
+ # Adding the JavaScript module dependencies
66
+ insert_into_file 'app/javascript/packs/browse-everything.js', before: "'use strict';" do
67
+ %(
68
+ require("bootstrap")
69
+ require("./treetable")
70
+ )
71
+ end
72
+
73
+ # Load the new packs into the view
74
+ insert_into_file 'app/views/layouts/application.html.erb', before: '</head>' do
75
+ %(
76
+ <%= javascript_pack_tag 'treetable', 'data-turbolinks-track': 'reload' %>
77
+ <%= javascript_pack_tag 'browse-everything', 'data-turbolinks-track': 'reload' %>
78
+ )
79
+ end
80
+ else
81
+ insert_into_file 'app/assets/javascripts/application.js', after: '//= require_tree .' do
82
+ %(
33
83
  //= require jquery
34
84
  //= require browse_everything
35
- )
85
+ )
86
+ end
36
87
  end
37
88
  end
38
89
 
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.0.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carolyn Cole
@@ -10,10 +10,10 @@ authors:
10
10
  - Thomas Scherz
11
11
  - Xiaoming Wang
12
12
  - Jeremy Friesen
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2019-03-13 00:00:00.000000000 Z
16
+ date: 2020-11-18 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: addressable
@@ -75,30 +75,42 @@ dependencies:
75
75
  name: google_drive
76
76
  requirement: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - "~>"
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '2.1'
81
+ - - "<"
82
+ - !ruby/object:Gem::Version
83
+ version: '4'
81
84
  type: :runtime
82
85
  prerelease: false
83
86
  version_requirements: !ruby/object:Gem::Requirement
84
87
  requirements:
85
- - - "~>"
88
+ - - ">="
86
89
  - !ruby/object:Gem::Version
87
90
  version: '2.1'
91
+ - - "<"
92
+ - !ruby/object:Gem::Version
93
+ version: '4'
88
94
  - !ruby/object:Gem::Dependency
89
95
  name: googleauth
90
96
  requirement: !ruby/object:Gem::Requirement
91
97
  requirements:
92
- - - '='
98
+ - - ">="
93
99
  - !ruby/object:Gem::Version
94
100
  version: 0.6.6
101
+ - - "<"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
95
104
  type: :runtime
96
105
  prerelease: false
97
106
  version_requirements: !ruby/object:Gem::Requirement
98
107
  requirements:
99
- - - '='
108
+ - - ">="
100
109
  - !ruby/object:Gem::Version
101
110
  version: 0.6.6
111
+ - - "<"
112
+ - !ruby/object:Gem::Version
113
+ version: '1.0'
102
114
  - !ruby/object:Gem::Dependency
103
115
  name: rails
104
116
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +118,9 @@ dependencies:
106
118
  - - ">="
107
119
  - !ruby/object:Gem::Version
108
120
  version: '4.2'
121
+ - - "<"
122
+ - !ruby/object:Gem::Version
123
+ version: '7.0'
109
124
  type: :runtime
110
125
  prerelease: false
111
126
  version_requirements: !ruby/object:Gem::Requirement
@@ -113,6 +128,9 @@ dependencies:
113
128
  - - ">="
114
129
  - !ruby/object:Gem::Version
115
130
  version: '4.2'
131
+ - - "<"
132
+ - !ruby/object:Gem::Version
133
+ version: '7.0'
116
134
  - !ruby/object:Gem::Dependency
117
135
  name: ruby-box
118
136
  requirement: !ruby/object:Gem::Requirement
@@ -141,20 +159,6 @@ dependencies:
141
159
  - - "~>"
142
160
  - !ruby/object:Gem::Version
143
161
  version: '0.8'
144
- - !ruby/object:Gem::Dependency
145
- name: thor
146
- requirement: !ruby/object:Gem::Requirement
147
- requirements:
148
- - - "~>"
149
- - !ruby/object:Gem::Version
150
- version: '0.19'
151
- type: :runtime
152
- prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- requirements:
155
- - - "~>"
156
- - !ruby/object:Gem::Version
157
- version: '0.19'
158
162
  - !ruby/object:Gem::Dependency
159
163
  name: typhoeus
160
164
  requirement: !ruby/object:Gem::Requirement
@@ -173,28 +177,28 @@ dependencies:
173
177
  name: bixby
174
178
  requirement: !ruby/object:Gem::Requirement
175
179
  requirements:
176
- - - ">="
180
+ - - "~>"
177
181
  - !ruby/object:Gem::Version
178
- version: '1.0'
182
+ version: '3.0'
179
183
  type: :development
180
184
  prerelease: false
181
185
  version_requirements: !ruby/object:Gem::Requirement
182
186
  requirements:
183
- - - ">="
187
+ - - "~>"
184
188
  - !ruby/object:Gem::Version
185
- version: '1.0'
189
+ version: '3.0'
186
190
  - !ruby/object:Gem::Dependency
187
191
  name: bundler
188
192
  requirement: !ruby/object:Gem::Requirement
189
193
  requirements:
190
- - - "~>"
194
+ - - ">="
191
195
  - !ruby/object:Gem::Version
192
196
  version: '1.3'
193
197
  type: :development
194
198
  prerelease: false
195
199
  version_requirements: !ruby/object:Gem::Requirement
196
200
  requirements:
197
- - - "~>"
201
+ - - ">="
198
202
  - !ruby/object:Gem::Version
199
203
  version: '1.3'
200
204
  - !ruby/object:Gem::Dependency
@@ -211,20 +215,6 @@ dependencies:
211
215
  - - ">="
212
216
  - !ruby/object:Gem::Version
213
217
  version: '0'
214
- - !ruby/object:Gem::Dependency
215
- name: chromedriver-helper
216
- requirement: !ruby/object:Gem::Requirement
217
- requirements:
218
- - - "~>"
219
- - !ruby/object:Gem::Version
220
- version: '2.1'
221
- type: :development
222
- prerelease: false
223
- version_requirements: !ruby/object:Gem::Requirement
224
- requirements:
225
- - - "~>"
226
- - !ruby/object:Gem::Version
227
- version: '2.1'
228
218
  - !ruby/object:Gem::Dependency
229
219
  name: coveralls
230
220
  requirement: !ruby/object:Gem::Requirement
@@ -435,6 +425,20 @@ dependencies:
435
425
  - - ">="
436
426
  - !ruby/object:Gem::Version
437
427
  version: '0'
428
+ - !ruby/object:Gem::Dependency
429
+ name: webdrivers
430
+ requirement: !ruby/object:Gem::Requirement
431
+ requirements:
432
+ - - ">="
433
+ - !ruby/object:Gem::Version
434
+ version: '0'
435
+ type: :development
436
+ prerelease: false
437
+ version_requirements: !ruby/object:Gem::Requirement
438
+ requirements:
439
+ - - ">="
440
+ - !ruby/object:Gem::Version
441
+ version: '0'
438
442
  - !ruby/object:Gem::Dependency
439
443
  name: webmock
440
444
  requirement: !ruby/object:Gem::Requirement
@@ -467,7 +471,6 @@ files:
467
471
  - ".rspec"
468
472
  - ".rubocop.yml"
469
473
  - ".rubocop_todo.yml"
470
- - ".travis.yml"
471
474
  - CODE_OF_CONDUCT.md
472
475
  - CONTRIBUTING.md
473
476
  - Gemfile
@@ -478,6 +481,7 @@ files:
478
481
  - SUPPORT.md
479
482
  - app/assets/javascripts/browse_everything.js
480
483
  - app/assets/javascripts/browse_everything/behavior.js
484
+ - app/assets/javascripts/treetable.webpack.js
481
485
  - app/assets/stylesheets/browse_everything.scss
482
486
  - app/assets/stylesheets/browse_everything/_browse_everything.scss
483
487
  - app/assets/stylesheets/browse_everything/_browse_everything_bootstrap3.scss
@@ -565,7 +569,7 @@ homepage: https://github.com/projecthydra/browse-everything
565
569
  licenses:
566
570
  - Apache 2
567
571
  metadata: {}
568
- post_install_message:
572
+ post_install_message:
569
573
  rdoc_options: []
570
574
  require_paths:
571
575
  - lib
@@ -580,8 +584,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
580
584
  - !ruby/object:Gem::Version
581
585
  version: '0'
582
586
  requirements: []
583
- rubygems_version: 3.0.1
584
- signing_key:
587
+ rubygems_version: 3.0.3
588
+ signing_key:
585
589
  specification_version: 4
586
590
  summary: AJAX/Rails engine file browser for cloud storage services
587
591
  test_files:
@@ -1,30 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- dist: trusty
4
- sudo: required
5
- addons:
6
- chrome: stable
7
- cache:
8
- bundler: true
9
-
10
- before_install:
11
- - gem update --system # https://docs.travis-ci.com/user/languages/ruby/#Upgrading-RubyGems
12
- - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
13
- - gem install bundler -v '< 2'
14
- - npm install -g karma karma-jasmine karma-chrome-launcher
15
- - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
16
-
17
- rvm:
18
- - 2.6.1
19
- - 2.5.3
20
- - 2.4.5
21
-
22
- env:
23
- global:
24
- - CHROME_BIN=google-chrome-stable
25
- - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
26
- matrix:
27
- - "RAILS_VERSION=5.2.2"
28
- - "RAILS_VERSION=5.2.2 TEST_BOOTSTRAP=3"
29
- - "RAILS_VERSION=5.1.6.1"
30
- - "RAILS_VERSION=5.1.6.1 TEST_BOOTSTRAP=3"