Skip to content
Extraits de code Groupes Projets
Valider e291f87d rédigé par echarp's avatar echarp
Parcourir les fichiers

Bundle update

parent e36e37c6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -6,10 +6,11 @@ AllCops:
Exclude:
- db/schema.rb
TargetRubyVersion: 2.5
BlockLength:
Metrics/BlockLength:
Exclude:
- app/admin/*.rb
- config/routes.rb
- config/environments/*.rb
Rails/HttpPositionalArguments:
Enabled: false
Style/FrozenStringLiteralComment:
......
......@@ -87,7 +87,7 @@ group :development do
# running in the background. Read more:
# https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'spring-watcher-listen'
# Use Puma as the app server
gem 'puma'
......
......@@ -27,18 +27,17 @@ GEM
rails-html-sanitizer (~> 1.0, >= 1.0.3)
actionview-encoded_mail_to (1.0.9)
rails
activeadmin (2.4.0)
activeadmin (2.6.0)
arbre (~> 1.2, >= 1.2.1)
formtastic (~> 3.1)
formtastic_i18n (~> 0.4)
inherited_resources (~> 1.7)
jquery-rails (~> 4.2)
kaminari (~> 1.0, >= 1.0.1)
railties (>= 5.0, < 6.1)
railties (>= 5.2, < 6.1)
ransack (~> 2.1, >= 2.1.1)
sassc-rails (~> 2.1)
sprockets (>= 3.0, < 4.1)
sprockets-es6 (~> 0.9, >= 0.9.2)
activejob (5.2.3)
activesupport (= 5.2.3)
globalid (>= 0.3.6)
......@@ -65,15 +64,11 @@ GEM
activesupport (>= 3.0.0)
arel (9.0.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)
bindex (0.8.1)
brakeman (4.7.1)
brakeman (4.7.2)
buftok (0.2.0)
builder (3.2.3)
builder (3.2.4)
bundler-audit (0.6.1)
bundler (>= 1.2.0, < 3)
thor (~> 0.18)
......@@ -94,8 +89,8 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.8.2)
devise (>= 4.6)
devise-i18n (1.9.0)
devise (>= 4.7.1)
differ (0.1.2)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
......@@ -109,10 +104,10 @@ GEM
erubis (2.7.0)
eventmachine (1.2.7)
execjs (2.7.0)
ffi (1.11.1)
ffi (1.11.3)
flag-icons-rails (3.1.0)
sass (~> 3.2)
font-awesome-sass (5.11.2)
font-awesome-sass (5.12.0)
sassc (>= 1.11)
formatador (0.2.5)
formtastic (3.1.5)
......@@ -166,7 +161,7 @@ GEM
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 5.1)
haml_lint (0.34.0)
haml_lint (0.34.1)
haml (>= 4.0, < 5.2)
rainbow
rubocop (>= 0.50.0)
......@@ -208,7 +203,7 @@ GEM
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
icalendar (2.5.3)
icalendar (2.6.1)
ice_cube (~> 0.16)
ice_cube (0.16.3)
inherited_resources (1.11.0)
......@@ -243,7 +238,7 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.3.1)
loofah (2.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.13)
......@@ -263,11 +258,11 @@ GEM
modernizr-rails (2.7.1)
multi_json (1.14.1)
multipart-post (2.1.1)
mysql2 (0.5.2)
mysql2 (0.5.3)
naught (1.1.0)
nenv (0.3.0)
nio4r (2.5.2)
nokogiri (1.10.5)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
notiffany (0.1.3)
nenv (~> 0.1)
......@@ -276,7 +271,7 @@ GEM
paper_trail (10.3.1)
activerecord (>= 4.2)
request_store (~> 1.1)
parallel (1.18.0)
parallel (1.19.1)
parser (2.6.5.0)
ast (~> 2.4.0)
piwik_analytics (1.0.2)
......@@ -291,9 +286,9 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (4.0.1)
puma (4.3.0)
puma (4.3.1)
nio4r (~> 2.0)
rack (2.0.7)
rack (2.0.8)
rack-livereload (0.3.17)
rack
rack-test (1.1.0)
......@@ -338,7 +333,7 @@ GEM
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (13.0.0)
rake (13.0.1)
ransack (2.3.0)
actionpack (>= 5.0)
activerecord (>= 5.0)
......@@ -350,21 +345,21 @@ GEM
ffi (~> 1.0)
rdoc (6.2.0)
ref (2.0.0)
request_store (1.4.1)
request_store (1.5.0)
rack (>= 1.4)
responders (3.0.0)
actionpack (>= 5.0)
railties (>= 5.0)
rubocop (0.76.0)
rubocop (0.78.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 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-rails (2.3.2)
rubocop-rails (2.4.0)
rack (>= 1.1)
rubocop (>= 0.72.0)
ruby-progressbar (1.10.1)
......@@ -398,15 +393,11 @@ GEM
sprockets (4.0.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-es6 (0.9.2)
babel-source (>= 5.8.11)
babel-transpiler
sprockets (>= 3.0.0)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.4.1)
sqlite3 (1.4.2)
strip_attributes (1.9.0)
activemodel (>= 3.0, < 7.0)
sysexits (1.2.0)
......@@ -421,7 +412,7 @@ GEM
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.10)
tinymce-rails (5.1.1)
tinymce-rails (5.1.4)
railties (>= 3.1.1)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
......@@ -518,7 +509,7 @@ DEPENDENCIES
sdoc
simple_calendar
spring
spring-watcher-listen (~> 2.0.0)
spring-watcher-listen
sqlite3
strip_attributes
tagsinput-rails
......
......@@ -42,6 +42,7 @@ class Event < ApplicationRecord
after_destroy EventCallbacks
default_scope { includes(:taggings, :region) }
scope :moderated, ->(*) { where moderated: true }
scope :unmoderated, ->(*) { where moderated: false }
scope :past, -> { where 'start_time <= ?', Time.zone.now }
......
......@@ -6,8 +6,8 @@ class Region < ApplicationRecord
has_many :orgas, dependent: :destroy
default_scope { order :name }
scope :top, ->(*) { where(region: nil).includes(:regions).reorder :code }
scope :local, ->(*) { where(url: nil).or(Region.where(url: '')) }
scope :top, -> { where(region: nil).includes(:regions).reorder :code }
scope :local, -> { where(url: [nil, '']) }
scope :region, (lambda do |region|
return if region.nil? || region == 'all' || region.to_i.zero?
......
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../', __dir__)
APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
Dir.chdir APP_ROOT do
# This script is a starting point to setup your application.
FileUtils.chdir APP_ROOT do
# 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.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# Install JavaScript dependencies if using Yarn
# Install JavaScript dependencies
# system('bin/yarn')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
......
#!/usr/bin/env ruby
VENDOR_PATH = File.expand_path('..', __dir__)
Dir.chdir(VENDOR_PATH) do
exec "yarnpkg #{ARGV.join(' ')}"
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
exec 'yarnpkg', *ARGV
rescue Errno::ENOENT
warn 'Yarn executable was not detected in the system.'
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
......
require File.expand_path('boot', __dir__)
require_relative 'boot'
require 'rails/all'
require 'action_view/encoded_mail_to/mail_to_with_encoding'
......@@ -12,10 +12,12 @@ module AgendaDuLibreRails
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
# Settings in config/environments/* take precedence over those specified
# here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Application configuration can go into files in config/initializers
# -- 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
# auto-convert to this zone.
......@@ -28,7 +30,7 @@ module AgendaDuLibreRails
# config.i18n.load_path +=
# Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
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 = :fr
config.i18n.available_locales = %i[de en fr nl pt-BR]
......
......@@ -2,9 +2,9 @@ development:
adapter: async
test:
adapter: async
adapter: test
production:
adapter: redis
url: redis://localhost:6379/1
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: agenda_du_libre_rails_production
......@@ -14,12 +14,14 @@ Rails.application.configure do
config.consider_all_requests_local = true
# 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.enable_fragment_cache_logging = true
config.cache_store = :memory_store
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
config.action_controller.perform_caching = false
......@@ -27,8 +29,13 @@ Rails.application.configure do
config.cache_store = :null_store
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.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.smtp_settings = { openssl_verify_mode: 'none' }
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.
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.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
......@@ -46,7 +56,7 @@ Rails.application.configure do
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
# To have assets Local Precompilation, we need to use another path in dev
......
......@@ -15,25 +15,22 @@ Rails.application.configure do
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
# `config/secrets.yml.key`.
config.read_encrypted_secrets = true
# Ensures that a master key has been made available in either
# ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other
# encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
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.
# 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-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.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com',
......@@ -62,9 +63,10 @@ Rails.application.configure do
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per
# environment)
# environment).
# 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
# 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.
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
# 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
# Settings specified here will take precedence over those in
# 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
# 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.
config.public_file_server.enabled = true
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.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
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
# 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.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
end
# 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:
date:
formats:
......
......@@ -4,8 +4,9 @@
# 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.
#
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
threads threads_count, threads_count
max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
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
# 3000.
......@@ -16,8 +17,11 @@ port ENV.fetch('PORT') { 3000 }
#
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.
# 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`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
......@@ -27,31 +31,9 @@ environment ENV.fetch('RAILS_ENV') { 'development' }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
# process behavior so workers use less memory.
#
# 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.
plugin :tmp_restart
......@@ -108,4 +108,5 @@ Rails.application.routes.draw do
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
......@@ -2,15 +2,15 @@
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# 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|
t.string "namespace"
......
......@@ -4,14 +4,14 @@ require 'test_helper'
class RegionTest < ActiveSupport::TestCase
test 'proper timezone' do
assert regions(:region_one).tzid.present?
assert regions(:region_one).tzid == 'Europe/Paris'
assert_equal 'Europe/Paris', regions(:region_one).tzid
end
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
test 'check other timezone is local timezone' do
assert regions(:region_other).tzid == 'CEST'
assert_equal 'CET', regions(:region_other).tzid
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter