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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -7
  3. data/lib/generators/uploader/install/templates/20130905144515_create_assets.rb +1 -1
  4. data/lib/uploader/fileupload_glue.rb +22 -0
  5. data/lib/uploader/fileuploads.rb +2 -1
  6. data/lib/uploader/helpers/field_tag.rb +4 -8
  7. data/lib/uploader/version.rb +1 -1
  8. data/spec/dummy/Rakefile +2 -3
  9. data/spec/dummy/app/assets/config/manifest.js +1 -1
  10. data/spec/dummy/app/assets/stylesheets/application.css +7 -5
  11. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  12. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  13. data/spec/dummy/app/controllers/application_controller.rb +2 -1
  14. data/spec/dummy/app/jobs/application_job.rb +7 -0
  15. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  16. data/spec/dummy/app/models/application_record.rb +3 -0
  17. data/spec/dummy/app/models/article.rb +1 -1
  18. data/spec/dummy/app/models/asset.rb +1 -1
  19. data/spec/dummy/app/views/layouts/application.html.erb +18 -9
  20. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  21. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  22. data/spec/dummy/app/views/pwa/manifest.json.erb +22 -0
  23. data/spec/dummy/app/views/pwa/service-worker.js +26 -0
  24. data/spec/dummy/bin/rails +4 -0
  25. data/spec/dummy/bin/rake +4 -0
  26. data/spec/dummy/bin/setup +37 -0
  27. data/spec/dummy/config/application.rb +39 -47
  28. data/spec/dummy/config/boot.rb +4 -9
  29. data/spec/dummy/config/cable.yml +10 -0
  30. data/spec/dummy/config/database.yml +20 -13
  31. data/spec/dummy/config/environment.rb +4 -4
  32. data/spec/dummy/config/environments/development.rb +64 -22
  33. data/spec/dummy/config/environments/production.rb +74 -41
  34. data/spec/dummy/config/environments/test.rb +51 -20
  35. data/spec/dummy/config/initializers/assets.rb +12 -0
  36. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  37. data/spec/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  38. data/spec/dummy/config/initializers/inflections.rb +10 -9
  39. data/spec/dummy/config/initializers/permissions_policy.rb +13 -0
  40. data/spec/dummy/config/locales/en.yml +28 -2
  41. data/spec/dummy/config/puma.rb +34 -0
  42. data/spec/dummy/config/storage.yml +34 -0
  43. data/spec/dummy/config.ru +4 -2
  44. data/spec/dummy/db/migrate/20120508093830_create_articles.rb +1 -1
  45. data/spec/dummy/db/migrate/20130905144515_create_assets.rb +34 -0
  46. data/spec/dummy/log/test.log +1677 -0
  47. data/spec/dummy/public/404.html +55 -14
  48. data/spec/dummy/public/406-unsupported-browser.html +66 -0
  49. data/spec/dummy/public/422.html +55 -14
  50. data/spec/dummy/public/500.html +54 -13
  51. data/spec/dummy/public/icon.png +0 -0
  52. data/spec/dummy/public/icon.svg +3 -0
  53. data/spec/dummy/public/uploads/picture/data/1/rails.png +0 -0
  54. data/spec/dummy/public/uploads/picture/data/1/thumb_rails.png +0 -0
  55. data/spec/dummy/storage/test.sqlite3 +0 -0
  56. data/spec/dummy/tmp/local_secret.txt +1 -0
  57. data/spec/factories/factories.rb +16 -0
  58. data/spec/fileuploads_spec.rb +30 -30
  59. data/spec/mongoid_spec.rb +5 -3
  60. data/spec/rails_helper.rb +80 -0
  61. data/spec/requests/attachments_controller_spec.rb +4 -4
  62. data/spec/spec_helper.rb +84 -45
  63. data/spec/uploader_spec.rb +5 -3
  64. metadata +88 -91
  65. data/spec/dummy/README.rdoc +0 -261
  66. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  67. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  68. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  69. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  70. data/spec/dummy/config/initializers/session_store.rb +0 -8
  71. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  72. data/spec/dummy/script/rails +0 -6
  73. data/spec/factories/articles.rb +0 -9
  74. data/spec/factories/assets.rb +0 -11
  75. /data/spec/dummy/{public/favicon.ico → log/development.log} +0 -0
