browse-everything 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +105 -30
  3. data/.gitignore +4 -2
  4. data/.rubocop.yml +54 -34
  5. data/.rubocop_todo.yml +0 -5
  6. data/.tool-versions +2 -0
  7. data/CONTRIBUTING.md +22 -0
  8. data/Gemfile +41 -33
  9. data/README.md +66 -31
  10. data/Rakefile +9 -1
  11. data/app/assets/javascripts/browse_everything/behavior.js +45 -31
  12. data/app/assets/javascripts/browse_everything.js +1 -1
  13. data/app/assets/javascripts/treetable.webpack.js +687 -0
  14. data/app/controllers/browse_everything_controller.rb +60 -60
  15. data/app/helpers/browse_everything_helper.rb +4 -0
  16. data/app/views/browse_everything/_files.html.erb +3 -2
  17. data/bin/rails +14 -0
  18. data/browse-everything.gemspec +13 -12
  19. data/lib/browse_everything/auth/google/credentials.rb +5 -5
  20. data/lib/browse_everything/auth/google/request_parameters.rb +38 -38
  21. data/lib/browse_everything/driver/base.rb +15 -14
  22. data/lib/browse_everything/driver/box.rb +56 -56
  23. data/lib/browse_everything/driver/dropbox.rb +44 -41
  24. data/lib/browse_everything/driver/file_system.rb +31 -18
  25. data/lib/browse_everything/driver/google_drive.rb +38 -38
  26. data/lib/browse_everything/driver/s3.rb +61 -61
  27. data/lib/browse_everything/engine.rb +10 -3
  28. data/lib/browse_everything/file_entry.rb +1 -1
  29. data/lib/browse_everything/retriever.rb +69 -69
  30. data/lib/browse_everything/version.rb +1 -1
  31. data/lib/browse_everything.rb +1 -1
  32. data/spec/dummy_test_app/Rakefile +6 -0
  33. data/spec/dummy_test_app/app/assets/config/manifest.js +3 -0
  34. data/spec/dummy_test_app/app/assets/images/.keep +0 -0
  35. data/spec/dummy_test_app/app/assets/javascripts/application.js +25 -0
  36. data/spec/dummy_test_app/app/assets/javascripts/cable.js +13 -0
  37. data/spec/dummy_test_app/app/assets/javascripts/channels/.keep +0 -0
  38. data/spec/dummy_test_app/app/assets/stylesheets/application.scss +18 -0
  39. data/spec/dummy_test_app/app/channels/application_cable/channel.rb +4 -0
  40. data/spec/dummy_test_app/app/channels/application_cable/connection.rb +4 -0
  41. data/spec/dummy_test_app/app/controllers/application_controller.rb +3 -0
  42. data/spec/dummy_test_app/app/controllers/concerns/.keep +0 -0
  43. data/spec/{support → dummy_test_app}/app/controllers/file_handler_controller.rb +0 -0
  44. data/spec/dummy_test_app/app/helpers/application_helper.rb +2 -0
  45. data/spec/dummy_test_app/app/jobs/application_job.rb +2 -0
  46. data/spec/dummy_test_app/app/mailers/application_mailer.rb +4 -0
  47. data/spec/dummy_test_app/app/models/application_record.rb +3 -0
  48. data/spec/dummy_test_app/app/models/concerns/.keep +0 -0
  49. data/spec/dummy_test_app/app/views/file_handler/index.html.erb +10 -0
  50. data/spec/{support → dummy_test_app}/app/views/file_handler/main.html.erb +6 -3
  51. data/spec/dummy_test_app/app/views/layouts/application.html.erb +14 -0
  52. data/spec/dummy_test_app/app/views/layouts/mailer.html.erb +13 -0
  53. data/spec/dummy_test_app/app/views/layouts/mailer.text.erb +1 -0
  54. data/spec/dummy_test_app/bin/bundle +3 -0
  55. data/spec/dummy_test_app/bin/rails +4 -0
  56. data/spec/dummy_test_app/bin/rake +4 -0
  57. data/spec/dummy_test_app/bin/setup +38 -0
  58. data/spec/dummy_test_app/bin/update +29 -0
  59. data/spec/dummy_test_app/bin/yarn +11 -0
  60. data/spec/dummy_test_app/config/application.rb +27 -0
  61. data/spec/dummy_test_app/config/boot.rb +5 -0
  62. data/spec/dummy_test_app/config/browse_everything_providers.yml +25 -0
  63. data/spec/dummy_test_app/config/cable.yml +10 -0
  64. data/spec/dummy_test_app/config/database.yml +25 -0
  65. data/spec/dummy_test_app/config/environment.rb +5 -0
  66. data/spec/dummy_test_app/config/environments/development.rb +54 -0
  67. data/spec/dummy_test_app/config/environments/production.rb +91 -0
  68. data/spec/dummy_test_app/config/environments/test.rb +42 -0
  69. data/spec/dummy_test_app/config/initializers/application_controller_renderer.rb +8 -0
  70. data/spec/dummy_test_app/config/initializers/assets.rb +14 -0
  71. data/spec/dummy_test_app/config/initializers/backtrace_silencers.rb +7 -0
  72. data/spec/dummy_test_app/config/initializers/cookies_serializer.rb +5 -0
  73. data/spec/dummy_test_app/config/initializers/filter_parameter_logging.rb +4 -0
  74. data/spec/dummy_test_app/config/initializers/inflections.rb +16 -0
  75. data/spec/dummy_test_app/config/initializers/mime_types.rb +4 -0
  76. data/spec/dummy_test_app/config/initializers/wrap_parameters.rb +14 -0
  77. data/spec/dummy_test_app/config/locales/en.yml +33 -0
  78. data/spec/dummy_test_app/config/puma.rb +56 -0
  79. data/spec/dummy_test_app/config/routes.rb +9 -0
  80. data/spec/dummy_test_app/config/secrets.yml +32 -0
  81. data/spec/dummy_test_app/config/spring.rb +6 -0
  82. data/spec/dummy_test_app/config.ru +5 -0
  83. data/spec/dummy_test_app/lib/assets/.keep +0 -0
  84. data/spec/dummy_test_app/log/.keep +0 -0
  85. data/spec/dummy_test_app/package.json +5 -0
  86. data/spec/dummy_test_app/public/404.html +67 -0
  87. data/spec/dummy_test_app/public/422.html +67 -0
  88. data/spec/dummy_test_app/public/500.html +66 -0
  89. data/spec/dummy_test_app/public/apple-touch-icon-precomposed.png +0 -0
  90. data/spec/dummy_test_app/public/apple-touch-icon.png +0 -0
  91. data/spec/dummy_test_app/public/favicon.ico +0 -0
  92. data/spec/dummy_test_app/tmp/.gitkeep +0 -0
  93. data/spec/features/select_files_spec.rb +1 -0
  94. data/spec/features/test_compiling_stylesheets_spec.rb +1 -1
  95. data/spec/lib/browse_everything/driver_spec.rb +43 -3
  96. data/spec/spec_helper.rb +3 -28
  97. data/tasks/ci.rake +1 -1
  98. metadata +180 -94
  99. data/karma.conf.js +0 -71
  100. data/spec/javascripts/behavior_spec.js +0 -7
  101. data/spec/javascripts/helpers/jasmine-jquery.js +0 -838
  102. data/spec/javascripts/helpers/jquery.js +0 -11008
  103. data/spec/javascripts/karma_spec.rb +0 -16
  104. data/spec/support/app/views/file_handler/index.html.erb +0 -6
  105. data/spec/test_app_templates/Gemfile.extra +0 -9
  106. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -61
