Bump rails to 5.2 and update rubocop

This commit is contained in:
John Lees-Miller
2020-05-30 09:40:57 +01:00
parent df28c040d4
commit 80216c6740
78 changed files with 373 additions and 149 deletions

View File

@ -2,6 +2,7 @@ AllCops:
Exclude:
- 'bin/*'
- 'db/schema.rb'
NewCops: enable
Style/ClassAndModuleChildren:
Exclude:
@ -17,6 +18,6 @@ Style/Documentation:
- 'db/**/*'
- 'test/**/*'
Metrics/LineLength:
Layout/LineLength:
Max: 80
IgnoredPatterns: ['\A\s*#']

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) do |repo_name|
@ -6,7 +8,7 @@ git_source(:github) do |repo_name|
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.7'
gem 'rails', '~> 5.2.4.3'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
@ -24,11 +26,11 @@ gem 'jbuilder', '~> 2.5'
gem 'activeadmin'
gem 'devise'
gem 'auto_strip_attributes'
gem 'bootstrap'
gem 'jquery-rails'
gem 'rack-canonical-host'
gem 'recaptcha', require: 'recaptcha/rails'
gem 'auto_strip_attributes'
gem 'scenic'
group :development, :test do

View File

@ -1,60 +1,63 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.1.7)
actionpack (= 5.1.7)
actioncable (5.2.4.3)
actionpack (= 5.2.4.3)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.7)
actionpack (= 5.1.7)
actionview (= 5.1.7)
activejob (= 5.1.7)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.7)
actionview (= 5.1.7)
activesupport (= 5.1.7)
rack (~> 2.0)
actionpack (5.2.4.3)
actionview (= 5.2.4.3)
activesupport (= 5.2.4.3)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.7)
activesupport (= 5.1.7)
actionview (5.2.4.3)
activesupport (= 5.2.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activeadmin (1.2.1)
arbre (>= 1.1.1)
coffee-rails
activeadmin (2.7.0)
arbre (~> 1.2, >= 1.2.1)
formtastic (~> 3.1)
formtastic_i18n
formtastic_i18n (~> 0.4)
inherited_resources (~> 1.7)
jquery-rails (>= 4.2.0)
kaminari (>= 0.15, < 2.0)
railties (>= 4.2, < 5.2)
ransack (~> 1.3)
sass (~> 3.1)
sprockets (< 4.1)
activejob (5.1.7)
activesupport (= 5.1.7)
jquery-rails (~> 4.2)
kaminari (~> 1.0, >= 1.0.1)
railties (>= 5.2, < 6.1)
ransack (~> 2.1, >= 2.1.1)
sassc-rails (~> 2.1)
sprockets (>= 3.0, < 4.1)
activejob (5.2.4.3)
activesupport (= 5.2.4.3)
globalid (>= 0.3.6)
activemodel (5.1.7)
activesupport (= 5.1.7)
activerecord (5.1.7)
activemodel (= 5.1.7)
activesupport (= 5.1.7)
arel (~> 8.0)
activesupport (5.1.7)
activemodel (5.2.4.3)
activesupport (= 5.2.4.3)
activerecord (5.2.4.3)
activemodel (= 5.2.4.3)
activesupport (= 5.2.4.3)
arel (>= 9.0)
activestorage (5.2.4.3)
actionpack (= 5.2.4.3)
activerecord (= 5.2.4.3)
marcel (~> 0.3.1)
activesupport (5.2.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
arbre (1.1.1)
arbre (1.2.1)
activesupport (>= 3.0.0)
arel (8.0.0)
arel (9.0.0)
ast (2.4.0)
auto_strip_attributes (2.4.0)
activerecord (>= 4.0)
@ -77,13 +80,6 @@ GEM
xpath (>= 2.0, < 4.0)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.6)
crass (1.0.6)
devise (4.7.1)
@ -94,26 +90,26 @@ GEM
warden (~> 1.2.3)
erubi (1.9.0)
execjs (2.7.0)
ffi (1.10.0)
ffi (1.12.2)
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic_i18n (0.6.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
has_scope (0.7.1)
actionpack (>= 4.1, < 5.2)
activesupport (>= 4.1, < 5.2)
has_scope (0.7.2)
actionpack (>= 4.1)
activesupport (>= 4.1)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
inherited_resources (1.8.0)
actionpack (>= 4.2, <= 5.2)
inherited_resources (1.11.0)
actionpack (>= 5.0, < 6.1)
has_scope (~> 0.6)
railties (>= 4.2, <= 5.2)
responders
railties (>= 5.0, < 6.1)
responders (>= 2, < 4)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.1)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
@ -139,7 +135,10 @@ GEM
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (1.0.0)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.1)
@ -148,14 +147,13 @@ GEM
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
parallel (1.12.1)
parser (2.5.0.5)
parallel (1.19.1)
parser (2.7.1.3)
ast (~> 2.4.0)
pg (1.0.0)
polyamorous (1.3.3)
activerecord (>= 3.0)
polyamorous (2.3.2)
activerecord (>= 5.2.1)
popper_js (1.14.5)
powerpack (0.1.1)
public_suffix (3.0.2)
puma (3.12.6)
rack (2.2.2)
@ -164,56 +162,60 @@ GEM
rack (>= 1.0.0, < 3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.1.7)
actioncable (= 5.1.7)
actionmailer (= 5.1.7)
actionpack (= 5.1.7)
actionview (= 5.1.7)
activejob (= 5.1.7)
activemodel (= 5.1.7)
activerecord (= 5.1.7)
activesupport (= 5.1.7)
rails (5.2.4.3)
actioncable (= 5.2.4.3)
actionmailer (= 5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
activemodel (= 5.2.4.3)
activerecord (= 5.2.4.3)
activestorage (= 5.2.4.3)
activesupport (= 5.2.4.3)
bundler (>= 1.3.0)
railties (= 5.1.7)
railties (= 5.2.4.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.1.7)
actionpack (= 5.1.7)
activesupport (= 5.1.7)
railties (5.2.4.3)
actionpack (= 5.2.4.3)
activesupport (= 5.2.4.3)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (13.0.1)
ransack (1.8.8)
actionpack (>= 3.0)
activerecord (>= 3.0)
activesupport (>= 3.0)
ransack (2.3.2)
activerecord (>= 5.2.1)
activesupport (>= 5.2.1)
i18n
polyamorous (~> 1.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
polyamorous (= 2.3.2)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
recaptcha (4.7.0)
json
responders (3.0.0)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rubocop (0.54.0)
rexml (3.2.4)
rubocop (0.84.0)
parallel (~> 1.10)
parser (>= 2.5)
powerpack (~> 0.1)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
rexml
rubocop-ast (>= 0.0.3)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.0.3)
parser (>= 2.7.0.1)
ruby-progressbar (1.10.1)
ruby_dep (1.5.0)
rubyzip (1.3.0)
sass (3.7.3)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
@ -258,7 +260,7 @@ GEM
thread_safe (~> 0.1)
uglifier (4.1.8)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.3.0)
unicode-display_width (1.7.0)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.5.1)
@ -266,7 +268,7 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.6.5)
websocket-driver (0.7.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
xpath (3.0.0)
@ -288,7 +290,7 @@ DEPENDENCIES
pg (>= 0.18, < 2.0)
puma (~> 3.12)
rack-canonical-host
rails (~> 5.1.7)
rails (~> 5.2.4.3)
recaptcha
rubocop
sass-rails (~> 5.0)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ActiveAdmin.register AdminUser do
permit_params :email, :password, :password_confirmation

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ActiveAdmin.register Attendee do
scope :child?
scope :diet?

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ActiveAdmin.register_page 'Dashboard' do
menu priority: 1, label: proc { I18n.t('active_admin.dashboard') }

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ActiveAdmin.register Guest do
permit_params :email, :first_name, :last_name, :attending, :diet, :songs,
:notes

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ActiveAdmin.register PlusOne do
permit_params :first_name, :last_name, :diet, :child

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class GuestsController < ApplicationController
def new
respond_to :html

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PlusOnesController < ApplicationController
before_action do
@guest = Guest.find_by_id_token(params[:guest_id])
@ -41,7 +43,7 @@ class PlusOnesController < ApplicationController
def destroy
respond_to :html
@plus_one = @guest.plus_ones.find_by(id: params[:id])
@plus_one.destroy if @plus_one
@plus_one&.destroy
redirect_to guest_plus_ones_path(@guest)
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class WelcomeController < ApplicationController
def index
@google_maps_url = 'https://goo.gl/maps/nBAxNAsmPSS2'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module ApplicationHelper
def flash_class(key)
case key
@ -10,6 +12,7 @@ module ApplicationHelper
def errors_for(object)
return unless object.errors.any?
content_tag(:div, class: 'mb-3 card border-danger') do
concat(content_tag(:div, class: 'card-header bg-danger text-white') do
concat "Oops, #{pluralize(object.errors.count, 'problem')}:"

View File

@ -1,2 +1,4 @@
# frozen_string_literal: true
module GuestsHelper
end

View File

@ -1,2 +1,4 @@
# frozen_string_literal: true
module PlusOnesHelper
end

View File

@ -1,2 +1,4 @@
# frozen_string_literal: true
module WelcomeHelper
end

View File

@ -1,2 +1,4 @@
# frozen_string_literal: true
class ApplicationJob < ActiveJob::Base
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class GuestMailer < ApplicationMailer
default from: ENV['FROM_EMAIL'], reply_to: ENV['CONTACT_EMAIL']

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
#
# ActiveAdmin console user.
#

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
#
# A guest or plus one.
#

View File

@ -1,10 +1,12 @@
# frozen_string_literal: true
#
# Make a model findable only when a secure token is provided.
#
module FindableWithToken
extend ActiveSupport::Concern
ID_TOKEN_RX = /\A(\d+)-(\w+)\z/
ID_TOKEN_RX = /\A(\d+)-(\w+)\z/.freeze
included do
has_secure_token
@ -15,12 +17,14 @@ module FindableWithToken
def self.find_by_id_token(id_token)
raise ActiveRecord::RecordNotFound unless id_token =~ ID_TOKEN_RX
id = Regexp.last_match(1)
token = Regexp.last_match(2)
record = find(id)
raise ActiveRecord::RecordNotFound unless
ActiveSupport::SecurityUtils.secure_compare(record.token, token)
record
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
#
# A primary guest.
#
@ -26,6 +28,7 @@ class Guest < ApplicationRecord
def email_safe_salutation
return 'Hello,' if
first_name.blank? || first_name !~ /\A[\p{Word}\s'-]{1,30}\z/i
"Dear #{first_name},"
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
#
# An extra guest.
#

View File

@ -1,3 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle')

View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'

View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run

View File

@ -1,10 +1,9 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
@ -21,7 +20,6 @@ chdir APP_ROOT do
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'

View File

@ -1,10 +1,9 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
@ -18,6 +17,9 @@ chdir APP_ROOT do
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
puts "\n== Updating database =="
system! 'bin/rails db:migrate'

View File

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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# This file is used by Rack-based servers to start the application.
require_relative 'config/environment'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_relative 'boot'
require 'rails'
@ -5,6 +7,7 @@ require 'rails'
require 'active_model/railtie'
require 'active_job/railtie'
require 'active_record/railtie'
require 'active_storage/engine'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'action_view/railtie'
@ -22,7 +25,8 @@ module Wedding
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.
end
end

View File

@ -1,3 +1,6 @@
# frozen_string_literal: true
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Load the Rails application.
require_relative 'application'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@ -13,12 +15,13 @@ 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.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
@ -26,6 +29,9 @@ 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
@ -37,6 +43,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.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@ -14,10 +16,9 @@ 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.
@ -39,6 +40,9 @@ 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
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
@ -55,6 +59,7 @@ Rails.application.configure do
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "wedding_#{Rails.env}"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
@ -78,7 +83,7 @@ Rails.application.configure do
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = [I18n.default_locale]
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@ -15,7 +17,7 @@ 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.
@ -27,6 +29,10 @@ Rails.application.configure do
# 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.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ActiveAdmin.setup do |config|
# == Site Title
#

View File

@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.

View File

@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.

View File

@ -0,0 +1,26 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.

View File

@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections

View File

@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:

View File

@ -0,0 +1,39 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.2 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Make Active Record use stable #cache_key alongside new #cache_version method.
# This is needed for recyclable cache keys.
# Rails.application.config.active_record.cache_versioning = true
# Use AES-256-GCM authenticated encryption for encrypted cookies.
# Also, embed cookie expiry in signed or encrypted cookies for increased security.
#
# This option is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 5.2.
#
# Existing cookies will be converted on read then written with the new scheme.
# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true
# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages
# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true.
# Rails.application.config.active_support.use_authenticated_message_encryption = true
# Add default protection from forgery to ActionController::Base instead of in
# ApplicationController.
# Rails.application.config.action_controller.default_protect_from_forgery = true
# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and
# 'f' after migrating old data.
# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header.
# Rails.application.config.active_support.use_sha1_digests = true
# Make `form_with` generate id attributes for any generated HTML tags.
# Rails.application.config.action_view.form_with_generates_ids = true

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
@ -15,6 +17,9 @@ 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
# the concurrency of the application would be max `threads` * `workers`.
@ -26,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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
Rails.application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
%w[
.ruby-version
.rbenv-vars

34
config/storage.yml Normal file
View File

@ -0,0 +1,34 @@
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name
# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateGuests < ActiveRecord::Migration[5.1]
def change
create_table :guests do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateActiveAdminComments < ActiveRecord::Migration::Current
def self.up
create_table :active_admin_comments do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddGuestInfo < ActiveRecord::Migration[5.1]
def change
enable_extension('citext')

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreatePlusOnes < ActiveRecord::Migration[5.1]
def change
create_table :plus_ones do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SimplifyDiet < ActiveRecord::Migration[5.1]
def change
change_table :guests do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddGuestNotes < ActiveRecord::Migration[5.1]
def change
change_table :guests do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddFirstNameLastNameToGuest < ActiveRecord::Migration[5.1]
def change
change_table :guests do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddFirstNameLastNameToPlusOne < ActiveRecord::Migration[5.1]
def change
change_table :plus_ones do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddConfirmedAtToGuests < ActiveRecord::Migration[5.1]
def change
change_table :guests do |t|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateAttendees < ActiveRecord::Migration[5.1]
def change
create_view :attendees

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Rack
#
# Set X-Robots-Tag header to ask search engines not to index us.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class GuestsControllerTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class PlusOnesControllerTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class WelcomeControllerTest < ActionDispatch::IntegrationTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class GuestMailerTest < ActionMailer::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Preview all emails at http://localhost:3000/rails/mailers/guest_mailer
class GuestMailerPreview < ActionMailer::Preview
def confirmation_email_attending

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class AdminUserTest < ActiveSupport::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class AttendeeTest < ActiveSupport::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class GuestTest < ActiveSupport::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class PlusOneTest < ActiveSupport::TestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'application_system_test_case'
class RsvpHappyPathTest < ApplicationSystemTestCase

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
require 'rails/test_help'