Bundle update

This commit is contained in:
echarp 2019-12-21 21:00:16 +01:00
parent e36e37c66c
commit e291f87da9
17 changed files with 161 additions and 109 deletions

View File

@ -6,10 +6,11 @@ AllCops:
Exclude: Exclude:
- db/schema.rb - db/schema.rb
TargetRubyVersion: 2.5 TargetRubyVersion: 2.5
BlockLength: Metrics/BlockLength:
Exclude: Exclude:
- app/admin/*.rb - app/admin/*.rb
- config/routes.rb - config/routes.rb
- config/environments/*.rb
Rails/HttpPositionalArguments: Rails/HttpPositionalArguments:
Enabled: false Enabled: false
Style/FrozenStringLiteralComment: Style/FrozenStringLiteralComment:

View File

@ -87,7 +87,7 @@ group :development do
# running in the background. Read more: # running in the background. Read more:
# https://github.com/rails/spring # https://github.com/rails/spring
gem 'spring' gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0' gem 'spring-watcher-listen'
# Use Puma as the app server # Use Puma as the app server
gem 'puma' gem 'puma'

View File

@ -27,18 +27,17 @@ GEM
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.0, >= 1.0.3)
actionview-encoded_mail_to (1.0.9) actionview-encoded_mail_to (1.0.9)
rails rails
activeadmin (2.4.0) activeadmin (2.6.0)
arbre (~> 1.2, >= 1.2.1) arbre (~> 1.2, >= 1.2.1)
formtastic (~> 3.1) formtastic (~> 3.1)
formtastic_i18n (~> 0.4) formtastic_i18n (~> 0.4)
inherited_resources (~> 1.7) inherited_resources (~> 1.7)
jquery-rails (~> 4.2) jquery-rails (~> 4.2)
kaminari (~> 1.0, >= 1.0.1) kaminari (~> 1.0, >= 1.0.1)
railties (>= 5.0, < 6.1) railties (>= 5.2, < 6.1)
ransack (~> 2.1, >= 2.1.1) ransack (~> 2.1, >= 2.1.1)
sassc-rails (~> 2.1) sassc-rails (~> 2.1)
sprockets (>= 3.0, < 4.1) sprockets (>= 3.0, < 4.1)
sprockets-es6 (~> 0.9, >= 0.9.2)
activejob (5.2.3) activejob (5.2.3)
activesupport (= 5.2.3) activesupport (= 5.2.3)
globalid (>= 0.3.6) globalid (>= 0.3.6)
@ -65,15 +64,11 @@ GEM
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
arel (9.0.0) arel (9.0.0)
ast (2.4.0) ast (2.4.0)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
bcrypt (3.1.13) bcrypt (3.1.13)
bindex (0.8.1) bindex (0.8.1)
brakeman (4.7.1) brakeman (4.7.2)
buftok (0.2.0) buftok (0.2.0)
builder (3.2.3) builder (3.2.4)
bundler-audit (0.6.1) bundler-audit (0.6.1)
bundler (>= 1.2.0, < 3) bundler (>= 1.2.0, < 3)
thor (~> 0.18) thor (~> 0.18)
@ -94,8 +89,8 @@ GEM
railties (>= 4.1.0) railties (>= 4.1.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
devise-i18n (1.8.2) devise-i18n (1.9.0)
devise (>= 4.6) devise (>= 4.7.1)
differ (0.1.2) differ (0.1.2)
domain_name (0.5.20190701) domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
@ -109,10 +104,10 @@ GEM
erubis (2.7.0) erubis (2.7.0)
eventmachine (1.2.7) eventmachine (1.2.7)
execjs (2.7.0) execjs (2.7.0)
ffi (1.11.1) ffi (1.11.3)
flag-icons-rails (3.1.0) flag-icons-rails (3.1.0)
sass (~> 3.2) sass (~> 3.2)
font-awesome-sass (5.11.2) font-awesome-sass (5.12.0)
sassc (>= 1.11) sassc (>= 1.11)
formatador (0.2.5) formatador (0.2.5)
formtastic (3.1.5) formtastic (3.1.5)
@ -166,7 +161,7 @@ GEM
haml (>= 4.0.6, < 6.0) haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1) html2haml (>= 1.0.1)
railties (>= 5.1) railties (>= 5.1)
haml_lint (0.34.0) haml_lint (0.34.1)
haml (>= 4.0, < 5.2) haml (>= 4.0, < 5.2)
rainbow rainbow
rubocop (>= 0.50.0) rubocop (>= 0.50.0)
@ -208,7 +203,7 @@ GEM
rails-i18n rails-i18n
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1) terminal-table (>= 1.5.1)
icalendar (2.5.3) icalendar (2.6.1)
ice_cube (~> 0.16) ice_cube (~> 0.16)
ice_cube (0.16.3) ice_cube (0.16.3)
inherited_resources (1.11.0) inherited_resources (1.11.0)
@ -243,7 +238,7 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2) ruby_dep (~> 1.2)
loofah (2.3.1) loofah (2.4.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.13) lumberjack (1.0.13)
@ -263,11 +258,11 @@ GEM
modernizr-rails (2.7.1) modernizr-rails (2.7.1)
multi_json (1.14.1) multi_json (1.14.1)
multipart-post (2.1.1) multipart-post (2.1.1)
mysql2 (0.5.2) mysql2 (0.5.3)
naught (1.1.0) naught (1.1.0)
nenv (0.3.0) nenv (0.3.0)
nio4r (2.5.2) nio4r (2.5.2)
nokogiri (1.10.5) nokogiri (1.10.7)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
notiffany (0.1.3) notiffany (0.1.3)
nenv (~> 0.1) nenv (~> 0.1)
@ -276,7 +271,7 @@ GEM
paper_trail (10.3.1) paper_trail (10.3.1)
activerecord (>= 4.2) activerecord (>= 4.2)
request_store (~> 1.1) request_store (~> 1.1)
parallel (1.18.0) parallel (1.19.1)
parser (2.6.5.0) parser (2.6.5.0)
ast (~> 2.4.0) ast (~> 2.4.0)
piwik_analytics (1.0.2) piwik_analytics (1.0.2)
@ -291,9 +286,9 @@ GEM
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.9.0) method_source (~> 0.9.0)
public_suffix (4.0.1) public_suffix (4.0.1)
puma (4.3.0) puma (4.3.1)
nio4r (~> 2.0) nio4r (~> 2.0)
rack (2.0.7) rack (2.0.8)
rack-livereload (0.3.17) rack-livereload (0.3.17)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
@ -338,7 +333,7 @@ GEM
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0) thor (>= 0.19.0, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (13.0.0) rake (13.0.1)
ransack (2.3.0) ransack (2.3.0)
actionpack (>= 5.0) actionpack (>= 5.0)
activerecord (>= 5.0) activerecord (>= 5.0)
@ -350,21 +345,21 @@ GEM
ffi (~> 1.0) ffi (~> 1.0)
rdoc (6.2.0) rdoc (6.2.0)
ref (2.0.0) ref (2.0.0)
request_store (1.4.1) request_store (1.5.0)
rack (>= 1.4) rack (>= 1.4)
responders (3.0.0) responders (3.0.0)
actionpack (>= 5.0) actionpack (>= 5.0)
railties (>= 5.0) railties (>= 5.0)
rubocop (0.76.0) rubocop (0.78.0)
jaro_winkler (~> 1.5.1) jaro_winkler (~> 1.5.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.6) parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7) unicode-display_width (>= 1.4.0, < 1.7)
rubocop-performance (1.5.0) rubocop-performance (1.5.1)
rubocop (>= 0.71.0) rubocop (>= 0.71.0)
rubocop-rails (2.3.2) rubocop-rails (2.4.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 0.72.0) rubocop (>= 0.72.0)
ruby-progressbar (1.10.1) ruby-progressbar (1.10.1)
@ -398,15 +393,11 @@ GEM
sprockets (4.0.0) sprockets (4.0.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-es6 (0.9.2)
babel-source (>= 5.8.11)
babel-transpiler
sprockets (>= 3.0.0)
sprockets-rails (3.2.1) sprockets-rails (3.2.1)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.4.1) sqlite3 (1.4.2)
strip_attributes (1.9.0) strip_attributes (1.9.0)
activemodel (>= 3.0, < 7.0) activemodel (>= 3.0, < 7.0)
sysexits (1.2.0) sysexits (1.2.0)
@ -421,7 +412,7 @@ GEM
thor (0.20.3) thor (0.20.3)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
tinymce-rails (5.1.1) tinymce-rails (5.1.4)
railties (>= 3.1.1) railties (>= 3.1.1)
turbolinks (5.2.1) turbolinks (5.2.1)
turbolinks-source (~> 5.2) turbolinks-source (~> 5.2)
@ -518,7 +509,7 @@ DEPENDENCIES
sdoc sdoc
simple_calendar simple_calendar
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen
sqlite3 sqlite3
strip_attributes strip_attributes
tagsinput-rails tagsinput-rails

View File

@ -42,6 +42,7 @@ class Event < ApplicationRecord
after_destroy EventCallbacks after_destroy EventCallbacks
default_scope { includes(:taggings, :region) }
scope :moderated, ->(*) { where moderated: true } scope :moderated, ->(*) { where moderated: true }
scope :unmoderated, ->(*) { where moderated: false } scope :unmoderated, ->(*) { where moderated: false }
scope :past, -> { where 'start_time <= ?', Time.zone.now } scope :past, -> { where 'start_time <= ?', Time.zone.now }

View File

@ -6,8 +6,8 @@ class Region < ApplicationRecord
has_many :orgas, dependent: :destroy has_many :orgas, dependent: :destroy
default_scope { order :name } default_scope { order :name }
scope :top, ->(*) { where(region: nil).includes(:regions).reorder :code } scope :top, -> { where(region: nil).includes(:regions).reorder :code }
scope :local, ->(*) { where(url: nil).or(Region.where(url: '')) } scope :local, -> { where(url: [nil, '']) }
scope :region, (lambda do |region| scope :region, (lambda do |region|
return if region.nil? || region == 'all' || region.to_i.zero? return if region.nil? || region == 'all' || region.to_i.zero?

View File

@ -1,32 +1,34 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'pathname'
require 'fileutils' require 'fileutils'
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('../', __dir__) APP_ROOT = File.expand_path('..', __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
end end
Dir.chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a way to setup or update your development environment
# automatically.
# This script is idempotent, so that you can run it at anytime and get an
# expectable outcome.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts '== Installing dependencies ==' puts '== Installing dependencies =='
system! 'gem install bundler --conservative' system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install') system('bundle check') || system!('bundle install')
# Install JavaScript dependencies if using Yarn # Install JavaScript dependencies
# system('bin/yarn') # system('bin/yarn')
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml') # unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml' # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system! 'bin/rails db:setup' system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear' system! 'bin/rails log:clear tmp:clear'

View File

@ -1,7 +1,7 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
VENDOR_PATH = File.expand_path('..', __dir__) APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(VENDOR_PATH) do Dir.chdir(APP_ROOT) do
exec "yarnpkg #{ARGV.join(' ')}" exec 'yarnpkg', *ARGV
rescue Errno::ENOENT rescue Errno::ENOENT
warn 'Yarn executable was not detected in the system.' warn 'Yarn executable was not detected in the system.'
warn 'Download Yarn at https://yarnpkg.com/en/docs/install' warn 'Download Yarn at https://yarnpkg.com/en/docs/install'

View File

@ -1,4 +1,4 @@
require File.expand_path('boot', __dir__) require_relative 'boot'
require 'rails/all' require 'rails/all'
require 'action_view/encoded_mail_to/mail_to_with_encoding' require 'action_view/encoded_mail_to/mail_to_with_encoding'
@ -12,10 +12,12 @@ module AgendaDuLibreRails
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1 config.load_defaults 5.1
# Settings in config/environments/* take precedence over those specified # Settings in config/environments/* take precedence over those specified
# here. # here.
# Application configuration should go into files in config/initializers # Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
# Set Time.zone default to the specified zone and make Active Record # Set Time.zone default to the specified zone and make Active Record
# auto-convert to this zone. # auto-convert to this zone.
@ -28,7 +30,7 @@ module AgendaDuLibreRails
# config.i18n.load_path += # config.i18n.load_path +=
# Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.load_path += config.i18n.load_path +=
Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] Dir[Rails.root.join('config/locales/**/*.{rb,yml}')]
# config.i18n.default_locale = :de # config.i18n.default_locale = :de
config.i18n.default_locale = :fr config.i18n.default_locale = :fr
config.i18n.available_locales = %i[de en fr nl pt-BR] config.i18n.available_locales = %i[de en fr nl pt-BR]