@@ -0,0 +1,32 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rails secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ # Shared secrets are available across all environments.
14
+
15
+ # shared:
16
+ # api_key: a1B2c3D4e5F6
17
+
18
+ # Environmental secrets are only available for that specific environment.
19
+
20
+ development:
21
+ secret_key_base: 17e2335c44b403fe0dcfa8f70b1ab20e45d9507558d995334d777d483210d808e538dff8b5bb6eabd6be19d6544a953276541e9b666abac79606499e26a1c579
22
+
23
+ test:
24
+ secret_key_base: 03cf592ca6737d0f67333b13c73def352566d089d07d61906d5a561f5339b2efc23f9a784f5ad3d891b0908b8d8c0914798c8a3b3a00457aacab0dd8902fe058
25
+
26
+ # Do not keep production secrets in the unencrypted secrets file.
27
+ # Instead, either read values from the environment.
28
+ # Or, use `bin/rails secrets:setup` to configure encrypted secrets
29
+ # and move the `production:` environment over there.
30
+
31
+ production:
32
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,6 @@
1
+ %w(
2
+ .ruby-version
3
+ .rbenv-vars
4
+ tmp/restart.txt
5
+ tmp/caching-dev.txt
6
+ ).each { |path| Spring.watch(path) }
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "dummy",
3
+ "private": true,
4
+ "dependencies": {}
5
+ }
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
File without changes
File without changes
@@ -6,6 +6,7 @@ describe 'Choosing files', type: :feature, js: true do
6
6
  end
