rails-uploader 0.5.7 → 0.5.9
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 +4 -4
- data/README.md +7 -7
- data/lib/generators/uploader/install/templates/20130905144515_create_assets.rb +1 -1
- data/lib/uploader/fileupload_glue.rb +22 -0
- data/lib/uploader/fileuploads.rb +2 -1
- data/lib/uploader/helpers/field_tag.rb +4 -8
- data/lib/uploader/version.rb +1 -1
- data/spec/dummy/Rakefile +2 -3
- data/spec/dummy/app/assets/config/manifest.js +1 -1
- data/spec/dummy/app/assets/stylesheets/application.css +7 -5
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -1
- data/spec/dummy/app/jobs/application_job.rb +7 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/article.rb +1 -1
- data/spec/dummy/app/models/asset.rb +1 -1
- data/spec/dummy/app/views/layouts/application.html.erb +18 -9
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/app/views/pwa/manifest.json.erb +22 -0
- data/spec/dummy/app/views/pwa/service-worker.js +26 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +37 -0
- data/spec/dummy/config/application.rb +39 -47
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +20 -13
- data/spec/dummy/config/environment.rb +4 -4
- data/spec/dummy/config/environments/development.rb +64 -22
- data/spec/dummy/config/environments/production.rb +74 -41
- data/spec/dummy/config/environments/test.rb +51 -20
- data/spec/dummy/config/initializers/assets.rb +12 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +8 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -9
- data/spec/dummy/config/initializers/permissions_policy.rb +13 -0
- data/spec/dummy/config/locales/en.yml +28 -2
- data/spec/dummy/config/puma.rb +34 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +4 -2
- data/spec/dummy/db/migrate/20120508093830_create_articles.rb +1 -1
- data/spec/dummy/db/migrate/20130905144515_create_assets.rb +34 -0
- data/spec/dummy/log/test.log +1677 -0
- data/spec/dummy/public/404.html +55 -14
- data/spec/dummy/public/406-unsupported-browser.html +66 -0
- data/spec/dummy/public/422.html +55 -14
- data/spec/dummy/public/500.html +54 -13
- data/spec/dummy/public/icon.png +0 -0
- data/spec/dummy/public/icon.svg +3 -0
- data/spec/dummy/public/uploads/picture/data/1/rails.png +0 -0
- data/spec/dummy/public/uploads/picture/data/1/thumb_rails.png +0 -0
- data/spec/dummy/storage/test.sqlite3 +0 -0
- data/spec/dummy/tmp/local_secret.txt +1 -0
- data/spec/factories/factories.rb +16 -0
- data/spec/fileuploads_spec.rb +30 -30
- data/spec/mongoid_spec.rb +5 -3
- data/spec/rails_helper.rb +80 -0
- data/spec/requests/attachments_controller_spec.rb +4 -4
- data/spec/spec_helper.rb +84 -45
- data/spec/uploader_spec.rb +5 -3
- metadata +88 -91
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/app/assets/javascripts/application.js +0 -15
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/script/rails +0 -6
- data/spec/factories/articles.rb +0 -9
- data/spec/factories/assets.rb +0 -11
- /data/spec/dummy/{public/favicon.ico → log/development.log} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e4a47c930e19f75bff3e97c7db634701d5e8125a68b2228f62ef079c7d6591a
|
|
4
|
+
data.tar.gz: c16fbca2e5353a1f6f6c9bec4babdde638eaf05c31c484330360c378d4d7a439
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe5651721228ed34179b47cd505d9edff7fb185bb500ceffaf847df627595ff7efedf974676467080abc434d6bb56a4f76d9c34d916be4cce5c6dcb24b008710
|
|
7
|
+
data.tar.gz: 77dade7760215667c1197d125cee29890386a8fa2d4a673348a103ad0724c9158daabef2abf613a95d9677b5c308e4b35af04d68ac46aa89de372122d55a41bc
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://app.travis-ci.com/superp/rails-uploader)
|
|
2
2
|
|
|
3
3
|
# HTML5 File uploader for rails
|
|
4
4
|
|
|
@@ -21,7 +21,7 @@ mount Uploader::Engine => '/uploader'
|
|
|
21
21
|
Migration for ActiveRecord:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
|
|
24
|
+
bundle exec rails g uploader:install
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
@@ -48,14 +48,12 @@ class PictureUploader < CarrierWave::Uploader::Base
|
|
|
48
48
|
# Choose what kind of storage to use for this uploader:
|
|
49
49
|
storage :file
|
|
50
50
|
|
|
51
|
-
EXTENSION_WHITELIST = %w[jpg jpeg gif png].freeze
|
|
52
|
-
|
|
53
51
|
version :thumb do
|
|
54
52
|
process resize_to_fill: [100, 100]
|
|
55
53
|
end
|
|
56
54
|
|
|
57
55
|
def extension_whitelist
|
|
58
|
-
|
|
56
|
+
%w[jpg jpeg gif png]
|
|
59
57
|
end
|
|
60
58
|
end
|
|
61
59
|
```
|
|
@@ -286,6 +284,8 @@ That's it!
|
|
|
286
284
|
|
|
287
285
|
## Testing
|
|
288
286
|
|
|
289
|
-
|
|
287
|
+
```
|
|
288
|
+
rspec ./spec/
|
|
289
|
+
```
|
|
290
290
|
|
|
291
|
-
Copyright (c)
|
|
291
|
+
Copyright (c) 2022 Fodojo LLC, released under the MIT license
|
|
@@ -62,6 +62,28 @@ module Uploader
|
|
|
62
62
|
association(method_name).send(name)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
def extension_whitelist(method_name)
|
|
66
|
+
model = klass(method_name)
|
|
67
|
+
uploader = model.respond_to?(:uploaders) ? model.uploaders[:data] : nil
|
|
68
|
+
|
|
69
|
+
possible_sources = [
|
|
70
|
+
@record,
|
|
71
|
+
model,
|
|
72
|
+
uploader,
|
|
73
|
+
uploader.respond_to?(:new) ? uploader.new : nil
|
|
74
|
+
].compact
|
|
75
|
+
|
|
76
|
+
possible_sources.each do |source|
|
|
77
|
+
if source.respond_to?(:extension_whitelist)
|
|
78
|
+
return source.extension_whitelist
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
return unless uploader.try(:const_defined?, :EXTENSION_WHITELIST)
|
|
83
|
+
|
|
84
|
+
uploader::EXTENSION_WHITELIST
|
|
85
|
+
end
|
|
86
|
+
|
|
65
87
|
protected
|
|
66
88
|
|
|
67
89
|
def available_fileuploads
|
data/lib/uploader/fileuploads.rb
CHANGED
|
@@ -9,7 +9,8 @@ module Uploader
|
|
|
9
9
|
included do
|
|
10
10
|
class_attribute :fileupload_options, instance_writer: false
|
|
11
11
|
|
|
12
|
-
delegate :asset, :multiple?, :params, :klass,
|
|
12
|
+
delegate :asset, :multiple?, :params, :klass,
|
|
13
|
+
:extension_whitelist, to: :fileupload_glue, prefix: :fileupload
|
|
13
14
|
|
|
14
15
|
after_create :fileupload_update, if: :fileupload_changed?
|
|
15
16
|
end
|
|
@@ -73,10 +73,10 @@ module Uploader
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def input_html
|
|
76
|
-
@input_html ||= { multiple: multiple?, class: 'uploader' }.merge(input_html_options)
|
|
76
|
+
@input_html ||= { multiple: multiple?, class: 'uploader' }.merge!(input_html_options)
|
|
77
77
|
@input_html[:data] ||= {}
|
|
78
78
|
@input_html[:data][:url] ||= attachments_path(singular: !multiple?)
|
|
79
|
-
@input_html[:accept] ||=
|
|
79
|
+
@input_html[:accept] ||= ".#{extension_whitelist.join(',.')}" if extension_whitelist.any?
|
|
80
80
|
@input_html
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -84,12 +84,8 @@ module Uploader
|
|
|
84
84
|
@options.reject { |key, _value| RESERVED_OPTIONS_KEYS.include?(key.to_s) }
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
def
|
|
88
|
-
|
|
89
|
-
return unless klass.uploaders[:data].try(:const_defined?, :EXTENSION_WHITELIST)
|
|
90
|
-
|
|
91
|
-
exts = klass.uploaders[:data]::EXTENSION_WHITELIST
|
|
92
|
-
".#{exts.join(', .')}" if exts.any?
|
|
87
|
+
def extension_whitelist
|
|
88
|
+
@extension_whitelist ||= Array(@object.fileupload_extension_whitelist(method_name)).compact
|
|
93
89
|
end
|
|
94
90
|
end
|
|
95
91
|
end
|
data/lib/uploader/version.rb
CHANGED
data/spec/dummy/Rakefile
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env rake
|
|
2
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
3
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
require_relative "config/application"
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
Rails.application.load_tasks
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* listed below.
|
|
4
4
|
*
|
|
5
5
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
-
* or vendor/assets/stylesheets
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
7
|
*
|
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the
|
|
9
|
-
* compiled file
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
10
12
|
*
|
|
11
|
-
*= require_self
|
|
12
13
|
*= require_tree .
|
|
13
|
-
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
|
4
|
+
|
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
|
7
|
+
end
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
# index_assets_on_assetable_type_and_assetable_id (assetable_type,assetable_id)
|
|
21
21
|
# index_assets_on_user_id (user_id)
|
|
22
22
|
#
|
|
23
|
-
class Asset <
|
|
23
|
+
class Asset < ApplicationRecord
|
|
24
24
|
include Uploader::Asset
|
|
25
25
|
|
|
26
26
|
belongs_to :assetable, polymorphic: true
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<body>
|
|
3
|
+
<head>
|
|
4
|
+
<title><%= content_for(:title) || "Dummy" %></title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
<%= csp_meta_tag %>
|
|
10
9
|
|
|
11
|
-
<%= yield %>
|
|
10
|
+
<%= yield :head %>
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
<link rel="manifest" href="/manifest.json">
|
|
13
|
+
<link rel="icon" href="/icon.png" type="image/png">
|
|
14
|
+
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
|
15
|
+
<link rel="apple-touch-icon" href="/icon.png">
|
|
16
|
+
<%= stylesheet_link_tag "application" %>
|
|
17
|
+
<%= javascript_include_tag "application" %>
|
|
18
|
+
</head>
|
|
19
|
+
|
|
20
|
+
<body>
|
|
21
|
+
<%= yield %>
|
|
22
|
+
</body>
|
|
14
23
|
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= yield %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Dummy",
|
|
3
|
+
"icons": [
|
|
4
|
+
{
|
|
5
|
+
"src": "/icon.png",
|
|
6
|
+
"type": "image/png",
|
|
7
|
+
"sizes": "512x512"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"src": "/icon.png",
|
|
11
|
+
"type": "image/png",
|
|
12
|
+
"sizes": "512x512",
|
|
13
|
+
"purpose": "maskable"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"start_url": "/",
|
|
17
|
+
"display": "standalone",
|
|
18
|
+
"scope": "/",
|
|
19
|
+
"description": "Dummy.",
|
|
20
|
+
"theme_color": "red",
|
|
21
|
+
"background_color": "red"
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Add a service worker for processing Web Push notifications:
|
|
2
|
+
//
|
|
3
|
+
// self.addEventListener("push", async (event) => {
|
|
4
|
+
// const { title, options } = await event.data.json()
|
|
5
|
+
// event.waitUntil(self.registration.showNotification(title, options))
|
|
6
|
+
// })
|
|
7
|
+
//
|
|
8
|
+
// self.addEventListener("notificationclick", function(event) {
|
|
9
|
+
// event.notification.close()
|
|
10
|
+
// event.waitUntil(
|
|
11
|
+
// clients.matchAll({ type: "window" }).then((clientList) => {
|
|
12
|
+
// for (let i = 0; i < clientList.length; i++) {
|
|
13
|
+
// let client = clientList[i]
|
|
14
|
+
// let clientPath = (new URL(client.url)).pathname
|
|
15
|
+
//
|
|
16
|
+
// if (clientPath == event.notification.data.path && "focus" in client) {
|
|
17
|
+
// return client.focus()
|
|
18
|
+
// }
|
|
19
|
+
// }
|
|
20
|
+
//
|
|
21
|
+
// if (clients.openWindow) {
|
|
22
|
+
// return clients.openWindow(event.notification.data.path)
|
|
23
|
+
// }
|
|
24
|
+
// })
|
|
25
|
+
// )
|
|
26
|
+
// })
|
data/spec/dummy/bin/rake
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require "fileutils"
|
|
3
|
+
|
|
4
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
|
5
|
+
APP_NAME = "dummy"
|
|
6
|
+
|
|
7
|
+
def system!(*args)
|
|
8
|
+
system(*args, exception: true)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
FileUtils.chdir APP_ROOT do
|
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
|
13
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
|
14
|
+
# Add necessary setup steps to this file.
|
|
15
|
+
|
|
16
|
+
puts "== Installing dependencies =="
|
|
17
|
+
system! "gem install bundler --conservative"
|
|
18
|
+
system("bundle check") || system!("bundle install")
|
|
19
|
+
|
|
20
|
+
# puts "\n== Copying sample files =="
|
|
21
|
+
# unless File.exist?("config/database.yml")
|
|
22
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
|
23
|
+
# end
|
|
24
|
+
|
|
25
|
+
puts "\n== Preparing database =="
|
|
26
|
+
system! "bin/rails db:prepare"
|
|
27
|
+
|
|
28
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
29
|
+
system! "bin/rails log:clear tmp:clear"
|
|
30
|
+
|
|
31
|
+
puts "\n== Restarting application server =="
|
|
32
|
+
system! "bin/rails restart"
|
|
33
|
+
|
|
34
|
+
# puts "\n== Configuring puma-dev =="
|
|
35
|
+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
|
|
36
|
+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
|
|
37
|
+
end
|
|
@@ -1,52 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
1
|
+
require_relative "boot"
|
|
2
|
+
|
|
3
|
+
require "rails"
|
|
4
|
+
# Pick the frameworks you want:
|
|
5
|
+
require "active_model/railtie"
|
|
6
|
+
require "active_job/railtie"
|
|
7
|
+
require "active_record/railtie"
|
|
8
|
+
require "active_storage/engine"
|
|
9
|
+
require "action_controller/railtie"
|
|
10
|
+
require "action_mailer/railtie"
|
|
11
|
+
require "action_mailbox/engine"
|
|
12
|
+
require "action_text/engine"
|
|
13
|
+
require "action_view/railtie"
|
|
14
|
+
require "action_cable/engine"
|
|
15
|
+
# require "rails/test_unit/railtie"
|
|
16
|
+
|
|
17
|
+
# Require the gems listed in Gemfile, including any gems
|
|
18
|
+
# you've limited to :test, :development, or :production.
|
|
19
|
+
Bundler.require(*Rails.groups)
|
|
9
20
|
|
|
10
21
|
module Dummy
|
|
11
22
|
class Application < Rails::Application
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# config.
|
|
29
|
-
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
# config.i18n.default_locale = :de
|
|
33
|
-
|
|
34
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
|
35
|
-
config.encoding = 'utf-8'
|
|
36
|
-
|
|
37
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
|
38
|
-
config.filter_parameters += [:password]
|
|
39
|
-
|
|
40
|
-
# Use SQL instead of Active Record's schema dumper when creating the database.
|
|
41
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
42
|
-
# like if you have constraints or database-specific column types
|
|
43
|
-
# config.active_record.schema_format = :sql
|
|
44
|
-
|
|
45
|
-
# Enable the asset pipeline
|
|
46
|
-
config.assets.enabled = true
|
|
47
|
-
|
|
48
|
-
# Version of your assets, change this if you want to expire all your assets
|
|
49
|
-
config.assets.version = '1.0'
|
|
23
|
+
config.load_defaults Rails::VERSION::STRING.to_f
|
|
24
|
+
|
|
25
|
+
# For compatibility with applications that use this config
|
|
26
|
+
config.action_controller.include_all_helpers = false
|
|
27
|
+
|
|
28
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
|
29
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
|
30
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
|
31
|
+
config.autoload_lib(ignore: %w[assets tasks])
|
|
32
|
+
|
|
33
|
+
# Configuration for the application, engines, and railties goes here.
|
|
34
|
+
#
|
|
35
|
+
# These settings can be overridden in specific environments using the files
|
|
36
|
+
# in config/environments, which are processed later.
|
|
37
|
+
#
|
|
38
|
+
# config.time_zone = "Central Time (US & Canada)"
|
|
39
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
|
40
|
+
|
|
41
|
+
# Don't generate system test files.
|
|
42
|
+
config.generators.system_tests = nil
|
|
50
43
|
end
|
|
51
44
|
end
|
|
52
|
-
|
data/spec/dummy/config/boot.rb
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# Set up gems listed in the Gemfile.
|
|
2
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
|
|
3
3
|
|
|
4
|
-
if File.exist?(
|
|
5
|
-
|
|
6
|
-
require 'bundler'
|
|
7
|
-
Bundler.setup
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
|
4
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
|
5
|
+
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
# SQLite
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
|
2
2
|
# gem install sqlite3
|
|
3
3
|
#
|
|
4
4
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
-
# gem
|
|
6
|
-
|
|
5
|
+
# gem "sqlite3"
|
|
6
|
+
#
|
|
7
|
+
default: &default
|
|
7
8
|
adapter: sqlite3
|
|
8
|
-
|
|
9
|
-
pool: 5
|
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
10
10
|
timeout: 5000
|
|
11
11
|
|
|
12
|
+
development:
|
|
13
|
+
<<: *default
|
|
14
|
+
database: storage/development.sqlite3
|
|
15
|
+
|
|
12
16
|
# Warning: The database defined as "test" will be erased and
|
|
13
17
|
# re-generated from your development database when you run "rake".
|
|
14
18
|
# Do not set this db to the same as development or production.
|
|
15
19
|
test:
|
|
16
|
-
|
|
17
|
-
database:
|
|
18
|
-
|
|
19
|
-
timeout: 5000
|
|
20
|
+
<<: *default
|
|
21
|
+
database: storage/test.sqlite3
|
|
22
|
+
|
|
20
23
|
|
|
24
|
+
# SQLite3 write its data on the local filesystem, as such it requires
|
|
25
|
+
# persistent disks. If you are deploying to a managed service, you should
|
|
26
|
+
# make sure it provides disk persistence, as many don't.
|
|
27
|
+
#
|
|
28
|
+
# Similarly, if you deploy your application as a Docker container, you must
|
|
29
|
+
# ensure the database is located in a persisted volume.
|
|
21
30
|
production:
|
|
22
|
-
|
|
23
|
-
database:
|
|
24
|
-
pool: 5
|
|
25
|
-
timeout: 5000
|
|
31
|
+
<<: *default
|
|
32
|
+
# database: path/to/persistent/storage/production.sqlite3
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Load the
|
|
2
|
-
|
|
1
|
+
# Load the Rails application.
|
|
2
|
+
require_relative "application"
|
|
3
3
|
|
|
4
|
-
# Initialize the
|
|
5
|
-
|
|
4
|
+
# Initialize the Rails application.
|
|
5
|
+
Rails.application.initialize!
|