@@ -1,36 +1,78 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ require "active_support/core_ext/integer/time"
3
2
 
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded any time
7
+ # it changes. This slows down response time but is perfect for development
6
8
  # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
9
+ config.enable_reloading = true
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
8
16
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
17
+ # Enable server timing.
18
+ config.server_timing = true
11
19
 
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
20
+ # Enable/disable caching. By default caching is disabled.
21
+ # Run rails dev:cache to toggle caching.
22
+ if Rails.root.join("tmp/caching-dev.txt").exist?
23
+ config.action_controller.perform_caching = true
24
+ config.action_controller.enable_fragment_cache_logging = true
15
25
 
16
- # Don't care if the mailer can't send
26
+ config.cache_store = :memory_store
27
+ config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
28
+ else
29
+ config.action_controller.perform_caching = false
30
+
31
+ config.cache_store = :null_store
32
+ end
33
+
34
+ # Store uploaded files on the local file system (see config/storage.yml for options).
35
+ config.active_storage.service = :local
36
+
37
+ # Don't care if the mailer can't send.
17
38
  config.action_mailer.raise_delivery_errors = false
18
39
 
19
- # Print deprecation notices to the Rails logger
40
+ # Disable caching for Action Mailer templates even if Action Controller
41
+ # caching is enabled.
42
+ config.action_mailer.perform_caching = false
43
+
44
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
45
+
46
+ # Print deprecation notices to the Rails logger.
20
47
  config.active_support.deprecation = :log
21
48
 
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
49
+ # Raise exceptions for disallowed deprecations.
50
+ config.active_support.disallowed_deprecation = :raise
24
51
 
25
- # Log the query plan for queries taking more than this (works
26
- # with SQLite, MySQL, and PostgreSQL)
27
- config.active_record.auto_explain_threshold_in_seconds = 0.5
52
+ # Tell Active Support which deprecation messages to disallow.
53
+ config.active_support.disallowed_deprecation_warnings = []
28
54
 
29
- # Do not compress assets
30
- config.assets.compress = false
55
+ # Raise an error on page load if there are pending migrations.
56
+ config.active_record.migration_error = :page_load
31
57
 
32
- # Expands the lines which load the assets
33
- config.assets.debug = true
58
+ # Highlight code that triggered database queries in logs.
59
+ config.active_record.verbose_query_logs = true
34
60
 
35
- config.eager_load = false
61
+ # Highlight code that enqueued background job in logs.
62
+ config.active_job.verbose_enqueue_logs = true
63
+
64
+ # Suppress logger output for asset requests.
65
+ config.assets.quiet = true
66
+
67
+ # Raises error for missing translations.
68
+ # config.i18n.raise_on_missing_translations = true
69
+
70
+ # Annotate rendered view with file names.
71
+ config.action_view.annotate_rendered_view_with_filenames = true
72
+
73
+ # Uncomment if you wish to allow Action Cable access from any origin.
74
+ # config.action_cable.disable_request_forgery_protection = true
75
+
76
+ # Raise error when a before_action's only/except options reference missing actions.
77
+ config.action_controller.raise_on_missing_callback_actions = true
36
78
  end
@@ -1,69 +1,102 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ require "active_support/core_ext/integer/time"
3
2
 
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
6
5
 
7
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
6
+ # Code is not reloaded between requests.
7
+ config.enable_reloading = false
8
+
9
+ # Eager load code on boot. This eager loads most of Rails and
10
+ # your application in memory, allowing both threaded web servers
11
+ # and those relying on copy on write to perform better.
12
+ # Rake tasks automatically ignore this option for performance.
13
+ config.eager_load = true
14
+
15
+ # Full error reports are disabled and caching is turned on.
16
+ config.consider_all_requests_local = false
9
17
  config.action_controller.perform_caching = true
10
18
 
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_files = false
19
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
20
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
21
+ # config.require_master_key = true
13
22
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
23
+ # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
24
+ # config.public_file_server.enabled = false
16
25
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
26
+ # Compress CSS using a preprocessor.
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fall back to assets pipeline if a precompiled asset is missed.
18
30
  config.assets.compile = false