7
7
 
8
8
  shared_examples 'browseable files' do
9
+ # This is a work-around until the support for Webpacker is resolved
9
10
  it 'selects files from the filesystem' do
10
11
  click_button('Browse')
11
12
  wait_for_ajax
@@ -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
 
data/spec/spec_helper.rb CHANGED
@@ -3,33 +3,8 @@
3
3
  ENV['RAILS_ENV'] ||= 'test'
4
4
  require 'bundler/setup'
5
5
 
6
- def coverage_needed?
7
- ENV['COVERAGE'] || ENV['CI']
8
- end
9
-
10
- if coverage_needed?
11
- require 'simplecov'
12
- require 'coveralls'
13
- SimpleCov.root(File.expand_path('..', __dir__))
14
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
15
- [
16
- SimpleCov::Formatter::HTMLFormatter,
17
- Coveralls::SimpleCov::Formatter
18
- ]
19
- )
20
- SimpleCov.start('rails') do
21
- add_filter '/.internal_test_app'
22
- add_filter '/lib/browse_everything/engine.rb'
23
- add_filter '/lib/browse_everything/version.rb'
24
- add_filter '/lib/generators'
25
- add_filter '/spec'
26
- add_filter '/tasks'
27
- end
28
- end
29
-
30
- require 'engine_cart'
31
- require File.expand_path('config/environment', EngineCart.destination)
32
- EngineCart.load_application!
6
+ dummy_app_path = File.expand_path("../dummy_test_app", __FILE__)
7
+ require File.join(dummy_app_path, "config/environment")
33
8
 
34
9
  require 'capybara/rails'
35
10
  require 'capybara/rspec'
@@ -87,7 +62,7 @@ module BrowserConfigHelper
87
62
  app_key: 'S3AppKey',
88
63
  app_secret: 'S3AppSecret',
89
64
  bucket: 's3.bucket',
90
- region: 's3.region'
65
+ region: 'us-east-1'
91
66
  })
92
67
  end
93
68
 
data/tasks/ci.rake CHANGED
@@ -8,7 +8,7 @@ RuboCop::RakeTask.new(:rubocop) do |task|
8
8
  end
9
9
 
10
10
  desc 'Run all RSpec tests.'
11
- task ci: [:rubocop, 'engine_cart:generate'] do
11
+ task ci: [:rubocop] do
12
12
  RSpec::Core::RakeTask.new(:spec)
13
13
  Rake::Task['spec'].invoke
14
14
  end