View File

@ -2,9 +2,9 @@ development:
adapter: async adapter: async
test: test:
adapter: async adapter: test
production: production:
adapter: redis adapter: redis
url: redis://localhost:6379/1 url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: agenda_du_libre_rails_production channel_prefix: agenda_du_libre_rails_production

View File

@ -14,12 +14,14 @@ Rails.application.configure do
config.consider_all_requests_local = true config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp', 'caching-dev.txt').exist? # Run rails dev:cache to toggle caching.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store config.cache_store = :memory_store
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" 'Cache-Control' => "public, max-age=#{2.days.to_i}"
} }
else else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
@ -27,8 +29,13 @@ Rails.application.configure do
config.cache_store = :null_store config.cache_store = :null_store
end end
# Store uploaded files on the local file system (see config/storage.yml for
# options).
config.active_storage.service = :local
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
config.action_mailer.smtp_settings = { openssl_verify_mode: 'none' }
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
@ -38,6 +45,9 @@ Rails.application.configure do
# Raise an error on page load if there are pending migrations. # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets. # Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large # This option may cause significant delays in view rendering with a large
# number of complex assets. # number of complex assets.
@ -46,7 +56,7 @@ Rails.application.configure do
# Suppress logger output for asset requests. # Suppress logger output for asset requests.
config.assets.quiet = true config.assets.quiet = true
# Raises error for missing translations # Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
# To have assets Local Precompilation, we need to use another path in dev # To have assets Local Precompilation, we need to use another path in dev

