browse-everything 1.0.0.rc2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +148 -0
- data/.travis.yml +9 -12
- data/README.md +15 -14
- data/app/assets/javascripts/browse_everything/behavior.js +188 -153
- data/app/assets/stylesheets/browse_everything.scss +0 -0
- data/app/assets/stylesheets/{_browse_everything_bootstrap3.scss → browse_everything/_browse_everything_bootstrap3.scss} +6 -5
- data/app/assets/stylesheets/{_browse_everything_bootstrap4.scss → browse_everything/_browse_everything_bootstrap4.scss} +0 -0
- data/browse-everything.gemspec +2 -1
- data/lib/browse_everything/driver/dropbox.rb +16 -1
- data/lib/browse_everything/retriever.rb +7 -2
- data/lib/browse_everything/version.rb +1 -1
- data/lib/generators/browse_everything/templates/browse_everything_providers.yml.example +1 -0
- data/spec/lib/browse_everything/browser_spec.rb +5 -3
- data/spec/lib/browse_everything/driver/dropbox_spec.rb +20 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -2
- metadata +27 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef33c2e0a8c1c1206dce56eedad11b136195a6d094ce585ff4799323a442cb34
|
4
|
+
data.tar.gz: 76a840d66d3fc96fb6a1193515889980aba59a2469cbe76bdbabb4a7bc8bd204
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc3f2a4506d217583eb05c32e1b632578772c13eb21accf2f40eea87d104c06228f38d172e110c0f2e5524697ef7560aa54164ca92536e010c8746f9b7aeb397
|
7
|
+
data.tar.gz: 86ef8ad24edeec846bf81c1887f038befcdcb06c3cc6c0730ca2beb8834cb67ea9e86167067913feab7fa84a5c45a898de79280a66b9725391c6437f274965a8
|
@@ -0,0 +1,148 @@
|
|
1
|
+
|
2
|
+
version: 2.1
|
3
|
+
executors:
|
4
|
+
ruby:
|
5
|
+
docker:
|
6
|
+
- image: circleci/ruby:2.6
|
7
|
+
working_directory: ~/browse-everything
|
8
|
+
environment:
|
9
|
+
BUNDLE_PATH: vendor/bundle
|
10
|
+
BUNDLE_JOBS: 4
|
11
|
+
BUNDLE_RETRY: 3
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
bundle:
|
15
|
+
executor: ruby
|
16
|
+
steps:
|
17
|
+
- restore_cache: # Restore the cached source code base (for repeated jobs)
|
18
|
+
keys:
|
19
|
+
- v1-source-{{ .Branch }}-{{ .Revision }}
|
20
|
+
- v1-source-{{ .Branch }}-
|
21
|
+
- v1-source-
|
22
|
+
- checkout
|
23
|
+
- save_cache: # Save the cache for the source code base
|
24
|
+
key: v1-source-{{ .Branch }}-{{ .Revision }}
|
25
|
+
paths:
|
26
|
+
- ".git"
|
27
|
+
- restore_cache:
|
28
|
+
keys:
|
29
|
+
- v1-bundle-{{ checksum "Gemfile" }}--{{ checksum "browse-everything.gemspec" }}
|
30
|
+
- v1-bundle
|
31
|
+
- run:
|
32
|
+
name: Install dependencies
|
33
|
+
command: bundle check || bundle install
|
34
|
+
- save_cache:
|
35
|
+
key: v1-bundle-{{ checksum "Gemfile.lock" }}--{{ checksum "browse-everything.gemspec" }}
|
36
|
+
paths:
|
37
|
+
- ~/browse-everything/vendor/bundle
|
38
|
+
- persist_to_workspace:
|
39
|
+
root: ~/
|
40
|
+
paths:
|
41
|
+
- browse-everything/*
|
42
|
+
- browse-everything/**/*
|
43
|
+
rubocop:
|
44
|
+
executor: ruby
|
45
|
+
steps:
|
46
|
+
- attach_workspace:
|
47
|
+
at: ~/
|
48
|
+
- run:
|
49
|
+
name: Call Rubocop
|
50
|
+
command: bundle exec rubocop
|
51
|
+
engine_cart:
|
52
|
+
docker:
|
53
|
+
- image: circleci/ruby:2.6-node
|
54
|
+
|
55
|
+
working_directory: ~/browse-everything
|
56
|
+
|
57
|
+
environment:
|
58
|
+
BUNDLE_PATH: vendor/bundle
|
59
|
+
BUNDLE_JOBS: 4
|
60
|
+
BUNDLE_RETRY: 3
|
61
|
+
RAILS_ENV: test
|
62
|
+
RACK_ENV: test
|
63
|
+
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
|
64
|
+
ENGINE_CART_RAILS_OPTIONS: --skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-puma --skip-test
|
65
|
+
SPEC_OPTS: --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress
|
66
|
+
COVERALLS_PARALLEL: true
|
67
|
+
steps:
|
68
|
+
- attach_workspace:
|
69
|
+
at: ~/
|
70
|
+
- restore_cache:
|
71
|
+
keys:
|
72
|
+
- v1-test-app-{{ checksum "Gemfile.lock" }}
|
73
|
+
- run:
|
74
|
+
name: Check dependencies
|
75
|
+
command: bundle check || bundle install
|
76
|
+
- run:
|
77
|
+
name: Generate test app
|
78
|
+
command: bundle exec rake engine_cart:generate
|
79
|
+
- run:
|
80
|
+
name: Ensure test app dependencies are installed
|
81
|
+
command: |
|
82
|
+
cd .internal_test_app
|
83
|
+
bundle check || bundle install
|
84
|
+
|
85
|
+
- save_cache:
|
86
|
+
key: v1-test-app-{{ checksum "Gemfile.lock" }}
|
87
|
+
paths:
|
88
|
+
- ".internal_test_app"
|
89
|
+
- persist_to_workspace:
|
90
|
+
root: ~/
|
91
|
+
paths:
|
92
|
+
- browse-everything/*
|
93
|
+
- browse-everything/**/*
|
94
|
+
rspec:
|
95
|
+
docker:
|
96
|
+
- image: circleci/ruby:2.6-node-browsers-legacy
|
97
|
+
|
98
|
+
working_directory: ~/browse-everything
|
99
|
+
parallelism: 4
|
100
|
+
|
101
|
+
environment:
|
102
|
+
BUNDLE_PATH: vendor/bundle
|
103
|
+
BUNDLE_JOBS: 4
|
104
|
+
BUNDLE_RETRY: 3
|
105
|
+
RAILS_ENV: test
|
106
|
+
RACK_ENV: test
|
107
|
+
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
|
108
|
+
ENGINE_CART_RAILS_OPTIONS: --skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-puma --skip-test
|
109
|
+
SPEC_OPTS: --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress
|
110
|
+
COVERALLS_PARALLEL: true
|
111
|
+
steps:
|
112
|
+
- attach_workspace:
|
113
|
+
at: ~/
|
114
|
+
- run:
|
115
|
+
name: Ensure top-level Gemfile.lock is valid
|
116
|
+
command: bundle check || bundle install
|
117
|
+
- run:
|
118
|
+
name: Install Karma for JavaScript and functional tests
|
119
|
+
command: sudo npm install -g karma karma-jasmine karma-chrome-launcher
|
120
|
+
- run:
|
121
|
+
name: Run RSpec in parallel
|
122
|
+
command: |
|
123
|
+
mkdir /tmp/test-results
|
124
|
+
bundle exec rspec $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
|
125
|
+
# collect reports
|
126
|
+
- store_test_results:
|
127
|
+
path: /tmp/test-results
|
128
|
+
- store_artifacts:
|
129
|
+
path: /tmp/test-results
|
130
|
+
destination: test-results
|
131
|
+
|
132
|
+
workflows:
|
133
|
+
version: 2.1
|
134
|
+
ci:
|
135
|
+
jobs:
|
136
|
+
- bundle
|
137
|
+
- rubocop:
|
138
|
+
requires:
|
139
|
+
- bundle
|
140
|
+
- engine_cart:
|
141
|
+
requires:
|
142
|
+
- bundle
|
143
|
+
- rspec:
|
144
|
+
requires:
|
145
|
+
- rubocop
|
146
|
+
- engine_cart
|
147
|
+
|
148
|
+
|
data/.travis.yml
CHANGED
@@ -9,25 +9,22 @@ cache:
|
|
9
9
|
|
10
10
|
before_install:
|
11
11
|
- gem update --system # https://docs.travis-ci.com/user/languages/ruby/#Upgrading-RubyGems
|
12
|
-
- gem
|
12
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
13
|
+
- gem install bundler -v '< 2'
|
13
14
|
- npm install -g karma karma-jasmine karma-chrome-launcher
|
14
15
|
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
|
15
16
|
|
16
17
|
rvm:
|
17
|
-
- 2.
|
18
|
-
- 2.
|
19
|
-
- 2.
|
18
|
+
- 2.6.1
|
19
|
+
- 2.5.3
|
20
|
+
- 2.4.5
|
20
21
|
|
21
22
|
env:
|
22
23
|
global:
|
23
24
|
- CHROME_BIN=google-chrome-stable
|
24
25
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
25
26
|
matrix:
|
26
|
-
- "RAILS_VERSION=5.2.
|
27
|
-
- "RAILS_VERSION=5.2.
|
28
|
-
- "RAILS_VERSION=5.1.6"
|
29
|
-
- "RAILS_VERSION=5.1.6 TEST_BOOTSTRAP=3"
|
30
|
-
- "RAILS_VERSION=5.0.7"
|
31
|
-
- "RAILS_VERSION=5.0.7 TEST_BOOTSTRAP=3"
|
32
|
-
- "RAILS_VERSION=4.2.10"
|
33
|
-
- "RAILS_VERSION=4.2.10 TEST_BOOTSTRAP=3"
|
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"
|
data/README.md
CHANGED
@@ -39,17 +39,14 @@ what this means can be found
|
|
39
39
|
|
40
40
|
## Supported Ruby Releases
|
41
41
|
Currently, the following releases of Ruby are supported:
|
42
|
-
- 2.
|
43
|
-
- 2.
|
44
|
-
- 2.
|
45
|
-
- Please note that this is the last release in the 2.3.x series, and support is [scheduled to be withdrawn](https://www.ruby-lang.org/en/news/2018/03/28/ruby-2-3-7-released/). We would strongly recommend that one upgrades from 2.3.7 in response to this.
|
42
|
+
- 2.6.1
|
43
|
+
- 2.5.3
|
44
|
+
- 2.4.5
|
46
45
|
|
47
46
|
## Supported Rails Releases
|
48
|
-
|
49
|
-
- 5.
|
50
|
-
- 5.
|
51
|
-
- 4.2.10
|
52
|
-
- 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.
|
47
|
+
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
|
+
- 5.2.2
|
49
|
+
- 5.1.6.1
|
53
50
|
|
54
51
|
## Installation
|
55
52
|
|
@@ -80,9 +77,9 @@ Browse-everything depends on bootstrap, it can work with bootstrap 3 or bootstra
|
|
80
77
|
|
81
78
|
### CSS
|
82
79
|
|
83
|
-
**For bootstrap3 support**, your app should include the [bootstrap-sass](https://github.com/twbs/bootstrap-sass) gem in it's Gemfile, and following the install directions for bootstrap-sass, should have `@import 'bootstrap-sprockets'` and `@import 'bootstrap'` in it's application.scss. After those lines, add `@import "browse_everything_bootstrap3";` to your application.scss.
|
80
|
+
**For bootstrap3 support**, your app should include the [bootstrap-sass](https://github.com/twbs/bootstrap-sass) gem in it's Gemfile, and following the install directions for bootstrap-sass, should have `@import 'bootstrap-sprockets'` and `@import 'bootstrap'` in it's application.scss. After those lines, add `@import "browse_everything/browse_everything_bootstrap3";` to your application.scss.
|
84
81
|
|
85
|
-
**For bootstrap4 support**, your app should include the [bootstrap](https://github.com/twbs/bootstrap-rubygem) gem in it's Gemfile, and following the install directions for that gem should have `@import "bootstrap";` in it's application.scss. After that line, add `@import 'browse_everything_bootstrap4'` to your application.scss.
|
82
|
+
**For bootstrap4 support**, your app should include the [bootstrap](https://github.com/twbs/bootstrap-rubygem) gem in it's Gemfile, and following the install directions for that gem should have `@import "bootstrap";` in it's application.scss. After that line, add `@import 'browse_everything/browse_everything_bootstrap4'` to your application.scss.
|
86
83
|
|
87
84
|
### Javascript
|
88
85
|
|
@@ -95,14 +92,18 @@ In `app/assets/javascripts/application.js` include jquery and the BrowseEverythi
|
|
95
92
|
|
96
93
|
(Same for bootstrap3 or bootstrap 4)
|
97
94
|
|
98
|
-
### Migration CSS inclusion from pre-1.0
|
95
|
+
### Migration CSS inclusion from pre-1.0
|
99
96
|
|
100
|
-
If your app has installed a previous version of browse-everything, you may have a generated file at `./app/assets/stylesheets/browse_everything.scss`, which has a line in it `@import "browse_everything/browse_everything";`. That import should no longer be used; it can be changed to `@import "browse_everything_bootstrap3"` instead.
|
97
|
+
If your app has installed a previous version of browse-everything, you may have a generated file at `./app/assets/stylesheets/browse_everything.scss`, which has a line in it `@import "browse_everything/browse_everything";`. That import should no longer be used; it can be changed to `@import "browse_everything/browse_everything_bootstrap3"` instead.
|
101
98
|
|
102
99
|
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.
|
103
100
|
|
104
101
|
## Testing
|
105
|
-
This is a Rails Engine which is tested using the [engine_cart](https://github.com/cbeer/engine_cart) Gem
|
102
|
+
This is a Rails Engine which is tested using the [engine_cart](https://github.com/cbeer/engine_cart) Gem and rspec.
|
103
|
+
|
104
|
+
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`.
|
105
|
+
|
106
|
+
Test suites may be executed with the following invocation:
|
106
107
|
|
107
108
|
```bash
|
108
109
|
bundle exec rake
|
@@ -1,26 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
$(function() {
|
8
|
-
let dialog = $('div#browse-everything');
|
9
|
-
|
10
|
-
const initialize = function(obj,options) {
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
$(function () {
|
4
|
+
var dialog = $('div#browse-everything');
|
5
|
+
|
6
|
+
var initialize = function initialize(obj, options) {
|
11
7
|
if ($('div#browse-everything').length === 0) {
|
12
8
|
// bootstrap 4 needs at least the inner class="modal-dialog" div, or it gets really
|
13
9
|
// confused and can't close the dialog.
|
14
|
-
dialog = $('<div tabindex="-1" id="browse-everything" class="ev-browser modal fade" aria-live="polite" role="dialog" aria-labelledby="beModalLabel">' +
|
15
|
-
'<div class="modal-dialog modal-lg" role="document"></div>' +
|
16
|
-
'</div>').hide().appendTo('body');
|
10
|
+
dialog = $('<div tabindex="-1" id="browse-everything" class="ev-browser modal fade" aria-live="polite" role="dialog" aria-labelledby="beModalLabel">' + '<div class="modal-dialog modal-lg" role="document"></div>' + '</div>').hide().appendTo('body');
|
17
11
|
}
|
18
12
|
|
19
13
|
dialog.modal({
|
20
14
|
backdrop: 'static',
|
21
|
-
show:
|
15
|
+
show: false
|
22
16
|
});
|
23
|
-
|
17
|
+
var ctx = {
|
24
18
|
opts: $.extend(true, {}, options),
|
25
19
|
callbacks: {
|
26
20
|
show: $.Callbacks(),
|
@@ -30,36 +24,42 @@ $(function() {
|
|
30
24
|
}
|
31
25
|
};
|
32
26
|
ctx.callback_proxy = {
|
33
|
-
show
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
show: function show(func) {
|
28
|
+
ctx.callbacks.show.add(func);return this;
|
29
|
+
},
|
30
|
+
done: function done(func) {
|
31
|
+
ctx.callbacks.done.add(func);return this;
|
32
|
+
},
|
33
|
+
cancel: function cancel(func) {
|
34
|
+
ctx.callbacks.cancel.add(func);return this;
|
35
|
+
},
|
36
|
+
fail: function fail(func) {
|
37
|
+
ctx.callbacks.fail.add(func);return this;
|
38
|
+
}
|
37
39
|
};
|
38
|
-
$(obj).data('ev-state',ctx);
|
40
|
+
$(obj).data('ev-state', ctx);
|
39
41
|
return ctx;
|
40
42
|
};
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
.split('
|
45
|
-
|
46
|
-
|
47
|
-
return $("<input type='hidden'/>")
|
48
|
-
.attr('name',decodeURIComponent(this[0]))
|
49
|
-
.val(decodeURIComponent(this[1]))[0].outerHTML;
|
44
|
+
var toHiddenFields = function toHiddenFields(data) {
|
45
|
+
var fields = $.param(data).split('&').map(function (t) {
|
46
|
+
return t.replace(/\+/g, ' ').split('=', 2);
|
47
|
+
});
|
48
|
+
var elements = $(fields).map(function () {
|
49
|
+
return $("<input type='hidden'/>").attr('name', decodeURIComponent(this[0])).val(decodeURIComponent(this[1]))[0].outerHTML;
|
50
50
|
});
|
51
51
|
return $(elements.toArray().join("\n"));
|
52
52
|
};
|
53
53
|
|
54
|
-
|
55
|
-
$('input.ev-url').each(function() {
|
56
|
-
return $(
|
57
|
-
})
|
58
|
-
;
|
54
|
+
var indicateSelected = function indicateSelected() {
|
55
|
+
return $('input.ev-url').each(function () {
|
56
|
+
return $('*[data-ev-location=\'' + $(this).val() + '\']').addClass('ev-selected');
|
57
|
+
});
|
58
|
+
};
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
$('input.ev-url').each(function() {
|
60
|
+
var fileIsSelected = function fileIsSelected(row) {
|
61
|
+
var result = false;
|
62
|
+
$('input.ev-url').each(function () {
|
63
63
|
if (this.value === $(row).data('ev-location')) {
|
64
64
|
return result = true;
|
65
65
|
}
|
@@ -67,7 +67,7 @@ $(function() {
|
|
67
67
|
return result;
|
68
68
|
};
|
69
69
|
|
70
|
-
|
70
|
+
var toggleFileSelect = function toggleFileSelect(row) {
|
71
71
|
row.toggleClass('ev-selected');
|
72
72
|
if (row.hasClass('ev-selected')) {
|
73
73
|
selectFile(row);
|
@@ -77,70 +77,74 @@ $(function() {
|
|
77
77
|
return updateFileCount();
|
78
78
|
};
|
79
79
|
|
80
|
-
var selectFile = function(row) {
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
var selectFile = function selectFile(row) {
|
81
|
+
var target_form = $('form.ev-submit-form');
|
82
|
+
var file_location = row.data('ev-location');
|
83
|
+
var hidden_input = $("<input type='hidden' class='ev-url' name='selected_files[]'/>").val(file_location);
|
84
84
|
target_form.append(hidden_input);
|
85
85
|
if (!$(row).find('.ev-select-file').prop('checked')) {
|
86
86
|
return $(row).find('.ev-select-file').prop('checked', true);
|
87
87
|
}
|
88
88
|
};
|
89
89
|
|
90
|
-
var unselectFile = function(row) {
|
91
|
-
|
92
|
-
|
93
|
-
$(
|
90
|
+
var unselectFile = function unselectFile(row) {
|
91
|
+
var target_form = $('form.ev-submit-form');
|
92
|
+
var file_location = row.data('ev-location');
|
93
|
+
$('form.ev-submit-form input[value=\'' + file_location + '\']').remove();
|
94
94
|
if ($(row).find('.ev-select-file').prop('checked')) {
|
95
|
-
|
96
|
-
|
95
|
+
return $(row).find('.ev-select-file').prop('checked', false);
|
96
|
+
}
|
97
97
|
};
|
98
98
|
|
99
|
-
var updateFileCount = function() {
|
100
|
-
|
101
|
-
|
102
|
-
return $('.ev-status').html(
|
99
|
+
var updateFileCount = function updateFileCount() {
|
100
|
+
var count = $('input.ev-url').length;
|
101
|
+
var files = count === 1 ? "file" : "files";
|
102
|
+
return $('.ev-status').html(count + ' ' + files + ' selected');
|
103
103
|
};
|
104
104
|
|
105
|
-
|
105
|
+
var toggleBranchSelect = function toggleBranchSelect(row) {
|
106
106
|
if (row.hasClass('collapsed')) {
|
107
|
-
|
108
|
-
return $('table#file-list').treetable('expandNode',node_id);
|
107
|
+
var node_id = row.find('td.ev-file-name a.ev-link').attr('href');
|
108
|
+
return $('table#file-list').treetable('expandNode', node_id);
|
109
109
|
}
|
110
110
|
};
|
111
111
|
|
112
|
-
|
113
|
-
rows.each(function() {
|
112
|
+
var selectAll = function selectAll(rows) {
|
113
|
+
return rows.each(function () {
|
114
114
|
if ($(this).data('tt-branch')) {
|
115
|
-
|
115
|
+
var box = $(this).find('#select_all')[0];
|
116
116
|
$(box).prop('checked', true);
|
117
117
|
$(box).prop('value', "1");
|
118
118
|
return toggleBranchSelect($(this));
|
119
119
|
} else {
|
120
|
-
if (!fileIsSelected($(this))) {
|
120
|
+
if (!fileIsSelected($(this))) {
|
121
|
+
return toggleFileSelect($(this));
|
122
|
+
}
|
121
123
|
}
|
122
|
-
})
|
123
|
-
;
|
124
|
+
});
|
125
|
+
};
|
124
126
|
|
125
|
-
|
126
|
-
$('table#file-list tr').each(function() {
|
127
|
+
var selectChildRows = function selectChildRows(row, action) {
|
128
|
+
return $('table#file-list tr').each(function () {
|
127
129
|
if ($(this).data('tt-parent-id')) {
|
128
|
-
|
130
|
+
var re = RegExp($(row).data('tt-id'), 'i');
|
129
131
|
if ($(this).data('tt-parent-id').match(re)) {
|
130
132
|
if ($(this).data('tt-branch')) {
|
131
|
-
|
133
|
+
var box = $(this).find('#select_all')[0];
|
132
134
|
$(box).prop('value', action);
|
133
135
|
if (action === "1") {
|
134
136
|
$(box).prop("checked", true);
|
135
|
-
|
136
|
-
return $('table#file-list').treetable('expandNode',node_id);
|
137
|
+
var node_id = $(this).find('td.ev-file-name a.ev-link').attr('href');
|
138
|
+
return $('table#file-list').treetable('expandNode', node_id);
|
137
139
|
} else {
|
138
140
|
return $(box).prop("checked", false);
|
139
141
|
}
|
140
142
|
} else {
|
141
143
|
if (action === "1") {
|
142
144
|
$(this).addClass('ev-selected');
|
143
|
-
if (!fileIsSelected($(this))) {
|
145
|
+
if (!fileIsSelected($(this))) {
|
146
|
+
selectFile($(this));
|
147
|
+
}
|
144
148
|
} else {
|
145
149
|
$(this).removeClass('ev-selected');
|
146
150
|
unselectFile($(this));
|
@@ -149,49 +153,53 @@ $(function() {
|
|
149
153
|
}
|
150
154
|
}
|
151
155
|
}
|
152
|
-
})
|
153
|
-
;
|
156
|
+
});
|
157
|
+
};
|
154
158
|
|
155
|
-
|
159
|
+
var tableSetup = function tableSetup(table) {
|
156
160
|
table.treetable({
|
157
161
|
expandable: true,
|
158
|
-
onNodeCollapse() {
|
159
|
-
|
162
|
+
onNodeCollapse: function onNodeCollapse() {
|
163
|
+
var node = this;
|
160
164
|
return table.treetable("unloadBranch", node);
|
161
165
|
},
|
162
|
-
onNodeExpand() {
|
163
|
-
|
166
|
+
onNodeExpand: function onNodeExpand() {
|
167
|
+
var node = this;
|
164
168
|
startWait();
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
if (size.indexOf("MB")
|
169
|
+
var size = $(node.row).find('td.ev-file-size').text().trim();
|
170
|
+
var start = 1;
|
171
|
+
var increment = 1;
|
172
|
+
if (size.indexOf("MB") > -1) {
|
169
173
|
start = 10;
|
170
174
|
increment = 5;
|
171
175
|
}
|
172
|
-
if (size.indexOf("KB")
|
176
|
+
if (size.indexOf("KB") > -1) {
|
173
177
|
start = 50;
|
174
178
|
increment = 10;
|
175
179
|
}
|
176
180
|
setProgress(start);
|
177
|
-
|
181
|
+
var progressIntervalID = setInterval(function () {
|
178
182
|
start = start + increment;
|
179
183
|
if (start > 99) {
|
180
184
|
start = 99;
|
181
185
|
}
|
182
186
|
return setProgress(start);
|
183
|
-
}
|
184
|
-
return setTimeout(
|
187
|
+
}, 2000);
|
188
|
+
return setTimeout(function () {
|
189
|
+
return loadFiles(node, table, progressIntervalID);
|
190
|
+
}, 10);
|
185
191
|
}
|
186
192
|
});
|
187
193
|
$("#file-list tr:first").focus();
|
188
194
|
return sizeColumns(table);
|
189
195
|
};
|
190
196
|
|
191
|
-
var sizeColumns = function(table) {
|
192
|
-
|
197
|
+
var sizeColumns = function sizeColumns(table) {
|
198
|
+
var full_width = $('.ev-files').width();
|
193
199
|
table.width(full_width);
|
194
|
-
|
200
|
+
var set_size = function set_size(selector, pct) {
|
201
|
+
return $(selector, table).width(full_width * pct).css('width', full_width * pct).css('max-width', full_width * pct);
|
202
|
+
};
|
195
203
|
set_size('.ev-file', 0.4);
|
196
204
|
set_size('.ev-container', 0.4);
|
197
205
|
set_size('.ev-size', 0.1);
|
@@ -199,60 +207,69 @@ $(function() {
|
|
199
207
|
return set_size('.ev-date', 0.2);
|
200
208
|
};
|
201
209
|
|
202
|
-
var loadFiles = (node, table, progressIntervalID)
|
203
|
-
$.ajax({
|
210
|
+
var loadFiles = function loadFiles(node, table, progressIntervalID) {
|
211
|
+
return $.ajax({
|
204
212
|
async: true, // Must be false, otherwise loadBranch happens after showChildren?
|
205
|
-
url: $('a.ev-link',node.row).attr('href'),
|
213
|
+
url: $('a.ev-link', node.row).attr('href'),
|
206
214
|
data: {
|
207
215
|
parent: node.row.data('tt-id'),
|
208
216
|
accept: dialog.data('ev-state').opts.accept,
|
209
217
|
context: dialog.data('ev-state').opts.context
|
210
|
-
}}).done(function(html) {
|
218
|
+
} }).done(function (html) {
|
211
219
|
setProgress('100');
|
212
220
|
clearInterval(progressIntervalID);
|
213
|
-
|
221
|
+
var rows = $('tbody tr', $(html));
|
214
222
|
table.treetable("loadBranch", node, rows);
|
215
223
|
$(node).show();
|
216
224
|
sizeColumns(table);
|
217
225
|
indicateSelected();
|
218
226
|
if ($(node.row).find('#select_all')[0].checked) {
|
219
227
|
return selectAll(rows);
|
220
|
-
}
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
228
|
+
}
|
229
|
+
}).always(function () {
|
230
|
+
clearInterval(progressIntervalID);
|
231
|
+
return stopWait();
|
232
|
+
});
|
233
|
+
};
|
225
234
|
|
226
|
-
var setProgress =
|
235
|
+
var setProgress = function setProgress(done) {
|
236
|
+
return $('.loading-text').text(done + '% complete');
|
237
|
+
};
|
227
238
|
|
228
|
-
|
239
|
+
var refreshFiles = function refreshFiles() {
|
240
|
+
return $('.ev-providers select').change();
|
241
|
+
};
|
229
242
|
|
230
|
-
var startWait = function() {
|
243
|
+
var startWait = function startWait() {
|
231
244
|
$('.loading-progress').removeClass("hidden");
|
232
|
-
$('body').css('cursor','wait');
|
245
|
+
$('body').css('cursor', 'wait');
|
233
246
|
$("html").addClass("wait");
|
234
247
|
$(".ev-browser").addClass("loading");
|
235
248
|
return $('.ev-submit').attr('disabled', true);
|
236
249
|
};
|
237
250
|
|
238
|
-
var stopWait = function() {
|
251
|
+
var stopWait = function stopWait() {
|
239
252
|
$('.loading-progress').addClass("hidden");
|
240
|
-
$('body').css('cursor','default');
|
253
|
+
$('body').css('cursor', 'default');
|
241
254
|
$("html").removeClass("wait");
|
242
255
|
$(".ev-browser").removeClass("loading");
|
243
256
|
return $('.ev-submit').attr('disabled', false);
|
244
257
|
};
|
245
258
|
|
246
|
-
$(window).on('resize', ()
|
259
|
+
$(window).on('resize', function () {
|
260
|
+
return sizeColumns($('table#file-list'));
|
261
|
+
});
|
247
262
|
|
248
|
-
$.fn.browseEverything = function(options) {
|
249
|
-
|
250
|
-
if (
|
263
|
+
$.fn.browseEverything = function (options) {
|
264
|
+
var ctx = $(this).data('ev-state');
|
265
|
+
if (ctx == null && options == null) {
|
266
|
+
options = $(this).data();
|
267
|
+
}
|
251
268
|
if (options != null) {
|
252
269
|
ctx = initialize(this[0], options);
|
253
|
-
$(this).click(function() {
|
254
|
-
dialog.data('ev-state',ctx);
|
255
|
-
return dialog.load(ctx.opts.route, function() {
|
270
|
+
$(this).click(function () {
|
271
|
+
dialog.data('ev-state', ctx);
|
272
|
+
return dialog.load(ctx.opts.route, function () {
|
256
273
|
setTimeout(refreshFiles, 500);
|
257
274
|
ctx.callbacks.show.fire();
|
258
275
|
return dialog.modal('show');
|
@@ -264,15 +281,23 @@ $(function() {
|
|
264
281
|
return ctx.callback_proxy;
|
265
282
|
} else {
|
266
283
|
return {
|
267
|
-
show() {
|
268
|
-
|
269
|
-
|
270
|
-
|
284
|
+
show: function show() {
|
285
|
+
return this;
|
286
|
+
},
|
287
|
+
done: function done() {
|
288
|
+
return this;
|
289
|
+
},
|
290
|
+
cancel: function cancel() {
|
291
|
+
return this;
|
292
|
+
},
|
293
|
+
fail: function fail() {
|
294
|
+
return this;
|
295
|
+
}
|
271
296
|
};
|
272
297
|
}
|
273
298
|
};
|
274
299
|
|
275
|
-
$.fn.browseEverything.toggleCheckbox = function(box) {
|
300
|
+
$.fn.browseEverything.toggleCheckbox = function (box) {
|
276
301
|
if (box.value === "0") {
|
277
302
|
return $(box).prop('value', "1");
|
278
303
|
} else {
|
@@ -280,48 +305,53 @@ $(function() {
|
|
280
305
|
}
|
281
306
|
};
|
282
307
|
|
283
|
-
$(document).on('ev.refresh',
|
308
|
+
$(document).on('ev.refresh', function (event) {
|
309
|
+
return refreshFiles();
|
310
|
+
});
|
284
311
|
|
285
|
-
$(document).on('click', 'button.ev-cancel', function(event) {
|
312
|
+
$(document).on('click', 'button.ev-cancel', function (event) {
|
286
313
|
event.preventDefault();
|
287
314
|
dialog.data('ev-state').callbacks.cancel.fire();
|
288
315
|
return $('.ev-browser').modal('hide');
|
289
316
|
});
|
290
317
|
|
291
|
-
$(document).on('click', 'button.ev-submit', function(event) {
|
318
|
+
$(document).on('click', 'button.ev-submit', function (event) {
|
292
319
|
event.preventDefault();
|
293
320
|
$(this).button('loading');
|
294
321
|
startWait();
|
295
|
-
|
296
|
-
|
297
|
-
|
322
|
+
var main_form = $(this).closest('form');
|
323
|
+
var resolver_url = main_form.data('resolver');
|
324
|
+
var ctx = dialog.data('ev-state');
|
298
325
|
$(main_form).find('input[name=context]').val(ctx.opts.context);
|
299
326
|
return $.ajax(resolver_url, {
|
300
327
|
type: 'POST',
|
301
328
|
dataType: 'json',
|
302
329
|
data: main_form.serialize()
|
303
|
-
}).done(function(data) {
|
330
|
+
}).done(function (data) {
|
304
331
|
if (ctx.opts.target != null) {
|
305
|
-
|
332
|
+
var fields = toHiddenFields({ selected_files: data });
|
306
333
|
$(ctx.opts.target).append($(fields));
|
307
334
|
}
|
308
|
-
return ctx.callbacks.done.fire(data);
|
309
|
-
|
335
|
+
return ctx.callbacks.done.fire(data);
|
336
|
+
}).fail(function (xhr, status, error) {
|
337
|
+
return ctx.callbacks.fail.fire(status, error, xhr.responseText);
|
338
|
+
}).always(function () {
|
339
|
+
$('body').css('cursor', 'default');
|
310
340
|
$('.ev-browser').modal('hide');
|
311
341
|
return $('#browse-btn').focus();
|
312
342
|
});
|
313
343
|
});
|
314
344
|
|
315
|
-
$(document).on('click', '.ev-files .ev-container a.ev-link', function(event) {
|
345
|
+
$(document).on('click', '.ev-files .ev-container a.ev-link', function (event) {
|
316
346
|
event.stopPropagation();
|
317
347
|
event.preventDefault();
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
return $('table#file-list').treetable(action,node_id);
|
348
|
+
var row = $(this).closest('tr');
|
349
|
+
var action = row.hasClass('expanded') ? 'collapseNode' : 'expandNode';
|
350
|
+
var node_id = $(this).attr('href');
|
351
|
+
return $('table#file-list').treetable(action, node_id);
|
322
352
|
});
|
323
353
|
|
324
|
-
$(document).on('change', '.ev-providers select', function(event) {
|
354
|
+
$(document).on('change', '.ev-providers select', function (event) {
|
325
355
|
event.preventDefault();
|
326
356
|
startWait();
|
327
357
|
return $.ajax({
|
@@ -329,33 +359,37 @@ $(function() {
|
|
329
359
|
data: {
|
330
360
|
accept: dialog.data('ev-state').opts.accept,
|
331
361
|
context: dialog.data('ev-state').opts.context
|
332
|
-
}}).done(function(data) {
|
362
|
+
} }).done(function (data) {
|
333
363
|
$('.ev-files').html(data);
|
334
364
|
indicateSelected();
|
335
365
|
$('#provider_auth').focus();
|
336
|
-
return tableSetup($('table#file-list'));
|
337
|
-
|
366
|
+
return tableSetup($('table#file-list'));
|
367
|
+
}).fail(function (xhr, status, error) {
|
368
|
+
if (xhr.responseText.indexOf("Refresh token has expired") > -1) {
|
338
369
|
return $('.ev-files').html("Your sessison has expired please clear your cookies.");
|
339
370
|
} else {
|
340
371
|
return $('.ev-files').html(xhr.responseText);
|
341
|
-
}
|
372
|
+
}
|
373
|
+
}).always(function () {
|
374
|
+
return stopWait();
|
375
|
+
});
|
342
376
|
});
|
343
377
|
|
344
|
-
$(document).on('click', '.ev-providers a', function(event) {
|
378
|
+
$(document).on('click', '.ev-providers a', function (event) {
|
345
379
|
$('.ev-providers li').removeClass('ev-selected');
|
346
380
|
return $(this).closest('li').addClass('ev-selected');
|
347
381
|
});
|
348
382
|
|
349
|
-
$(document).on('click', '.ev-file a', function(event) {
|
383
|
+
$(document).on('click', '.ev-file a', function (event) {
|
350
384
|
event.preventDefault();
|
351
|
-
|
385
|
+
var target = $(this).closest('*[data-ev-location]');
|
352
386
|
return toggleFileSelect(target);
|
353
387
|
});
|
354
388
|
|
355
|
-
$(document).on('click', '.ev-auth', function(event) {
|
389
|
+
$(document).on('click', '.ev-auth', function (event) {
|
356
390
|
event.preventDefault();
|
357
|
-
|
358
|
-
var check_func = function() {
|
391
|
+
var auth_win = window.open($(this).attr('href'));
|
392
|
+
var check_func = function check_func() {
|
359
393
|
if (auth_win.closed) {
|
360
394
|
return $('.ev-providers .ev-selected a').click();
|
361
395
|
} else {
|
@@ -365,43 +399,44 @@ $(function() {
|
|
365
399
|
return check_func();
|
366
400
|
});
|
367
401
|
|
368
|
-
$(document).on('change', 'input.ev-select-all', function(event) {
|
402
|
+
$(document).on('change', 'input.ev-select-all', function (event) {
|
369
403
|
event.stopPropagation();
|
370
404
|
event.preventDefault();
|
371
405
|
$.fn.browseEverything.toggleCheckbox(this);
|
372
|
-
|
373
|
-
|
374
|
-
|
406
|
+
var action = this.value;
|
407
|
+
var row = $(this).closest('tr');
|
408
|
+
var node_id = row.find('td.ev-file-name a.ev-link').attr('href');
|
375
409
|
if (row.hasClass('collapsed')) {
|
376
|
-
return $('table#file-list').treetable('expandNode',node_id);
|
410
|
+
return $('table#file-list').treetable('expandNode', node_id);
|
377
411
|
} else {
|
378
412
|
return selectChildRows(row, action);
|
379
413
|
}
|
380
414
|
});
|
381
415
|
|
382
|
-
return $(document).on('change', 'input.ev-select-file', function(event) {
|
416
|
+
return $(document).on('change', 'input.ev-select-file', function (event) {
|
383
417
|
event.stopPropagation();
|
384
418
|
event.preventDefault();
|
385
419
|
return toggleFileSelect($(this).closest('tr'));
|
386
420
|
});
|
387
421
|
});
|
388
422
|
|
389
|
-
|
390
|
-
|
391
|
-
const triggers = $('*[data-toggle=browse-everything]');
|
423
|
+
var auto_toggle = function auto_toggle() {
|
424
|
+
var triggers = $('*[data-toggle=browse-everything]');
|
392
425
|
if (typeof Rails !== 'undefined' && Rails !== null) {
|
393
426
|
$.ajaxSetup({
|
394
|
-
|
427
|
+
headers: { 'X-CSRF-TOKEN': (Rails || $.rails).csrfToken() || '' }
|
395
428
|
});
|
396
429
|
}
|
397
430
|
|
398
|
-
return triggers.each(function() {
|
399
|
-
|
400
|
-
if (ctx == null) {
|
431
|
+
return triggers.each(function () {
|
432
|
+
var ctx = $(this).data('ev-state');
|
433
|
+
if (ctx == null) {
|
434
|
+
return $(this).browseEverything($(this).data());
|
435
|
+
}
|
401
436
|
});
|
402
437
|
};
|
403
438
|
|
404
|
-
if (
|
439
|
+
if (typeof Turbolinks !== 'undefined' && Turbolinks !== null && Turbolinks.supported) {
|
405
440
|
// Use turbolinks:load for Turbolinks 5, otherwise use the old way
|
406
441
|
if (Turbolinks.BrowserAdapter) {
|
407
442
|
$(document).on('turbolinks:load', auto_toggle);
|
File without changes
|
@@ -59,9 +59,6 @@
|
|
59
59
|
border-top: none;
|
60
60
|
}
|
61
61
|
|
62
|
-
&.detail {
|
63
|
-
}
|
64
|
-
|
65
62
|
&.list ul {
|
66
63
|
@include content-columns(3);
|
67
64
|
}
|
@@ -97,11 +94,15 @@
|
|
97
94
|
|
98
95
|
.ev-files {
|
99
96
|
height: 50vh;
|
100
|
-
li {
|
97
|
+
li {
|
98
|
+
@include ev-link;
|
99
|
+
}
|
101
100
|
}
|
102
101
|
|
103
102
|
.ev-providers {
|
104
|
-
select {
|
103
|
+
select {
|
104
|
+
width: 30%
|
105
|
+
}
|
105
106
|
}
|
106
107
|
|
107
108
|
.loading {
|
File without changes
|
data/browse-everything.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency 'bixby', '>= 1.0'
|
35
35
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
36
36
|
spec.add_development_dependency 'capybara'
|
37
|
-
spec.add_development_dependency 'chromedriver-helper', '
|
37
|
+
spec.add_development_dependency 'chromedriver-helper', '~> 2.1'
|
38
38
|
spec.add_development_dependency 'coveralls'
|
39
39
|
spec.add_development_dependency 'engine_cart', '~> 2.0'
|
40
40
|
spec.add_development_dependency 'factory_bot_rails'
|
@@ -45,6 +45,7 @@ Gem::Specification.new do |spec|
|
|
45
45
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
46
46
|
spec.add_development_dependency 'rspec-its'
|
47
47
|
spec.add_development_dependency 'rspec-rails'
|
48
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
48
49
|
spec.add_development_dependency 'rubocop-rspec'
|
49
50
|
spec.add_development_dependency 'selenium-webdriver'
|
50
51
|
spec.add_development_dependency 'simplecov'
|
@@ -91,7 +91,7 @@ module BrowseEverything
|
|
91
91
|
return @downloaded_files[path] if @downloaded_files.key?(path)
|
92
92
|
|
93
93
|
# This ensures that the name of the file its extension are preserved for user downloads
|
94
|
-
temp_file_path = File.join(
|
94
|
+
temp_file_path = File.join(download_directory_path, File.basename(path))
|
95
95
|
temp_file = File.open(temp_file_path, mode: 'w+', encoding: 'ascii-8bit')
|
96
96
|
client.download(path) do |chunk|
|
97
97
|
temp_file.write chunk
|
@@ -160,6 +160,21 @@ module BrowseEverything
|
|
160
160
|
def redirect_uri(url_options)
|
161
161
|
connector_response_url(**url_options)
|
162
162
|
end
|
163
|
+
|
164
|
+
# Ensures that the "tmp" directory is used if there is no default download
|
165
|
+
# directory specified in the configuration
|
166
|
+
# @return [String]
|
167
|
+
def default_download_directory
|
168
|
+
Rails.root.join('tmp')
|
169
|
+
end
|
170
|
+
|
171
|
+
# Retrieves the directory path for downloads used when retrieving the
|
172
|
+
# resource from Dropbox
|
173
|
+
# @return [String]
|
174
|
+
def download_directory_path
|
175
|
+
dir_path = config[:download_directory] || default_download_directory
|
176
|
+
File.expand_path(dir_path)
|
177
|
+
end
|
163
178
|
end
|
164
179
|
end
|
165
180
|
end
|
@@ -31,8 +31,13 @@ module BrowseEverything
|
|
31
31
|
attr_accessor :chunk_size
|
32
32
|
|
33
33
|
class << self
|
34
|
-
|
35
|
-
|
34
|
+
# Determines whether or not a remote resource can be retrieved
|
35
|
+
# @param uri [String] URI for the remote resource (usually a URL)
|
36
|
+
# @param headers [Hash] any custom headers required to transit the request
|
37
|
+
def can_retrieve?(uri, headers = {})
|
38
|
+
request_headers = headers.merge(Range: 'bytes=0-0')
|
39
|
+
response = Typhoeus.get(uri, headers: request_headers)
|
40
|
+
response.success?
|
36
41
|
end
|
37
42
|
end
|
38
43
|
|
@@ -4,7 +4,7 @@ include BrowserConfigHelper
|
|
4
4
|
|
5
5
|
describe BrowseEverything::Browser do
|
6
6
|
let(:file_config) do
|
7
|
-
"file_system:\n home: '/file/config/home'\ndropbox:\n client_id: 'DropboxId'\n client_secret: 'DropboxClientSecret'"
|
7
|
+
"file_system:\n home: '/file/config/home'\ndropbox:\n client_id: 'DropboxId'\n client_secret: 'DropboxClientSecret'\n download_directory: 'tmp/'"
|
8
8
|
end
|
9
9
|
|
10
10
|
let(:global_config) do
|
@@ -14,7 +14,8 @@ describe BrowseEverything::Browser do
|
|
14
14
|
},
|
15
15
|
dropbox: {
|
16
16
|
client_id: 'DropboxId',
|
17
|
-
client_secret: 'DropboxClientSecret'
|
17
|
+
client_secret: 'DropboxClientSecret',
|
18
|
+
download_directory: 'tmp/'
|
18
19
|
}
|
19
20
|
}
|
20
21
|
end
|
@@ -26,7 +27,8 @@ describe BrowseEverything::Browser do
|
|
26
27
|
},
|
27
28
|
dropbox: {
|
28
29
|
client_id: 'DropboxId',
|
29
|
-
client_secret: 'DropboxClientSecret'
|
30
|
+
client_secret: 'DropboxClientSecret',
|
31
|
+
download_directory: 'tmp/'
|
30
32
|
},
|
31
33
|
url_options: url_options
|
32
34
|
}
|
@@ -8,7 +8,8 @@ describe BrowseEverything::Driver::Dropbox do
|
|
8
8
|
let(:provider_yml) do
|
9
9
|
{
|
10
10
|
client_id: 'client-id',
|
11
|
-
client_secret: 'client-secret'
|
11
|
+
client_secret: 'client-secret',
|
12
|
+
download_directory: 'spec/fixtures/'
|
12
13
|
}
|
13
14
|
end
|
14
15
|
let(:oauth_response_body) do
|
@@ -63,6 +64,10 @@ describe BrowseEverything::Driver::Dropbox do
|
|
63
64
|
|
64
65
|
before { driver.connect({ code: 'code' }, {}, connector_response_url_options) }
|
65
66
|
|
67
|
+
it 'accesses the download directory' do
|
68
|
+
expect(driver.config).to include('download_directory' => 'spec/fixtures/')
|
69
|
+
end
|
70
|
+
|
66
71
|
describe '#auth_link' do
|
67
72
|
subject { driver.auth_link(connector_response_url_options) }
|
68
73
|
|
@@ -133,6 +138,20 @@ describe BrowseEverything::Driver::Dropbox do
|
|
133
138
|
expect(downloaded_file.read).not_to be_empty
|
134
139
|
end
|
135
140
|
end
|
141
|
+
|
142
|
+
context 'when the configuration does not specify a download directory' do
|
143
|
+
let(:provider_yml) do
|
144
|
+
{
|
145
|
+
client_id: 'client-id',
|
146
|
+
client_secret: 'client-secret'
|
147
|
+
}
|
148
|
+
end
|
149
|
+
let(:downloaded_file_path) { link_args.first }
|
150
|
+
|
151
|
+
it 'uses the "tmp" directory as the default path' do
|
152
|
+
expect(downloaded_file_path).to include '/tmp/Getting Started.pdf'
|
153
|
+
end
|
154
|
+
end
|
136
155
|
end
|
137
156
|
end
|
138
157
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -19,10 +19,10 @@ class TestAppGenerator < Rails::Generators::Base
|
|
19
19
|
insert_into_file 'app/assets/stylesheets/application.css.scss', after: '*/' do
|
20
20
|
if ENV['TEST_BOOTSTRAP'] == "3"
|
21
21
|
# bootstrap 3 from bootstrap-sass gem
|
22
|
-
%(\n\n@import "bootstrap-sprockets";\n@import "bootstrap";\n@import "browse_everything_bootstrap3";)
|
22
|
+
%(\n\n@import "bootstrap-sprockets";\n@import "bootstrap";\n@import "browse_everything/browse_everything_bootstrap3";)
|
23
23
|
else
|
24
24
|
# bootstrap4 from bootstrap gem
|
25
|
-
%(\n\n@import "bootstrap";\n@import "browse_everything_bootstrap4";)
|
25
|
+
%(\n\n@import "bootstrap";\n@import "browse_everything/browse_everything_bootstrap4";)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
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.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carolyn Cole
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2019-03-13 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: addressable
|
@@ -215,16 +215,16 @@ dependencies:
|
|
215
215
|
name: chromedriver-helper
|
216
216
|
requirement: !ruby/object:Gem::Requirement
|
217
217
|
requirements:
|
218
|
-
- -
|
218
|
+
- - "~>"
|
219
219
|
- !ruby/object:Gem::Version
|
220
|
-
version:
|
220
|
+
version: '2.1'
|
221
221
|
type: :development
|
222
222
|
prerelease: false
|
223
223
|
version_requirements: !ruby/object:Gem::Requirement
|
224
224
|
requirements:
|
225
|
-
- -
|
225
|
+
- - "~>"
|
226
226
|
- !ruby/object:Gem::Version
|
227
|
-
version:
|
227
|
+
version: '2.1'
|
228
228
|
- !ruby/object:Gem::Dependency
|
229
229
|
name: coveralls
|
230
230
|
requirement: !ruby/object:Gem::Requirement
|
@@ -365,6 +365,20 @@ dependencies:
|
|
365
365
|
- - ">="
|
366
366
|
- !ruby/object:Gem::Version
|
367
367
|
version: '0'
|
368
|
+
- !ruby/object:Gem::Dependency
|
369
|
+
name: rspec_junit_formatter
|
370
|
+
requirement: !ruby/object:Gem::Requirement
|
371
|
+
requirements:
|
372
|
+
- - ">="
|
373
|
+
- !ruby/object:Gem::Version
|
374
|
+
version: '0'
|
375
|
+
type: :development
|
376
|
+
prerelease: false
|
377
|
+
version_requirements: !ruby/object:Gem::Requirement
|
378
|
+
requirements:
|
379
|
+
- - ">="
|
380
|
+
- !ruby/object:Gem::Version
|
381
|
+
version: '0'
|
368
382
|
- !ruby/object:Gem::Dependency
|
369
383
|
name: rubocop-rspec
|
370
384
|
requirement: !ruby/object:Gem::Requirement
|
@@ -447,6 +461,7 @@ executables: []
|
|
447
461
|
extensions: []
|
448
462
|
extra_rdoc_files: []
|
449
463
|
files:
|
464
|
+
- ".circleci/config.yml"
|
450
465
|
- ".engine_cart.yml"
|
451
466
|
- ".gitignore"
|
452
467
|
- ".rspec"
|
@@ -463,9 +478,10 @@ files:
|
|
463
478
|
- SUPPORT.md
|
464
479
|
- app/assets/javascripts/browse_everything.js
|
465
480
|
- app/assets/javascripts/browse_everything/behavior.js
|
466
|
-
- app/assets/stylesheets/
|
467
|
-
- app/assets/stylesheets/_browse_everything_bootstrap4.scss
|
481
|
+
- app/assets/stylesheets/browse_everything.scss
|
468
482
|
- app/assets/stylesheets/browse_everything/_browse_everything.scss
|
483
|
+
- app/assets/stylesheets/browse_everything/_browse_everything_bootstrap3.scss
|
484
|
+
- app/assets/stylesheets/browse_everything/_browse_everything_bootstrap4.scss
|
469
485
|
- app/assets/stylesheets/jquery.treetable.theme.browse.css
|
470
486
|
- app/controllers/browse_everything_controller.rb
|
471
487
|
- app/helpers/browse_everything_helper.rb
|
@@ -560,12 +576,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
560
576
|
version: '0'
|
561
577
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
562
578
|
requirements:
|
563
|
-
- - "
|
579
|
+
- - ">="
|
564
580
|
- !ruby/object:Gem::Version
|
565
|
-
version:
|
581
|
+
version: '0'
|
566
582
|
requirements: []
|
567
|
-
|
568
|
-
rubygems_version: 2.7.3
|
583
|
+
rubygems_version: 3.0.1
|
569
584
|
signing_key:
|
570
585
|
specification_version: 4
|
571
586
|
summary: AJAX/Rails engine file browser for cloud storage services
|