19
31
 
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
32
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
33
+ # config.asset_host = "http://assets.example.com"
34
+
35
+ # Specifies the header that your server uses for sending files.
36
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
37
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
22
38
 
23
- # Defaults to Rails.root.join("public/assets")
24
- # config.assets.manifest = YOUR_PATH
39
+ # Store uploaded files on the local file system (see config/storage.yml for options).
40
+ config.active_storage.service = :local
25
41
 
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
42
+ # Mount Action Cable outside main process or domain.
43
+ # config.action_cable.mount_path = nil
44
+ # config.action_cable.url = "wss://example.com/cable"
45
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
46
+
47
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
48
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
49
+ # config.assume_ssl = true
29
50
 
30
51
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
52
+ config.force_ssl = true
53
+
54
+ # Skip http-to-https redirect for the default health check endpoint.
55
+ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
32
56
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
57
+ # Log to STDOUT by default
58
+ config.logger = ActiveSupport::Logger.new(STDOUT)
59
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
60
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
35
61
 
36
- # Prepend all log lines with the following tags
37
- # config.log_tags = [ :subdomain, :uuid ]
62
+ # Prepend all log lines with the following tags.
63
+ config.log_tags = [ :request_id ]
38
64
 
39
- # Use a different logger for distributed setups
40
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
65
+ # "info" includes generic and useful information about system operation, but avoids logging too much
66
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
67
+ # want to log everything, set the level to "debug".
68
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
41
69
 
42
- # Use a different cache store in production
70
+ # Use a different cache store in production.
43
71
  # config.cache_store = :mem_cache_store
44
72
 
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
- # config.action_controller.asset_host = "http://assets.example.com"
73
+ # Use a real queuing backend for Active Job (and separate queues per environment).
74
+ # config.active_job.queue_adapter = :resque
75
+ # config.active_job.queue_name_prefix = "dummy_production"
47
76
 
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
- # config.assets.precompile += %w( search.js )
77
+ # Disable caching for Action Mailer templates even if Action Controller
78
+ # caching is enabled.
79
+ config.action_mailer.perform_caching = false
50
80
 
51
- # Disable delivery errors, bad email addresses will be ignored
81
+ # Ignore bad email addresses and do not raise email delivery errors.
82
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
52
83
  # config.action_mailer.raise_delivery_errors = false
53
84
 
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
85
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
- # the I18n.default_locale when a translation can not be found)
86
+ # the I18n.default_locale when a translation cannot be found).
59
87
  config.i18n.fallbacks = true
60
88
 
61
- # Send deprecation notices to registered listeners
62
- config.active_support.deprecation = :notify
89
+ # Don't log any deprecations.
90
+ config.active_support.report_deprecations = false
63
91
 
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
92
+ # Do not dump schema after migrations.
93
+ config.active_record.dump_schema_after_migration = false
67
94
 
68
- config.eager_load = true
95
+ # Enable DNS rebinding protection and other `Host` header attacks.
96
+ # config.hosts = [
97
+ # "example.com", # Allow requests from example.com
98
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
99
+ # ]
100
+ # Skip DNS rebinding protection for the default health check endpoint.
101
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
69
102
  end
@@ -1,36 +1,67 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ require "active_support/core_ext/integer/time"
3
2
 
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
9
7
 
10
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_files = true
12
- config.static_cache_control = "public, max-age=3600"
8
+ Rails.application.configure do
9
+ # Settings specified here will take precedence over those in config/application.rb.
13
10
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
11
+ # While tests run files are not watched, reloading is not necessary.
12
+ config.enable_reloading = false
16
13
 
17
- # Show full error reports and disable caching
18
- config.consider_all_requests_local = true
14
+ # Eager loading loads your entire application. When running a single test locally,
15
+ # this is usually not necessary, and can slow down your test suite. However, it's
16
+ # recommended that you enable it in continuous integration systems to ensure eager
17
+ # loading is working properly before deploying your code.
18
+ config.eager_load = ENV["CI"].present?
19
+
20
+ # Configure public file server for tests with Cache-Control for performance.
21
+ config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
22
+
23
+ # Show full error reports and disable caching.
24
+ config.consider_all_requests_local = true
19
25
  config.action_controller.perform_caching = false