View File

@ -15,25 +15,22 @@ Rails.application.configure do
config.consider_all_requests_local = false config.consider_all_requests_local = false
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Attempt to read encrypted secrets from `config/secrets.yml.enc`. # Ensures that a master key has been made available in either
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or # ENV["RAILS_MASTER_KEY"]
# `config/secrets.yml.key`. # or in config/master.key. This key is used to decrypt credentials (and other
config.read_encrypted_secrets = true # encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since # Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this. # Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS. # Compress CSS using a preprocessor.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass # config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed. # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false config.assets.compile = false
# `config.assets.precompile` and `config.assets.version` have moved to
# config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com' # config.action_controller.asset_host = 'http://assets.example.com'
@ -41,7 +38,11 @@ Rails.application.configure do
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Mount Action Cable outside main process or domain # Store uploaded files on the local file system (see config/storage.yml for
# options).
config.active_storage.service = :local
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil # config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable' # config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', # config.action_cable.allowed_request_origins = [ 'http://example.com',
@ -62,9 +63,10 @@ Rails.application.configure do
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per # Use a real queuing backend for Active Job (and separate queues per
# environment) # environment).
# config.active_job.queue_adapter = :resque # config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "agenda_du_libre_rails_#{Rails.env}" # config.active_job.queue_name_prefix = "agenda_du_libre_rails_production"
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors. # Ignore bad email addresses and do not raise email delivery errors.
@ -95,4 +97,27 @@ Rails.application.configure do
# Do not dump schema after migrations. # Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false config.active_record.dump_schema_after_migration = false
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver =
# ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context =
# ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end end

