browse-everything 1.1.2 → 1.2.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 +93 -44
- data/.gitignore +4 -2
- data/.rubocop.yml +12 -0
- data/.rubocop_todo.yml +0 -5
- data/.tool-versions +2 -0
- data/CONTRIBUTING.md +22 -0
- data/Gemfile +41 -30
- data/README.md +66 -32
- data/Rakefile +9 -1
- data/app/assets/javascripts/browse_everything/behavior.js +29 -23
- data/app/assets/javascripts/browse_everything.js +1 -1
- data/bin/rails +14 -0
- data/browse-everything.gemspec +13 -11
- data/lib/browse_everything/driver/base.rb +1 -0
- data/lib/browse_everything/driver/dropbox.rb +5 -2
- data/lib/browse_everything/driver/file_system.rb +15 -2
- data/lib/browse_everything/engine.rb +10 -3
- data/lib/browse_everything/version.rb +1 -1
- data/lib/browse_everything.rb +1 -1
- data/spec/dummy_test_app/Rakefile +6 -0
- data/spec/dummy_test_app/app/assets/config/manifest.js +3 -0
- data/spec/dummy_test_app/app/assets/images/.keep +0 -0
- data/spec/dummy_test_app/app/assets/javascripts/application.js +25 -0
- data/spec/dummy_test_app/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy_test_app/app/assets/javascripts/channels/.keep +0 -0
- data/spec/dummy_test_app/app/assets/stylesheets/application.scss +18 -0
- data/spec/dummy_test_app/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy_test_app/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy_test_app/app/controllers/application_controller.rb +3 -0
- data/spec/dummy_test_app/app/controllers/concerns/.keep +0 -0
- data/spec/{support → dummy_test_app}/app/controllers/file_handler_controller.rb +0 -0
- data/spec/dummy_test_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_test_app/app/jobs/application_job.rb +2 -0
- data/spec/dummy_test_app/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy_test_app/app/models/application_record.rb +3 -0
- data/spec/dummy_test_app/app/models/concerns/.keep +0 -0
- data/spec/dummy_test_app/app/views/file_handler/index.html.erb +10 -0
- data/spec/{support → dummy_test_app}/app/views/file_handler/main.html.erb +6 -3
- data/spec/dummy_test_app/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy_test_app/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy_test_app/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy_test_app/bin/bundle +3 -0
- data/spec/dummy_test_app/bin/rails +4 -0
- data/spec/dummy_test_app/bin/rake +4 -0
- data/spec/dummy_test_app/bin/setup +38 -0
- data/spec/dummy_test_app/bin/update +29 -0
- data/spec/dummy_test_app/bin/yarn +11 -0
- data/spec/dummy_test_app/config/application.rb +27 -0
- data/spec/dummy_test_app/config/boot.rb +5 -0
- data/spec/dummy_test_app/config/browse_everything_providers.yml +25 -0
- data/spec/dummy_test_app/config/cable.yml +10 -0
- data/spec/dummy_test_app/config/database.yml +25 -0
- data/spec/dummy_test_app/config/environment.rb +5 -0
- data/spec/dummy_test_app/config/environments/development.rb +54 -0
- data/spec/dummy_test_app/config/environments/production.rb +91 -0
- data/spec/dummy_test_app/config/environments/test.rb +42 -0
- data/spec/dummy_test_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy_test_app/config/initializers/assets.rb +14 -0
- data/spec/dummy_test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_test_app/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy_test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy_test_app/config/initializers/inflections.rb +16 -0
- data/spec/dummy_test_app/config/initializers/mime_types.rb +4 -0
- data/spec/dummy_test_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_test_app/config/locales/en.yml +33 -0
- data/spec/dummy_test_app/config/puma.rb +56 -0
- data/spec/dummy_test_app/config/routes.rb +9 -0
- data/spec/dummy_test_app/config/secrets.yml +32 -0
- data/spec/dummy_test_app/config/spring.rb +6 -0
- data/spec/dummy_test_app/config.ru +5 -0
- data/spec/dummy_test_app/lib/assets/.keep +0 -0
- data/spec/dummy_test_app/log/.keep +0 -0
- data/spec/dummy_test_app/package.json +5 -0
- data/spec/dummy_test_app/public/404.html +67 -0
- data/spec/dummy_test_app/public/422.html +67 -0
- data/spec/dummy_test_app/public/500.html +66 -0
- data/spec/dummy_test_app/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy_test_app/public/apple-touch-icon.png +0 -0
- data/spec/dummy_test_app/public/favicon.ico +0 -0
- data/spec/dummy_test_app/tmp/.gitkeep +0 -0
- data/spec/features/select_files_spec.rb +1 -0
- data/spec/spec_helper.rb +2 -27
- data/tasks/ci.rake +1 -1
- metadata +175 -76
- data/karma.conf.js +0 -71
- data/spec/javascripts/behavior_spec.js +0 -7
- data/spec/javascripts/helpers/jasmine-jquery.js +0 -838
- data/spec/javascripts/helpers/jquery.js +0 -11008
- data/spec/javascripts/karma_spec.rb +0 -16
- data/spec/support/app/views/file_handler/index.html.erb +0 -6
- data/spec/test_app_templates/Gemfile.extra +0 -18
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -112
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'open3'
|
4
|
-
|
5
|
-
# Run karma and parse the output for failures.
|
6
|
-
# The spec will fail if any karma test fails.
|
7
|
-
describe 'Karma' do
|
8
|
-
let(:runner) { Open3.capture3('karma', 'start') }
|
9
|
-
let(:output) { runner[0] + runner[1] }
|
10
|
-
let(:status) { runner[2].exitstatus }
|
11
|
-
|
12
|
-
it 'expects all karma tests to pass' do
|
13
|
-
$stderr.puts output unless status == 0
|
14
|
-
expect(status).to eq(0)
|
15
|
-
end
|
16
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<div class="panel panel-default">
|
2
|
-
<div class="panel-body">
|
3
|
-
<a href="main" class="btn btn-large btn-primary" role="button">Enter Test App (Turbolinks)</a>
|
4
|
-
<a href="main" class="btn btn-large btn-primary" role="button" data-no-turbolink>Enter Test App (No Turbolinks)</a>
|
5
|
-
</div>
|
6
|
-
</div>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
gem 'jquery-rails'
|
2
|
-
gem 'puma-rails'
|
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
|
-
|
13
|
-
if ENV['TEST_BOOTSTRAP'] == "3"
|
14
|
-
gem "bootstrap-sass"
|
15
|
-
else
|
16
|
-
# bootstrap 4
|
17
|
-
gem "bootstrap"
|
18
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails/generators'
|
4
|
-
|
5
|
-
class TestAppGenerator < Rails::Generators::Base
|
6
|
-
source_root File.expand_path('../../../spec/test_app_templates', __dir__)
|
7
|
-
|
8
|
-
def install_engine
|
9
|
-
generate 'browse_everything:install -f'
|
10
|
-
end
|
11
|
-
|
12
|
-
def run_config_generator
|
13
|
-
generate 'browse_everything:config'
|
14
|
-
end
|
15
|
-
|
16
|
-
def inject_css
|
17
|
-
copy_file File.expand_path('app/assets/stylesheets/application.css', ENV['RAILS_ROOT']), 'app/assets/stylesheets/application.css.scss'
|
18
|
-
remove_file 'app/assets/stylesheets/application.css'
|
19
|
-
insert_into_file 'app/assets/stylesheets/application.css.scss', after: '*/' do
|
20
|
-
if ENV['TEST_BOOTSTRAP'] == "3"
|
21
|
-
# bootstrap 3 from bootstrap-sass gem
|
22
|
-
%(\n\n@import "bootstrap-sprockets";\n@import "bootstrap";\n@import "browse_everything/browse_everything_bootstrap3";)
|
23
|
-
else
|
24
|
-
# bootstrap4 from bootstrap gem
|
25
|
-
%(\n\n@import "bootstrap";\n@import "browse_everything/browse_everything_bootstrap4";)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def inject_javascript
|
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
|
-
%(
|
83
|
-
//= require jquery
|
84
|
-
//= require browse_everything
|
85
|
-
)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def inject_application
|
91
|
-
insert_into_file 'config/application.rb', after: 'Rails::Application' do
|
92
|
-
"\nconfig.autoload_paths+=[File.join(Rails.root,'../../lib')]"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def inject_routes
|
97
|
-
insert_into_file 'config/routes.rb', after: '.draw do' do
|
98
|
-
%(
|
99
|
-
|
100
|
-
root :to => "file_handler#index"
|
101
|
-
get '/main', :to => "file_handler#main"
|
102
|
-
post '/file', :to => "file_handler#update"
|
103
|
-
)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def create_test_route
|
108
|
-
copy_file '../support/app/controllers/file_handler_controller.rb', 'app/controllers/file_handler_controller.rb'
|
109
|
-
copy_file '../support/app/views/file_handler/main.html.erb', 'app/views/file_handler/main.html.erb'
|
110
|
-
copy_file '../support/app/views/file_handler/index.html.erb', 'app/views/file_handler/index.html.erb'
|
111
|
-
end
|
112
|
-
end
|