26
+ config.cache_store = :null_store
27
+
28
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
29
+ config.action_dispatch.show_exceptions = :rescuable
20
30
 
21
- # Raise exceptions instead of rendering exception templates
22
- config.action_dispatch.show_exceptions = false
31
+ # Disable request forgery protection in test environment.
32
+ config.action_controller.allow_forgery_protection = false
23
33
 
24
- # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
34
+ # Store uploaded files on the local file system in a temporary directory.
35
+ config.active_storage.service = :test
36
+
37
+ # Disable caching for Action Mailer templates even if Action Controller
38
+ # caching is enabled.
39
+ config.action_mailer.perform_caching = false
26
40
 
27
41
  # Tell Action Mailer not to deliver emails to the real world.
28
42
  # The :test delivery method accumulates sent emails in the
29
43
  # ActionMailer::Base.deliveries array.
30
44
  config.action_mailer.delivery_method = :test
31
45
 
32
- # Print deprecation notices to the stderr
46
+ # Unlike controllers, the mailer instance doesn't have any context about the
47
+ # incoming request so you'll need to provide the :host parameter yourself.
48
+ config.action_mailer.default_url_options = { host: "www.example.com" }
49
+
50
+ # Print deprecation notices to the stderr.
33
51
  config.active_support.deprecation = :stderr
34
52
 
35
- config.eager_load = false
53
+ # Raise exceptions for disallowed deprecations.
54
+ config.active_support.disallowed_deprecation = :raise
55
+
56
+ # Tell Active Support which deprecation messages to disallow.
57
+ config.active_support.disallowed_deprecation_warnings = []
58
+
59
+ # Raises error for missing translations.
60
+ # config.i18n.raise_on_missing_translations = true
61
+
62
+ # Annotate rendered view with file names.
63
+ # config.action_view.annotate_rendered_view_with_filenames = true
64
+
65
+ # Raise error when a before_action's only/except options reference missing actions.
66
+ config.action_controller.raise_on_missing_callback_actions = true
36
67
  end
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = "1.0"
5
+
6
+ # Add additional assets to the asset load path.
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in the app/assets
11
+ # folder are already added.
12
+ # Rails.application.config.assets.precompile += %w[ admin.js admin.css ]
@@ -0,0 +1,25 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy.
4
+ # See the Securing Rails Applications Guide for more information:
5
+ # https://guides.rubyonrails.org/security.html#content-security-policy-header
6
+
7
+ # Rails.application.configure do
8
+ # config.content_security_policy do |policy|
9
+ # policy.default_src :self, :https
10
+ # policy.font_src :self, :https, :data
11
+ # policy.img_src :self, :https, :data
12
+ # policy.object_src :none
13
+ # policy.script_src :self, :https
14
+ # policy.style_src :self, :https
15
+ # # Specify URI for violation reports
16
+ # # policy.report_uri "/csp-violation-report-endpoint"
17
+ # end
18
+ #
19
+ # # Generate session nonces for permitted importmap, inline scripts, and inline styles.
20
+ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21
+ # config.content_security_policy_nonce_directives = %w(script-src style-src)
22
+ #
23
+ # # Report violations without enforcing the policy.
24
+ # # config.content_security_policy_report_only = true
25
+ # end
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4
+ # Use this to limit dissemination of sensitive information.
5
+ # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6
+ Rails.application.config.filter_parameters += [
7
+ :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
8
+ ]
@@ -1,15 +1,16 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, "\\1en"
8
+ # inflect.singular /^(ox)en/i, "\\1"
9
+ # inflect.irregular "person", "people"
9
10
  # inflect.uncountable %w( fish sheep )
10
11
  # end
11
- #
12
+
12
13
  # These inflection rules are supported but not enabled by default:
13
- # ActiveSupport::Inflector.inflections do |inflect|
14
- # inflect.acronym 'RESTful'
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym "RESTful"
15
16
  # end