View File

@ -1,11 +1,12 @@
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in # Settings specified here will take precedence over those in
# config/application.rb. # config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Do not eager load code on boot. This avoids loading your whole application
@ -16,18 +17,23 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for performance. # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
} }
# Show full error reports and disable caching. # Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates. # Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment. # Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
@ -38,6 +44,6 @@ Rails.application.configure do
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr
# Raises error for missing translations # Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
end end

View File

@ -1,3 +1,34 @@
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# 'true': 'foo'
#
# To learn more, please read the Rails Internationalization guide
# available at https://guides.rubyonrails.org/i18n.html.
en: en:
date: date:
formats: formats:

View File

@ -4,8 +4,9 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum # the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record. # and maximum; this matches the default thread size of Active Record.
# #
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
threads threads_count, threads_count min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is # Specifies the `port` that Puma will listen on to receive requests; default is
# 3000. # 3000.
@ -16,8 +17,11 @@ port ENV.fetch('PORT') { 3000 }
# #
environment ENV.fetch('RAILS_ENV') { 'development' } environment ENV.fetch('RAILS_ENV') { 'development' }
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
# Specifies the number of `workers` to boot in clustered mode. # Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together # Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`. # the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support # Workers do not work on JRuby or Windows (both of which do not support
# processes). # processes).
@ -27,31 +31,9 @@ environment ENV.fetch('RAILS_ENV') { 'development' }
# Use the `preload_app!` method when specifying a `workers` number. # Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code # This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write # before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option # process behavior so workers use less memory.
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
# #
# preload_app! # preload_app!
# If you are preloading your application and using Active Record, it's
# recommended that you close any connections to the database before workers
# are forked to prevent connection leakage.
#
# before_fork do
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
# end
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted, this block will be run. If you are using the `preload_app!`
# option, you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, as Ruby
# cannot share connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
#
# Allow puma to be restarted by `rails restart` command. # Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart plugin :tmp_restart

View File

@ -108,4 +108,5 @@ Rails.application.routes.draw do
# # (app/controllers/admin/products_controller.rb) # # (app/controllers/admin/products_controller.rb)
# resources :products # resources :products
# end # end
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end end

View File

@ -2,15 +2,15 @@
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# Note that this schema.rb definition is the authoritative source for your # This file is the source Rails uses to define your schema when running `rails
# database schema. If you need to create the application database on another # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# system, you should be using db:schema:load, not running all the migrations # be faster and is potentially less error prone than running all of your
# from scratch. The latter is a flawed and unsustainable approach (the more migrations # migrations from scratch. Old migrations may fail to apply correctly if those
# you'll amass, the slower it'll run and the greater likelihood for issues). # migrations use external dependencies or application code.
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_05_09_170714) do ActiveRecord::Schema.define(version: 2019_11_08_220522) do
create_table "active_admin_comments", force: :cascade do |t| create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace" t.string "namespace"

View File

@ -4,14 +4,14 @@ require 'test_helper'
class RegionTest < ActiveSupport::TestCase class RegionTest < ActiveSupport::TestCase
test 'proper timezone' do test 'proper timezone' do
assert regions(:region_one).tzid.present? assert regions(:region_one).tzid.present?
assert regions(:region_one).tzid == 'Europe/Paris' assert_equal 'Europe/Paris', regions(:region_one).tzid
end end
test 'check québec timezone is local timezone' do test 'check québec timezone is local timezone' do
assert regions(:region_quebec).tzid == Time.now.zone assert_equal Time.now.zone, regions(:region_quebec).tzid
end end
test 'check other timezone is local timezone' do test 'check other timezone is local timezone' do
assert regions(:region_other).tzid == 'CEST' assert_equal 'CET', regions(:region_other).tzid
end end
end end