@@ -0,0 +1,64 @@ | |||
AllCops: | |||
Exclude: | |||
- 'bin/**/*' | |||
- 'config/environments/**/*' | |||
- 'db/migrate/**/*' | |||
- 'node_modules/**/*' | |||
Style/Documentation: | |||
Enabled: false | |||
Layout/SpaceBeforeBrackets: # (new in 1.7) | |||
Enabled: true | |||
Lint/AmbiguousAssignment: # (new in 1.7) | |||
Enabled: true | |||
Lint/DuplicateBranch: # (new in 1.3) | |||
Enabled: true | |||
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1) | |||
Enabled: true | |||
Lint/EmptyBlock: # (new in 1.1) | |||
Enabled: true | |||
Lint/EmptyClass: # (new in 1.3) | |||
Enabled: true | |||
Lint/NoReturnInBeginEndBlocks: # (new in 1.2) | |||
Enabled: true | |||
Lint/ToEnumArguments: # (new in 1.1) | |||
Enabled: true | |||
Lint/UnexpectedBlockArity: # (new in 1.5) | |||
Enabled: true | |||
Lint/UnmodifiedReduceAccumulator: # (new in 1.1) | |||
Enabled: true | |||
Style/ArgumentsForwarding: # (new in 1.1) | |||
Enabled: true | |||
Style/CollectionCompact: # (new in 1.2) | |||
Enabled: true | |||
Style/DocumentDynamicEvalDefinition: # (new in 1.1) | |||
Enabled: true | |||
Style/HashExcept: # (new in 1.7) | |||
Enabled: true | |||
Style/NegatedIfElseCondition: # (new in 1.2) | |||
Enabled: true | |||
Style/NilLambda: # (new in 1.3) | |||
Enabled: true | |||
Style/RedundantArgument: # (new in 1.4) | |||
Enabled: true | |||
Style/SwapValues: # (new in 1.1) | |||
Enabled: true | |||
@@ -1,3 +1,5 @@ | |||
# frozen_string_literal: true | |||
source 'https://rubygems.org' | |||
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |||
@@ -30,7 +32,11 @@ gem 'bootsnap', '>= 1.4.4', require: false | |||
group :development, :test do | |||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console | |||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] | |||
gem 'byebug', platforms: %i[mri mingw x64_mingw] | |||
gem 'rubocop', '~> 1.7' | |||
gem 'rubocop-performance', '~> 1.9' | |||
gem 'rubocop-rails', '~> 2.9' | |||
end | |||
group :development do | |||
@@ -38,8 +44,8 @@ group :development do | |||
gem 'web-console', '>= 4.1.0' | |||
# Display performance information such as SQL time and flame graphs for each request in your browser. | |||
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md | |||
gem 'rack-mini-profiler', '~> 2.0' | |||
gem 'listen', '~> 3.3' | |||
gem 'rack-mini-profiler', '~> 2.0' | |||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | |||
gem 'spring' | |||
end | |||
@@ -52,9 +58,7 @@ group :test do | |||
gem 'webdrivers' | |||
end | |||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem | |||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] | |||
gem "turbo-rails", "~> 0.5.1" | |||
gem 'devise', '~> 4.7' | |||
gem "devise", "~> 4.7" | |||
gem 'rotp', '~> 6.2' | |||
gem 'turbo-rails', '~> 0.5.1' |
@@ -62,6 +62,7 @@ GEM | |||
zeitwerk (~> 2.3) | |||
addressable (2.7.0) | |||
public_suffix (>= 2.0.2, < 5.0) | |||
ast (2.4.1) | |||
bcrypt (3.1.16) | |||
bindex (0.8.1) | |||
bootsnap (1.5.1) | |||
@@ -113,6 +114,9 @@ GEM | |||
nokogiri (1.10.10) | |||
mini_portile2 (~> 2.4.0) | |||
orm_adapter (0.5.0) | |||
parallel (1.20.1) | |||
parser (3.0.0.0) | |||
ast (~> 2.4.1) | |||
pg (1.2.3) | |||
public_suffix (4.0.6) | |||
puma (5.1.1) | |||
@@ -150,6 +154,7 @@ GEM | |||
method_source | |||
rake (>= 0.8.7) | |||
thor (~> 1.0) | |||
rainbow (3.0.0) | |||
rake (13.0.3) | |||
rb-fsevent (0.10.4) | |||
rb-inotify (0.10.1) | |||
@@ -158,6 +163,27 @@ GEM | |||
responders (3.0.1) | |||
actionpack (>= 5.0) | |||
railties (>= 5.0) | |||
rexml (3.2.4) | |||
rotp (6.2.0) | |||
rubocop (1.7.0) | |||
parallel (~> 1.10) | |||
parser (>= 2.7.1.5) | |||
rainbow (>= 2.2.2, < 4.0) | |||
regexp_parser (>= 1.8, < 3.0) | |||
rexml | |||
rubocop-ast (>= 1.2.0, < 2.0) | |||
ruby-progressbar (~> 1.7) | |||
unicode-display_width (>= 1.4.0, < 2.0) | |||
rubocop-ast (1.3.0) | |||
parser (>= 2.7.1.5) | |||
rubocop-performance (1.9.1) | |||
rubocop (>= 0.90.0, < 2.0) | |||
rubocop-ast (>= 0.4.0) | |||
rubocop-rails (2.9.1) | |||
activesupport (>= 4.2.0) | |||
rack (>= 1.1) | |||
rubocop (>= 0.90.0, < 2.0) | |||
ruby-progressbar (1.10.1) | |||
rubyzip (2.3.0) | |||
sass-rails (6.0.0) | |||
sassc-rails (~> 2.1, >= 2.1.1) | |||
@@ -187,6 +213,7 @@ GEM | |||
rails (>= 6.0.0) | |||
tzinfo (2.0.4) | |||
concurrent-ruby (~> 1.0) | |||
unicode-display_width (1.7.0) | |||
warden (1.2.9) | |||
rack (>= 2.0.9) | |||
web-console (4.1.0) | |||
@@ -224,11 +251,14 @@ DEPENDENCIES | |||
puma (~> 5.0) | |||
rack-mini-profiler (~> 2.0) | |||
rails (~> 6.1.0) | |||
rotp (~> 6.2) | |||
rubocop (~> 1.7) | |||
rubocop-performance (~> 1.9) | |||
rubocop-rails (~> 2.9) | |||
sass-rails (>= 6) | |||
selenium-webdriver | |||
spring | |||
turbo-rails (~> 0.5.1) | |||
tzinfo-data | |||
web-console (>= 4.1.0) | |||
webdrivers | |||
webpacker (~> 5.0) |
@@ -1,6 +1,8 @@ | |||
# 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. | |||
require_relative "config/application" | |||
require_relative 'config/application' | |||
Rails.application.load_tasks |
@@ -0,0 +1,3 @@ | |||
// Place all the styles related to the Intro controller here. | |||
// They will automatically be included in application.css. | |||
// You can use Sass (SCSS) here: https://sass-lang.com/ |
@@ -1,3 +1,5 @@ | |||
# frozen_string_literal: true | |||
module ApplicationCable | |||
class Channel < ActionCable::Channel::Base | |||
end |
@@ -1,3 +1,5 @@ | |||
# frozen_string_literal: true | |||
module ApplicationCable | |||
class Connection < ActionCable::Connection::Base | |||
end |
@@ -1,2 +1,4 @@ | |||
# frozen_string_literal: true | |||
class ApplicationController < ActionController::Base | |||
end |
@@ -0,0 +1,5 @@ | |||
# frozen_string_literal: true | |||
class IntroController < ApplicationController | |||
def index; end | |||
end |
@@ -1,2 +1,4 @@ | |||
# frozen_string_literal: true | |||
module ApplicationHelper | |||
end |
@@ -0,0 +1,4 @@ | |||
# frozen_string_literal: true | |||
module IntroHelper | |||
end |
@@ -1,3 +1,5 @@ | |||
# frozen_string_literal: true | |||
class ApplicationJob < ActiveJob::Base | |||
# Automatically retry jobs that encountered a deadlock | |||
# retry_on ActiveRecord::Deadlocked |
@@ -1,3 +1,5 @@ | |||
# frozen_string_literal: true | |||
class ApplicationMailer < ActionMailer::Base | |||
default from: 'from@example.com' | |||
layout 'mailer' |
@@ -1,3 +1,5 @@ | |||
# frozen_string_literal: true | |||
class ApplicationRecord < ActiveRecord::Base | |||
self.abstract_class = true | |||
end |
@@ -1,7 +1,48 @@ | |||
# frozen_string_literal: true | |||
class User < ApplicationRecord | |||
# Include default devise modules. Others available are: | |||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable | |||
devise :database_authenticatable, :registerable, | |||
:recoverable, :rememberable, :validatable, | |||
:confirmable | |||
devise :database_authenticatable, :validatable, :registerable, | |||
:recoverable, :rememberable, :confirmable | |||
validates :otp_secret, presence: true, uniqueness: true | |||
before_validation do | |||
self.otp_secret ||= ROTP::Base32.random | |||
end | |||
def totp | |||
@totp ||= ROTP::TOTP.new(otp_secret, issuer: 'Fabricut Company SMS') | |||
end | |||
def verify_otp(token) | |||
last_otp_at = totp.verify(token, after: self.last_otp_at) | |||
return nil unless last_otp_at | |||
update last_otp_at: last_otp_at | |||
last_otp_at | |||
end | |||
def provisioning_uri | |||
uri = totp.provisioning_uri(email) | |||
# Work around https://github.com/mdp/rotp/issues/98: | |||
uri.gsub('%2520', '%20') | |||
end | |||
def qrcode | |||
RQRCode::QRCode.new(provisioning_uri) | |||
end | |||
def puts_qrcode | |||
if ENV['TERM_PROGRAM'] == 'iTerm.app' | |||
png = qrcode.as_png(color: 'white', fill: 'black') | |||
base64 = Base64.encode64(png.to_s) | |||
puts "\x1B]1337;File=inline=1:#{base64}\x07" | |||
else | |||
puts qrcode.as_ansi | |||
end | |||
puts otp_secret | |||
end | |||
end |
@@ -0,0 +1 @@ | |||
<h1>This is the damn intro page</h1> |
@@ -8,46 +8,46 @@ | |||
# this file is here to facilitate running it. | |||
# | |||
require "rubygems" | |||
require 'rubygems' | |||
m = Module.new do | |||
module_function | |||
def invoked_as_script? | |||
File.expand_path($0) == File.expand_path(__FILE__) | |||
File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__) | |||
end | |||
def env_var_version | |||
ENV["BUNDLER_VERSION"] | |||
ENV['BUNDLER_VERSION'] | |||
end | |||
def cli_arg_version | |||
return unless invoked_as_script? # don't want to hijack other binstubs | |||
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` | |||
return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update` | |||
bundler_version = nil | |||
update_index = nil | |||
ARGV.each_with_index do |a, i| | |||
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN | |||
bundler_version = a | |||
end | |||
bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN | |||
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ | |||
bundler_version = $1 | |||
bundler_version = Regexp.last_match(1) | |||
update_index = i | |||
end | |||
bundler_version | |||
end | |||
def gemfile | |||
gemfile = ENV["BUNDLE_GEMFILE"] | |||
gemfile = ENV['BUNDLE_GEMFILE'] | |||
return gemfile if gemfile && !gemfile.empty? | |||
File.expand_path("../../Gemfile", __FILE__) | |||
File.expand_path('../Gemfile', __dir__) | |||
end | |||
def lockfile | |||
lockfile = | |||
case File.basename(gemfile) | |||
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) | |||
when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile) | |||
else "#{gemfile}.lock" | |||
end | |||
File.expand_path(lockfile) | |||
@@ -55,15 +55,17 @@ m = Module.new do | |||
def lockfile_version | |||
return unless File.file?(lockfile) | |||
lockfile_contents = File.read(lockfile) | |||
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ | |||
Regexp.last_match(1) | |||
end | |||
def bundler_version | |||
@bundler_version ||= | |||
env_var_version || cli_arg_version || | |||
lockfile_version | |||
lockfile_version | |||
end | |||
def bundler_requirement | |||
@@ -73,28 +75,32 @@ m = Module.new do | |||
requirement = bundler_gem_version.approximate_recommendation | |||
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") | |||
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.7.0') | |||
requirement += ".a" if bundler_gem_version.prerelease? | |||
requirement += '.a' if bundler_gem_version.prerelease? | |||
requirement | |||
end | |||
def load_bundler! | |||
ENV["BUNDLE_GEMFILE"] ||= gemfile | |||
ENV['BUNDLE_GEMFILE'] ||= gemfile | |||
activate_bundler | |||
end | |||
def activate_bundler | |||
gem_error = activation_error_handling do | |||
gem "bundler", bundler_requirement | |||
gem 'bundler', bundler_requirement | |||
end | |||
return if gem_error.nil? | |||
require_error = activation_error_handling do | |||
require "bundler/version" | |||
require 'bundler/version' | |||
end | |||
if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) | |||
return | |||
end | |||
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) | |||
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" | |||
exit 42 | |||
end | |||
@@ -109,6 +115,4 @@ end | |||
m.load_bundler! | |||
if m.invoked_as_script? | |||
load Gem.bin_path("bundler", "bundle") | |||
end | |||
load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script? |
@@ -1,5 +1,7 @@ | |||
#!/usr/bin/env ruby | |||
load File.expand_path("spring", __dir__) | |||
# frozen_string_literal: true | |||
load File.expand_path('spring', __dir__) | |||
APP_PATH = File.expand_path('../config/application', __dir__) | |||
require_relative "../config/boot" | |||
require "rails/commands" | |||
require_relative '../config/boot' | |||
require 'rails/commands' |
@@ -1,5 +1,7 @@ | |||
#!/usr/bin/env ruby | |||
load File.expand_path("spring", __dir__) | |||
require_relative "../config/boot" | |||
require "rake" | |||
# frozen_string_literal: true | |||
load File.expand_path('spring', __dir__) | |||
require_relative '../config/boot' | |||
require 'rake' | |||
Rake.application.run |
@@ -1,5 +1,7 @@ | |||
#!/usr/bin/env ruby | |||
require "fileutils" | |||
# frozen_string_literal: true | |||
require 'fileutils' | |||
# path to your application root. | |||
APP_ROOT = File.expand_path('..', __dir__) |
@@ -1,10 +1,12 @@ | |||
#!/usr/bin/env ruby | |||
if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) | |||
# frozen_string_literal: true | |||
if !defined?(Spring) && [nil, 'development', 'test'].include?(ENV['RAILS_ENV']) | |||
# Load Spring without loading other gems in the Gemfile, for speed. | |||
require "bundler" | |||
Bundler.locked_gems.specs.find { |spec| spec.name == "spring" }&.tap do |spring| | |||
require 'bundler' | |||
Bundler.locked_gems.specs.find { |spec| spec.name == 'spring' }&.tap do |spring| | |||
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path | |||
gem "spring", spring.version | |||
require "spring/binstub" | |||
gem 'spring', spring.version | |||
require 'spring/binstub' | |||
end | |||
end |
@@ -1,18 +1,19 @@ | |||
#!/usr/bin/env ruby | |||
# frozen_string_literal: true | |||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" | |||
ENV["NODE_ENV"] ||= "development" | |||
ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] || 'development' | |||
ENV['NODE_ENV'] ||= 'development' | |||
require "pathname" | |||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", | |||
Pathname.new(__FILE__).realpath) | |||
require 'pathname' | |||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', | |||
Pathname.new(__FILE__).realpath) | |||
require "bundler/setup" | |||
require 'bundler/setup' | |||
require "webpacker" | |||
require "webpacker/webpack_runner" | |||
require 'webpacker' | |||
require 'webpacker/webpack_runner' | |||
APP_ROOT = File.expand_path("..", __dir__) | |||
APP_ROOT = File.expand_path('..', __dir__) | |||
Dir.chdir(APP_ROOT) do | |||
Webpacker::WebpackRunner.run(ARGV) | |||
end |
@@ -1,18 +1,19 @@ | |||
#!/usr/bin/env ruby | |||
# frozen_string_literal: true | |||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" | |||
ENV["NODE_ENV"] ||= "development" | |||
ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] || 'development' | |||
ENV['NODE_ENV'] ||= 'development' | |||
require "pathname" | |||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", | |||
Pathname.new(__FILE__).realpath) | |||
require 'pathname' | |||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', | |||
Pathname.new(__FILE__).realpath) | |||
require "bundler/setup" | |||
require 'bundler/setup' | |||
require "webpacker" | |||
require "webpacker/dev_server_runner" | |||
require 'webpacker' | |||
require 'webpacker/dev_server_runner' | |||
APP_ROOT = File.expand_path("..", __dir__) | |||
APP_ROOT = File.expand_path('..', __dir__) | |||
Dir.chdir(APP_ROOT) do | |||
Webpacker::DevServerRunner.run(ARGV) | |||
end |
@@ -1,9 +1,11 @@ | |||
#!/usr/bin/env ruby | |||
# frozen_string_literal: true | |||
require 'pathname' | |||
APP_ROOT = File.expand_path('..', __dir__) | |||
Dir.chdir(APP_ROOT) do | |||
executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path| | |||
executable_path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |path| | |||
normalized_path = File.expand_path(path) | |||
normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn')) | |||
@@ -12,8 +14,8 @@ Dir.chdir(APP_ROOT) do | |||
if executable_path | |||
exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV | |||
else | |||
$stderr.puts "Yarn executable was not detected in the system." | |||
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" | |||
warn 'Yarn executable was not detected in the system.' | |||
warn 'Download Yarn at https://yarnpkg.com/en/docs/install' | |||
exit 1 | |||
end | |||
end |
@@ -1,6 +1,8 @@ | |||
# frozen_string_literal: true | |||
# This file is used by Rack-based servers to start the application. | |||
require_relative "config/environment" | |||
require_relative 'config/environment' | |||
run Rails.application | |||
Rails.application.load_server |
@@ -1,6 +1,8 @@ | |||
require_relative "boot" | |||
# frozen_string_literal: true | |||
require "rails/all" | |||
require_relative 'boot' | |||
require 'rails/all' | |||
# Require the gems listed in Gemfile, including any gems | |||
# you've limited to :test, :development, or :production. |
@@ -1,4 +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. | |||
require 'bundler/setup' # Set up gems listed in the Gemfile. | |||
require 'bootsnap/setup' # Speed up boot time by caching expensive operations. |
@@ -1,5 +1,7 @@ | |||
# frozen_string_literal: true | |||
# Load the Rails application. | |||
require_relative "application" | |||
require_relative 'application' | |||
# Initialize the Rails application. | |||
Rails.application.initialize! |
@@ -1,4 +1,6 @@ | |||
require "active_support/core_ext/integer/time" | |||
# frozen_string_literal: true | |||
require 'active_support/core_ext/integer/time' | |||
Rails.application.configure do | |||
# Settings specified here will take precedence over those in config/application.rb. |
@@ -1,4 +1,6 @@ | |||
require "active_support/core_ext/integer/time" | |||
# frozen_string_literal: true | |||
require 'active_support/core_ext/integer/time' | |||
Rails.application.configure do | |||
# Settings specified here will take precedence over those in config/application.rb. | |||
@@ -53,7 +55,7 @@ Rails.application.configure do | |||
config.log_level = :info | |||
# Prepend all log lines with the following tags. | |||
config.log_tags = [ :request_id ] | |||
config.log_tags = [:request_id] | |||
# Use a different cache store in production. | |||
# config.cache_store = :mem_cache_store | |||
@@ -88,8 +90,8 @@ Rails.application.configure do | |||
# require "syslog/logger" | |||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') | |||
if ENV["RAILS_LOG_TO_STDOUT"].present? | |||
logger = ActiveSupport::Logger.new(STDOUT) | |||
if ENV['RAILS_LOG_TO_STDOUT'].present? | |||
logger = ActiveSupport::Logger.new($stdout) | |||
logger.formatter = config.log_formatter | |||
config.logger = ActiveSupport::TaggedLogging.new(logger) | |||
end |
@@ -1,4 +1,6 @@ | |||
require "active_support/core_ext/integer/time" | |||
# frozen_string_literal: true | |||
require 'active_support/core_ext/integer/time' | |||
# The test environment is used exclusively to run your application's | |||
# test suite. You never need to work with it otherwise. Remember that |
@@ -1,3 +1,4 @@ | |||
# frozen_string_literal: true | |||
# Be sure to restart your server when you modify this file. | |||
# ActiveSupport::Reloader.to_prepare do |
@@ -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. |
@@ -1,3 +1,5 @@ | |||
# 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. | |||
@@ -5,4 +7,4 @@ | |||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code | |||
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". | |||
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] | |||
Rails.backtrace_cleaner.remove_silencers! if ENV['BACKTRACE'] |
@@ -1,3 +1,4 @@ | |||
# frozen_string_literal: true | |||
# Be sure to restart your server when you modify this file. | |||
# Define an application-wide content security policy |
@@ -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. |
@@ -9,13 +9,6 @@ | |||
# Use this hook to configure devise mailer, warden hooks and so forth. | |||
# Many of these configuration options can be set straight in your model. | |||
Devise.setup do |config| | |||
# The secret key used by Devise. Devise uses this key to generate | |||
# random tokens. Changing this key will render invalid all existing | |||
# confirmation, reset password and unlock tokens in the database. | |||
# Devise will use the `secret_key_base` as its `secret_key` | |||
# by default. You can change it below and use your own secret key. | |||
# config.secret_key = 'f85cd70210b82d4b5295aa4d9fa9f81b273b71a91a37f97371179706b38f058ab83b1d2f665254c78031f61e183c733e132632772f3a6cc46c0a8c08df5c517d' | |||
# ==> Controller configuration | |||
# Configure the parent class to the devise controllers. | |||
# config.parent_controller = 'DeviseController' | |||
@@ -24,7 +17,7 @@ Devise.setup do |config| | |||
# Configure the e-mail address which will be shown in Devise::Mailer, | |||
# note that it will be overwritten if you use your own mailer class | |||
# with default "from" parameter. | |||
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' | |||
config.mailer_sender = 'no-reply@supertextadventure.com' | |||
# Configure the class responsible to send e-mails. | |||
# config.mailer = 'Devise::Mailer' | |||
@@ -125,9 +118,6 @@ Devise.setup do |config| | |||
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). | |||
config.stretches = Rails.env.test? ? 1 : 12 | |||
# Set up a pepper to generate the hashed password. | |||
# config.pepper = '7ccca6e5f75ea4f62a5bc0ada18fed1f6e9a6ecd9cd25e7199782a5a059d7493f5adb2bfead4a39c80a249c0721fb8e1a1691ba44a68b6bd787d09623bbf9e92' | |||
# Send a notification to the original email when the user's email is changed. | |||
# config.send_email_changed_notification = false | |||
@@ -1,6 +1,8 @@ | |||
# 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. | |||
Rails.application.config.filter_parameters += [ | |||
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn | |||
Rails.application.config.filter_parameters += %i[ | |||
passw secret token _key crypt salt certificate otp ssn | |||
] |
@@ -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 |
@@ -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: |
@@ -1,3 +1,4 @@ | |||
# frozen_string_literal: true | |||
# Define an application-wide HTTP permissions policy. For further | |||
# information see https://developers.google.com/web/updates/2018/06/feature-policy | |||
# |
@@ -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 |
@@ -1,28 +1,30 @@ | |||
# 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 | |||
# 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. | |||
# | |||
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } | |||
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_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 `worker_timeout` threshold that Puma will use to wait before | |||
# terminating a worker in development environments. | |||
# | |||
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" | |||
worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development' | |||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000. | |||
# | |||
port ENV.fetch("PORT") { 3000 } | |||
port ENV.fetch('PORT', 3000) | |||
# Specifies the `environment` that Puma will run in. | |||
# | |||
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" } | |||
pidfile ENV.fetch('PIDFILE', 'tmp/pids/server.pid') | |||
# Specifies the number of `workers` to boot in clustered mode. | |||
# Workers are forked web server processes. If using threads and workers together |
@@ -1,5 +1,7 @@ | |||
# frozen_string_literal: true | |||
Rails.application.routes.draw do | |||
devise_for :users | |||
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html | |||
root to: "home#index" | |||
root to: 'home#index' | |||
end |
@@ -1,6 +1,8 @@ | |||
# frozen_string_literal: true | |||
Spring.watch( | |||
".ruby-version", | |||
".rbenv-vars", | |||
"tmp/restart.txt", | |||
"tmp/caching-dev.txt" | |||
'.ruby-version', | |||
'.rbenv-vars', | |||
'tmp/restart.txt', | |||
'tmp/caching-dev.txt' | |||
) |
@@ -3,43 +3,21 @@ | |||
class DeviseCreateUsers < ActiveRecord::Migration[6.1] | |||
def change | |||
create_table :users do |t| | |||
## Database authenticatable | |||
t.string :email, null: false, default: "" | |||
t.string :encrypted_password, null: false, default: "" | |||
t.string :email, null: false, default: '' | |||
t.string :encrypted_password, null: false, default: '' | |||
t.string :name, null: false | |||
## Recoverable | |||
t.string :reset_password_token | |||
t.datetime :reset_password_sent_at | |||
## Rememberable | |||
t.datetime :remember_created_at | |||
## Trackable | |||
# t.integer :sign_in_count, default: 0, null: false | |||
# t.datetime :current_sign_in_at | |||
# t.datetime :last_sign_in_at | |||
# t.string :current_sign_in_ip | |||
# t.string :last_sign_in_ip | |||
## Confirmable | |||
t.string :confirmation_token | |||
t.datetime :confirmed_at | |||
t.datetime :confirmation_sent_at | |||
t.string :unconfirmed_email # Only if using reconfirmable | |||
## Lockable | |||
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts | |||
# t.string :unlock_token # Only if unlock strategy is :email or :both | |||
# t.datetime :locked_at | |||
t.timestamps null: false | |||
t.string :otp_secret, null: false, index: { unique: true } | |||
t.integer :last_otp_at | |||
end | |||
add_index :users, :email, unique: true | |||
add_index :users, :email, unique: true | |||
add_index :users, :reset_password_token, unique: true | |||
add_index :users, :confirmation_token, unique: true | |||
# add_index :users, :unlock_token, unique: true | |||
add_index :users, :confirmation_token, unique: true | |||
end | |||
end |
@@ -1,3 +1,5 @@ | |||
# frozen_string_literal: true | |||
# This file is auto-generated from the current state of the database. Instead | |||
# of editing this file, please use the migrations feature of Active Record to | |||
# incrementally modify your database, and then regenerate this schema definition. | |||
@@ -10,27 +12,25 @@ | |||
# | |||
# It's strongly recommended that you check this file into your version control system. | |||
ActiveRecord::Schema.define(version: 2020_12_27_192726) do | |||
ActiveRecord::Schema.define(version: 20_201_227_192_726) do | |||
# These are extensions that must be enabled in order to support this database | |||
enable_extension "plpgsql" | |||
enable_extension 'plpgsql' | |||
create_table "users", force: :cascade do |t| | |||
t.string "email", default: "", null: false | |||
t.string "encrypted_password", default: "", null: false | |||
t.string "name", null: false | |||
t.string "reset_password_token" | |||
t.datetime "reset_password_sent_at" | |||
t.datetime "remember_created_at" | |||
t.string "confirmation_token" | |||
t.datetime "confirmed_at" | |||
t.datetime "confirmation_sent_at" | |||
t.string "unconfirmed_email" | |||
t.datetime "created_at", precision: 6, null: false | |||
t.datetime "updated_at", precision: 6, null: false | |||
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true | |||
t.index ["email"], name: "index_users_on_email", unique: true | |||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true | |||
create_table 'users', force: :cascade do |t| | |||
t.string 'email', default: '', null: false | |||
t.string 'encrypted_password', default: '', null: false | |||
t.string 'name', null: false | |||
t.string 'reset_password_token' | |||
t.datetime 'reset_password_sent_at' | |||
t.datetime 'remember_created_at' | |||
t.string 'confirmation_token' | |||
t.datetime 'confirmed_at' | |||
t.datetime 'confirmation_sent_at' | |||
t.string 'unconfirmed_email' | |||
t.datetime 'created_at', precision: 6, null: false | |||
t.datetime 'updated_at', precision: 6, null: false | |||
t.index ['confirmation_token'], name: 'index_users_on_confirmation_token', unique: true | |||
t.index ['email'], name: 'index_users_on_email', unique: true | |||
t.index ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true | |||
end | |||
end |
@@ -1,3 +1,4 @@ | |||
# 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 bin/rails db:seed command (or created alongside the database with db:setup). | |||
# |
@@ -1,4 +1,6 @@ | |||
require "test_helper" | |||
# frozen_string_literal: true | |||
require 'test_helper' | |||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase | |||
driven_by :selenium, using: :chrome, screen_size: [1400, 1400] |
@@ -1,11 +1,15 @@ | |||
require "test_helper" | |||
# frozen_string_literal: true | |||
class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase | |||
# test "connects with cookies" do | |||
# cookies.signed[:user_id] = 42 | |||
# | |||
# connect | |||
# | |||
# assert_equal connection.user_id, "42" | |||
# end | |||
require 'test_helper' | |||
module ApplicationCable | |||
class ConnectionTest < ActionCable::Connection::TestCase | |||
# test "connects with cookies" do | |||
# cookies.signed[:user_id] = 42 | |||
# | |||
# connect | |||
# | |||
# assert_equal connection.user_id, "42" | |||
# end | |||
end | |||
end |
@@ -1,4 +1,6 @@ | |||
require "test_helper" | |||
# frozen_string_literal: true | |||
require 'test_helper' | |||
class UserTest < ActiveSupport::TestCase | |||
# test "the truth" do |
@@ -1,13 +1,17 @@ | |||
# frozen_string_literal: true | |||
ENV['RAILS_ENV'] ||= 'test' | |||
require_relative "../config/environment" | |||
require "rails/test_help" | |||
require_relative '../config/environment' | |||
require 'rails/test_help' | |||
class ActiveSupport::TestCase | |||
# Run tests in parallel with specified workers | |||
parallelize(workers: :number_of_processors) | |||
module ActiveSupport | |||
class TestCase | |||
# Run tests in parallel with specified workers | |||
parallelize(workers: :number_of_processors) | |||
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | |||
fixtures :all | |||
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | |||
fixtures :all | |||
# Add more helper methods to be used by all tests here... | |||
# Add more helper methods to be used by all tests here... | |||
end | |||
end |