@@ -0,0 +1,13 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide HTTP permissions policy. For further
4
+ # information see: https://developers.google.com/web/updates/2018/06/feature-policy
5
+
6
+ # Rails.application.config.permissions_policy do |policy|
7
+ # policy.camera :none
8
+ # policy.gyroscope :none
9
+ # policy.microphone :none
10
+ # policy.usb :none
11
+ # policy.fullscreen :self
12
+ # policy.payment :self, "https://secure.example.com"
13
+ # end
@@ -1,5 +1,31 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
1
+ # Files in the config/locales directory are used for internationalization and
2
+ # are automatically loaded by Rails. If you want to use locales other than
3
+ # English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t "hello"
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t("hello") %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more about the API, please read the Rails Internationalization guide
20
+ # at https://guides.rubyonrails.org/i18n.html.
21
+ #
22
+ # Be aware that YAML interprets the following case-insensitive strings as
23
+ # booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
24
+ # must be quoted to be interpreted as strings. For example:
25
+ #
26
+ # en:
27
+ # "yes": yup
28
+ # enabled: "ON"
3
29
 
4
30
  en:
5
31
  hello: "Hello world"
@@ -0,0 +1,34 @@
1
+ # This configuration file will be evaluated by Puma. The top-level methods that
2
+ # are invoked here are part of Puma's configuration DSL. For more information
3
+ # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
4
+
5
+ # Puma starts a configurable number of processes (workers) and each process
6
+ # serves each request in a thread from an internal thread pool.
7
+ #
8
+ # The ideal number of threads per worker depends both on how much time the
9
+ # application spends waiting for IO operations and on how much you wish to
10
+ # to prioritize throughput over latency.
11
+ #
12
+ # As a rule of thumb, increasing the number of threads will increase how much
13
+ # traffic a given process can handle (throughput), but due to CRuby's
14
+ # Global VM Lock (GVL) it has diminishing returns and will degrade the
15
+ # response time (latency) of the application.
16
+ #
17
+ # The default is set to 3 threads as it's deemed a decent compromise between
18
+ # throughput and latency for the average Rails application.
19
+ #
20
+ # Any libraries that use a connection pool or another resource pool should
21
+ # be configured to provide at least as many connections as the number of
22
+ # threads. This includes Active Record's `pool` parameter in `database.yml`.
23
+ threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
24
+ threads threads_count, threads_count
25
+
26
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
27
+ port ENV.fetch("PORT", 3000)
28
+
29
+ # Allow puma to be restarted by `bin/rails restart` command.
30
+ plugin :tmp_restart
31
+
32
+ # Specify the PID file. Defaults to tmp/pids/server.pid in development.
33
+ # In other environments, only set the PID file if requested.
34
+ pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket-<%= Rails.env %>
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket-<%= Rails.env %>
23
+
24
+ # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name-<%= Rails.env %>
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,6 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Dummy::Application
3
+ require_relative "config/environment"
4
+
5
+ run Rails.application
6
+ Rails.application.load_server
@@ -1,4 +1,4 @@
1
- class CreateArticles < ActiveRecord::Migration
1
+ class CreateArticles < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :articles do |t|
4
4
  t.string :title
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateAssets < ActiveRecord::Migration[6.1]
4
+ def self.up
5
+ create_table :assets do |t|
6
+ t.string :data_file_name, null: false
7
+ t.string :data_content_type
8
+ t.integer :data_file_size
9
+
10
+ t.integer :assetable_id, null: false
11
+ t.string :assetable_type, limit: 30, null: false
12
+ t.string :type, limit: 30
13
+
14
+ t.string :guid, limit: 30
15
+ t.string :public_token, limit: 30
16
+
17
+ t.integer :user_id
18
+ t.integer :sort_order, default: 0
19
+ t.integer :width
20
+ t.integer :height
21
+
22
+ t.timestamps
23
+ end
24
+
25
+ add_index :assets, [:assetable_type, :type, :assetable_id]
26
+ add_index :assets, :user_id
27
+ add_index :assets, :guid
28
+ add_index :assets, :public_token
29
+ end
30
+
31
+ def self.down
32
+ drop_table :assets
33
+ end
34
+ end