initial rebuild from v1
This commit is contained in:
1
.browserslistrc
Normal file
1
.browserslistrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
defaults
|
||||||
12
.env.example
Normal file
12
.env.example
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
BLIZZARD_API_CLIENT_ID=
|
||||||
|
BLIZZARD_API_CLIENT_SECRET=
|
||||||
|
|
||||||
|
DEVISE_JWT_SECRET_KEY=
|
||||||
|
DEVISE_SECRET_KEY=
|
||||||
|
|
||||||
|
DATABASE_USERNAME=
|
||||||
|
DATABASE_PASSWORD=
|
||||||
|
DATABASE_HOST=localhost
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=
|
||||||
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
|
||||||
|
|
||||||
|
# Mark the database schema as having been generated.
|
||||||
|
db/schema.rb linguist-generated
|
||||||
|
|
||||||
|
# Mark the yarn lockfile as having been generated.
|
||||||
|
yarn.lock linguist-generated
|
||||||
|
|
||||||
|
# Mark any vendored files as having been vendored.
|
||||||
|
vendor/* linguist-vendored
|
||||||
39
.gitignore
vendored
Normal file
39
.gitignore
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
||||||
|
#
|
||||||
|
# If you find yourself ignoring temporary files generated by your text editor
|
||||||
|
# or operating system, you probably want to add a global ignore instead:
|
||||||
|
# git config --global core.excludesfile '~/.gitignore_global'
|
||||||
|
|
||||||
|
# Ignore bundler config.
|
||||||
|
/.bundle
|
||||||
|
|
||||||
|
# Ignore all logfiles and tempfiles.
|
||||||
|
/log/*
|
||||||
|
/tmp/*
|
||||||
|
!/log/.keep
|
||||||
|
!/tmp/.keep
|
||||||
|
|
||||||
|
# Ignore pidfiles, but keep the directory.
|
||||||
|
/tmp/pids/*
|
||||||
|
!/tmp/pids/
|
||||||
|
!/tmp/pids/.keep
|
||||||
|
|
||||||
|
# Ignore uploaded files in development.
|
||||||
|
/storage/*
|
||||||
|
!/storage/.keep
|
||||||
|
|
||||||
|
/public/assets
|
||||||
|
.byebug_history
|
||||||
|
|
||||||
|
# Ignore master key for decrypting credentials and more.
|
||||||
|
/config/master.key
|
||||||
|
|
||||||
|
/public/packs
|
||||||
|
/public/packs-test
|
||||||
|
/node_modules
|
||||||
|
/yarn-error.log
|
||||||
|
yarn-debug.log*
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# Ignore environment variables file
|
||||||
|
/.env
|
||||||
46
.rubocop.yml
Normal file
46
.rubocop.yml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
require:
|
||||||
|
- rubocop-rails
|
||||||
|
- rubocop-performance
|
||||||
|
|
||||||
|
AllCops:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/**/*'
|
||||||
|
- 'Rakefile'
|
||||||
|
- 'bin/*'
|
||||||
|
- 'log/**/*'
|
||||||
|
- 'db/schema.rb'
|
||||||
|
- 'db/migrate/*.rb'
|
||||||
|
- 'config/initializers/*.rb'
|
||||||
|
- 'config/environments/*.rb'
|
||||||
|
- 'config/*.rb'
|
||||||
|
NewCops: enable
|
||||||
|
|
||||||
|
Layout/LineLength:
|
||||||
|
Max: 140
|
||||||
|
|
||||||
|
Metrics/ClassLength:
|
||||||
|
Max: 200
|
||||||
|
|
||||||
|
Metrics/BlockLength:
|
||||||
|
Max: 40
|
||||||
|
|
||||||
|
Metrics/MethodLength:
|
||||||
|
Exclude:
|
||||||
|
- 'db/migrate/*.rb'
|
||||||
|
Max: 30
|
||||||
|
|
||||||
|
Metrics/AbcSize:
|
||||||
|
Max: 35
|
||||||
|
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
CountKeywordArgs: false
|
||||||
|
|
||||||
|
Style/WordArray:
|
||||||
|
EnforcedStyle: brackets
|
||||||
|
|
||||||
|
Style/SymbolArray:
|
||||||
|
EnforcedStyle: brackets
|
||||||
|
|
||||||
|
Style/Documentation:
|
||||||
|
Exclude:
|
||||||
|
- 'db/migrate/*.rb'
|
||||||
1
.ruby-version
Normal file
1
.ruby-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.0.1
|
||||||
22
.solargraph.yml
Normal file
22
.solargraph.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
include:
|
||||||
|
- "**/*.rb"
|
||||||
|
exclude:
|
||||||
|
- spec/**/*
|
||||||
|
- test/**/*
|
||||||
|
- vendor/**/*
|
||||||
|
- ".bundle/**/*"
|
||||||
|
require: []
|
||||||
|
domains: []
|
||||||
|
reporters:
|
||||||
|
- rubocop
|
||||||
|
- require_not_found
|
||||||
|
formatter:
|
||||||
|
rubocop:
|
||||||
|
cops: safe
|
||||||
|
except: []
|
||||||
|
only: []
|
||||||
|
extra_args: []
|
||||||
|
require_paths: []
|
||||||
|
plugins: []
|
||||||
|
max_files: 5000
|
||||||
94
Gemfile
Normal file
94
Gemfile
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||||
|
|
||||||
|
ruby '3.0.1'
|
||||||
|
|
||||||
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
|
||||||
|
gem 'rails', '~> 6.1.3', '>= 6.1.3.1'
|
||||||
|
# A set of common locale data and translations to internationalize and/or localize your Rails applications
|
||||||
|
gem 'rails-i18n', '~> 6.0.0'
|
||||||
|
# Use postgresql as the database for Active Record
|
||||||
|
gem 'pg', '~> 1.1'
|
||||||
|
# Use Puma as the app server
|
||||||
|
gem 'puma', '~> 5.0'
|
||||||
|
# Use SCSS for stylesheets
|
||||||
|
gem 'sass-rails', '>= 6'
|
||||||
|
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
|
||||||
|
gem 'webpacker', '~> 5.0'
|
||||||
|
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
||||||
|
gem 'turbolinks', '~> 5'
|
||||||
|
# Use Redis adapter to run Action Cable in production
|
||||||
|
gem 'redis', '~> 4.2.5'
|
||||||
|
# Use Active Model has_secure_password
|
||||||
|
gem 'bcrypt', '~> 3.1.7'
|
||||||
|
# Flexible authentication solution for Rails with Warden
|
||||||
|
gem 'devise', '~> 4.7.3'
|
||||||
|
# Tame Rails' multi-line logging into a single line per request
|
||||||
|
gem 'lograge', '~> 0.11.2'
|
||||||
|
# Stores and retrieves localized data through attributes on a Ruby class, with flexible support for different storage strategies
|
||||||
|
gem 'mobility', '~> 1.1.1'
|
||||||
|
# Omniauth Strategy for Battle.net OAuth Login. For more info visit https://dev.battle.net
|
||||||
|
gem 'omniauth-bnet', '~> 2.0.0'
|
||||||
|
# This gem provides a mitigation against CVE-2015-9284
|
||||||
|
# gem 'omniauth-rails_csrf_protection', '~> 0.1.2'
|
||||||
|
# A Ruby wrapper around Blizzard's Game Data and Profile APIs
|
||||||
|
gem 'rbattlenet', '~> 2.2.4', git: 'https://github.com/Dainii/rbattlenet'
|
||||||
|
# A gem that provides Rails integration for the Sentry error logger
|
||||||
|
gem 'sentry-rails', '~> 4.3.4'
|
||||||
|
gem 'sentry-ruby', '~> 4.3.2'
|
||||||
|
# Simple, efficient background processing for Ruby
|
||||||
|
gem 'sidekiq', '~> 6.2.1'
|
||||||
|
|
||||||
|
# Reduces boot times through caching; required in config/boot.rb
|
||||||
|
gem 'bootsnap', '>= 1.4.4', require: false
|
||||||
|
|
||||||
|
group :development, :test do
|
||||||
|
# Brakeman detects security vulnerabilities in Ruby on Rails applications via static analysis
|
||||||
|
gem 'brakeman', '~> 5.0.0'
|
||||||
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||||
|
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
||||||
|
# Strategies for cleaning databases. Can be used to ensure a clean slate for testing
|
||||||
|
gem 'database_cleaner'
|
||||||
|
# Autoload dotenv in Rails
|
||||||
|
gem 'dotenv-rails'
|
||||||
|
# rspec-rails is a testing framework for Rails 5+
|
||||||
|
gem 'rspec-rails'
|
||||||
|
# RuboCop is a Ruby code style checking and code formatting tool. It aims to enforce the community-driven Ruby Style Guide
|
||||||
|
gem 'rubocop', require: false
|
||||||
|
gem 'rubocop-performance', require: false
|
||||||
|
gem 'rubocop-rails', require: false
|
||||||
|
# Code coverage for Ruby with a powerful configuration library and automatic merging of coverage across test suites
|
||||||
|
gem 'simplecov', require: false
|
||||||
|
end
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
gem 'awesome_print'
|
||||||
|
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
||||||
|
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'
|
||||||
|
# The Listen gem listens to file modifications and notifies you about the changes. Works everywhere
|
||||||
|
gem 'listen', '~> 3.3'
|
||||||
|
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
||||||
|
gem 'spring'
|
||||||
|
# IDE tools for code completion, inline documentation, and static analysis
|
||||||
|
gem 'solargraph'
|
||||||
|
# Use Pry as your rails console
|
||||||
|
gem 'pry-rails', '~> 0.3.9'
|
||||||
|
end
|
||||||
|
|
||||||
|
group :test do
|
||||||
|
# Adds support for Capybara system testing and selenium driver
|
||||||
|
gem 'capybara', '>= 3.26'
|
||||||
|
# WebDriver is a tool for writing automated tests of websites. It aims to mimic the behaviour of a real user
|
||||||
|
# and as such interacts with the HTML of the application
|
||||||
|
gem 'selenium-webdriver'
|
||||||
|
# Easy installation and use of web drivers to run system tests with browsers
|
||||||
|
gem 'webdrivers'
|
||||||
|
end
|
||||||
|
|
||||||
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||||
|
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||||
423
Gemfile.lock
Normal file
423
Gemfile.lock
Normal file
@@ -0,0 +1,423 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/Dainii/rbattlenet
|
||||||
|
revision: aa174b4fa9e22c1ff77caf168b4442325c0ae3e6
|
||||||
|
specs:
|
||||||
|
rbattlenet (2.2.4)
|
||||||
|
require_all
|
||||||
|
typhoeus (~> 1.1)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
actioncable (6.1.3.1)
|
||||||
|
actionpack (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
nio4r (~> 2.0)
|
||||||
|
websocket-driver (>= 0.6.1)
|
||||||
|
actionmailbox (6.1.3.1)
|
||||||
|
actionpack (= 6.1.3.1)
|
||||||
|
activejob (= 6.1.3.1)
|
||||||
|
activerecord (= 6.1.3.1)
|
||||||
|
activestorage (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
mail (>= 2.7.1)
|
||||||
|
actionmailer (6.1.3.1)
|
||||||
|
actionpack (= 6.1.3.1)
|
||||||
|
actionview (= 6.1.3.1)
|
||||||
|
activejob (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
mail (~> 2.5, >= 2.5.4)
|
||||||
|
rails-dom-testing (~> 2.0)
|
||||||
|
actionpack (6.1.3.1)
|
||||||
|
actionview (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
rack (~> 2.0, >= 2.0.9)
|
||||||
|
rack-test (>= 0.6.3)
|
||||||
|
rails-dom-testing (~> 2.0)
|
||||||
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||||
|
actiontext (6.1.3.1)
|
||||||
|
actionpack (= 6.1.3.1)
|
||||||
|
activerecord (= 6.1.3.1)
|
||||||
|
activestorage (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
nokogiri (>= 1.8.5)
|
||||||
|
actionview (6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
builder (~> 3.1)
|
||||||
|
erubi (~> 1.4)
|
||||||
|
rails-dom-testing (~> 2.0)
|
||||||
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||||
|
activejob (6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
globalid (>= 0.3.6)
|
||||||
|
activemodel (6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
activerecord (6.1.3.1)
|
||||||
|
activemodel (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
activestorage (6.1.3.1)
|
||||||
|
actionpack (= 6.1.3.1)
|
||||||
|
activejob (= 6.1.3.1)
|
||||||
|
activerecord (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
marcel (~> 1.0.0)
|
||||||
|
mini_mime (~> 1.0.2)
|
||||||
|
activesupport (6.1.3.1)
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
|
i18n (>= 1.6, < 2)
|
||||||
|
minitest (>= 5.1)
|
||||||
|
tzinfo (~> 2.0)
|
||||||
|
zeitwerk (~> 2.3)
|
||||||
|
addressable (2.7.0)
|
||||||
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
|
ast (2.4.2)
|
||||||
|
awesome_print (1.9.2)
|
||||||
|
backport (1.1.2)
|
||||||
|
bcrypt (3.1.16)
|
||||||
|
benchmark (0.1.1)
|
||||||
|
bindex (0.8.1)
|
||||||
|
bootsnap (1.7.4)
|
||||||
|
msgpack (~> 1.0)
|
||||||
|
brakeman (5.0.0)
|
||||||
|
builder (3.2.4)
|
||||||
|
byebug (11.1.3)
|
||||||
|
capybara (3.35.3)
|
||||||
|
addressable
|
||||||
|
mini_mime (>= 0.1.3)
|
||||||
|
nokogiri (~> 1.8)
|
||||||
|
rack (>= 1.6.0)
|
||||||
|
rack-test (>= 0.6.3)
|
||||||
|
regexp_parser (>= 1.5, < 3.0)
|
||||||
|
xpath (~> 3.2)
|
||||||
|
childprocess (3.0.0)
|
||||||
|
coderay (1.1.3)
|
||||||
|
concurrent-ruby (1.1.8)
|
||||||
|
connection_pool (2.2.5)
|
||||||
|
crass (1.0.6)
|
||||||
|
database_cleaner (2.0.1)
|
||||||
|
database_cleaner-active_record (~> 2.0.0)
|
||||||
|
database_cleaner-active_record (2.0.0)
|
||||||
|
activerecord (>= 5.a)
|
||||||
|
database_cleaner-core (~> 2.0.0)
|
||||||
|
database_cleaner-core (2.0.1)
|
||||||
|
devise (4.7.3)
|
||||||
|
bcrypt (~> 3.0)
|
||||||
|
orm_adapter (~> 0.1)
|
||||||
|
railties (>= 4.1.0)
|
||||||
|
responders
|
||||||
|
warden (~> 1.2.3)
|
||||||
|
diff-lcs (1.4.4)
|
||||||
|
docile (1.3.5)
|
||||||
|
dotenv (2.7.6)
|
||||||
|
dotenv-rails (2.7.6)
|
||||||
|
dotenv (= 2.7.6)
|
||||||
|
railties (>= 3.2)
|
||||||
|
e2mmap (0.1.0)
|
||||||
|
erubi (1.10.0)
|
||||||
|
ethon (0.13.0)
|
||||||
|
ffi (>= 1.15.0)
|
||||||
|
faraday (1.4.1)
|
||||||
|
faraday-excon (~> 1.1)
|
||||||
|
faraday-net_http (~> 1.0)
|
||||||
|
faraday-net_http_persistent (~> 1.1)
|
||||||
|
multipart-post (>= 1.2, < 3)
|
||||||
|
ruby2_keywords (>= 0.0.4)
|
||||||
|
faraday-excon (1.1.0)
|
||||||
|
faraday-net_http (1.0.1)
|
||||||
|
faraday-net_http_persistent (1.1.0)
|
||||||
|
ffi (1.15.0)
|
||||||
|
globalid (0.4.2)
|
||||||
|
activesupport (>= 4.2.0)
|
||||||
|
hashie (4.1.0)
|
||||||
|
i18n (1.8.10)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
jaro_winkler (1.5.4)
|
||||||
|
jwt (2.2.3)
|
||||||
|
kramdown (2.3.1)
|
||||||
|
rexml
|
||||||
|
kramdown-parser-gfm (1.1.0)
|
||||||
|
kramdown (~> 2.0)
|
||||||
|
listen (3.5.1)
|
||||||
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
|
lograge (0.11.2)
|
||||||
|
actionpack (>= 4)
|
||||||
|
activesupport (>= 4)
|
||||||
|
railties (>= 4)
|
||||||
|
request_store (~> 1.0)
|
||||||
|
loofah (2.9.1)
|
||||||
|
crass (~> 1.0.2)
|
||||||
|
nokogiri (>= 1.5.9)
|
||||||
|
mail (2.7.1)
|
||||||
|
mini_mime (>= 0.1.1)
|
||||||
|
marcel (1.0.1)
|
||||||
|
method_source (1.0.0)
|
||||||
|
mini_mime (1.0.3)
|
||||||
|
minitest (5.14.4)
|
||||||
|
mobility (1.1.1)
|
||||||
|
i18n (>= 0.6.10, < 2)
|
||||||
|
request_store (~> 1.0)
|
||||||
|
msgpack (1.4.2)
|
||||||
|
multi_json (1.15.0)
|
||||||
|
multi_xml (0.6.0)
|
||||||
|
multipart-post (2.1.1)
|
||||||
|
nio4r (2.5.7)
|
||||||
|
nokogiri (1.11.3-x86_64-linux)
|
||||||
|
racc (~> 1.4)
|
||||||
|
oauth2 (1.4.7)
|
||||||
|
faraday (>= 0.8, < 2.0)
|
||||||
|
jwt (>= 1.0, < 3.0)
|
||||||
|
multi_json (~> 1.3)
|
||||||
|
multi_xml (~> 0.5)
|
||||||
|
rack (>= 1.2, < 3)
|
||||||
|
omniauth (1.9.1)
|
||||||
|
hashie (>= 3.4.6)
|
||||||
|
rack (>= 1.6.2, < 3)
|
||||||
|
omniauth-bnet (2.0.0)
|
||||||
|
omniauth (~> 1.0)
|
||||||
|
omniauth-oauth2 (~> 1.1)
|
||||||
|
omniauth-oauth2 (1.7.1)
|
||||||
|
oauth2 (~> 1.4)
|
||||||
|
omniauth (>= 1.9, < 3)
|
||||||
|
orm_adapter (0.5.0)
|
||||||
|
parallel (1.20.1)
|
||||||
|
parser (3.0.1.0)
|
||||||
|
ast (~> 2.4.1)
|
||||||
|
pg (1.2.3)
|
||||||
|
pry (0.14.1)
|
||||||
|
coderay (~> 1.1)
|
||||||
|
method_source (~> 1.0)
|
||||||
|
pry-rails (0.3.9)
|
||||||
|
pry (>= 0.10.4)
|
||||||
|
public_suffix (4.0.6)
|
||||||
|
puma (5.2.2)
|
||||||
|
nio4r (~> 2.0)
|
||||||
|
racc (1.5.2)
|
||||||
|
rack (2.2.3)
|
||||||
|
rack-mini-profiler (2.3.1)
|
||||||
|
rack (>= 1.2.0)
|
||||||
|
rack-proxy (0.6.5)
|
||||||
|
rack
|
||||||
|
rack-test (1.1.0)
|
||||||
|
rack (>= 1.0, < 3)
|
||||||
|
rails (6.1.3.1)
|
||||||
|
actioncable (= 6.1.3.1)
|
||||||
|
actionmailbox (= 6.1.3.1)
|
||||||
|
actionmailer (= 6.1.3.1)
|
||||||
|
actionpack (= 6.1.3.1)
|
||||||
|
actiontext (= 6.1.3.1)
|
||||||
|
actionview (= 6.1.3.1)
|
||||||
|
activejob (= 6.1.3.1)
|
||||||
|
activemodel (= 6.1.3.1)
|
||||||
|
activerecord (= 6.1.3.1)
|
||||||
|
activestorage (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
bundler (>= 1.15.0)
|
||||||
|
railties (= 6.1.3.1)
|
||||||
|
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)
|
||||||
|
rails-i18n (6.0.0)
|
||||||
|
i18n (>= 0.7, < 2)
|
||||||
|
railties (>= 6.0.0, < 7)
|
||||||
|
railties (6.1.3.1)
|
||||||
|
actionpack (= 6.1.3.1)
|
||||||
|
activesupport (= 6.1.3.1)
|
||||||
|
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)
|
||||||
|
ffi (~> 1.0)
|
||||||
|
redis (4.2.5)
|
||||||
|
regexp_parser (2.1.1)
|
||||||
|
request_store (1.5.0)
|
||||||
|
rack (>= 1.4)
|
||||||
|
require_all (3.0.0)
|
||||||
|
responders (3.0.1)
|
||||||
|
actionpack (>= 5.0)
|
||||||
|
railties (>= 5.0)
|
||||||
|
reverse_markdown (2.0.0)
|
||||||
|
nokogiri
|
||||||
|
rexml (3.2.5)
|
||||||
|
rspec-core (3.10.1)
|
||||||
|
rspec-support (~> 3.10.0)
|
||||||
|
rspec-expectations (3.10.1)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.10.0)
|
||||||
|
rspec-mocks (3.10.2)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.10.0)
|
||||||
|
rspec-rails (5.0.1)
|
||||||
|
actionpack (>= 5.2)
|
||||||
|
activesupport (>= 5.2)
|
||||||
|
railties (>= 5.2)
|
||||||
|
rspec-core (~> 3.10)
|
||||||
|
rspec-expectations (~> 3.10)
|
||||||
|
rspec-mocks (~> 3.10)
|
||||||
|
rspec-support (~> 3.10)
|
||||||
|
rspec-support (3.10.2)
|
||||||
|
rubocop (1.13.0)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 3.0.0.0)
|
||||||
|
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, < 3.0)
|
||||||
|
rubocop-ast (1.4.1)
|
||||||
|
parser (>= 2.7.1.5)
|
||||||
|
rubocop-performance (1.11.0)
|
||||||
|
rubocop (>= 1.7.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.11.0)
|
||||||
|
ruby2_keywords (0.0.4)
|
||||||
|
rubyzip (2.3.0)
|
||||||
|
sass-rails (6.0.0)
|
||||||
|
sassc-rails (~> 2.1, >= 2.1.1)
|
||||||
|
sassc (2.4.0)
|
||||||
|
ffi (~> 1.9)
|
||||||
|
sassc-rails (2.1.2)
|
||||||
|
railties (>= 4.0.0)
|
||||||
|
sassc (>= 2.0)
|
||||||
|
sprockets (> 3.0)
|
||||||
|
sprockets-rails
|
||||||
|
tilt
|
||||||
|
selenium-webdriver (3.142.7)
|
||||||
|
childprocess (>= 0.5, < 4.0)
|
||||||
|
rubyzip (>= 1.2.2)
|
||||||
|
semantic_range (3.0.0)
|
||||||
|
sentry-rails (4.3.4)
|
||||||
|
railties (>= 5.0)
|
||||||
|
sentry-ruby-core (~> 4.3.0)
|
||||||
|
sentry-ruby (4.3.2)
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
|
faraday (>= 1.0)
|
||||||
|
sentry-ruby-core (= 4.3.2)
|
||||||
|
sentry-ruby-core (4.3.2)
|
||||||
|
concurrent-ruby
|
||||||
|
faraday
|
||||||
|
sidekiq (6.2.1)
|
||||||
|
connection_pool (>= 2.2.2)
|
||||||
|
rack (~> 2.0)
|
||||||
|
redis (>= 4.2.0)
|
||||||
|
simplecov (0.21.2)
|
||||||
|
docile (~> 1.1)
|
||||||
|
simplecov-html (~> 0.11)
|
||||||
|
simplecov_json_formatter (~> 0.1)
|
||||||
|
simplecov-html (0.12.3)
|
||||||
|
simplecov_json_formatter (0.1.2)
|
||||||
|
solargraph (0.40.4)
|
||||||
|
backport (~> 1.1)
|
||||||
|
benchmark
|
||||||
|
bundler (>= 1.17.2)
|
||||||
|
e2mmap
|
||||||
|
jaro_winkler (~> 1.5)
|
||||||
|
kramdown (~> 2.3)
|
||||||
|
kramdown-parser-gfm (~> 1.1)
|
||||||
|
parser (~> 3.0)
|
||||||
|
reverse_markdown (>= 1.0.5, < 3)
|
||||||
|
rubocop (>= 0.52)
|
||||||
|
thor (~> 1.0)
|
||||||
|
tilt (~> 2.0)
|
||||||
|
yard (~> 0.9, >= 0.9.24)
|
||||||
|
spring (2.1.1)
|
||||||
|
sprockets (4.0.2)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
rack (> 1, < 3)
|
||||||
|
sprockets-rails (3.2.2)
|
||||||
|
actionpack (>= 4.0)
|
||||||
|
activesupport (>= 4.0)
|
||||||
|
sprockets (>= 3.0.0)
|
||||||
|
thor (1.1.0)
|
||||||
|
tilt (2.0.10)
|
||||||
|
turbolinks (5.2.1)
|
||||||
|
turbolinks-source (~> 5.2)
|
||||||
|
turbolinks-source (5.2.0)
|
||||||
|
typhoeus (1.4.0)
|
||||||
|
ethon (>= 0.9.0)
|
||||||
|
tzinfo (2.0.4)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
unicode-display_width (2.0.0)
|
||||||
|
warden (1.2.9)
|
||||||
|
rack (>= 2.0.9)
|
||||||
|
web-console (4.1.0)
|
||||||
|
actionview (>= 6.0.0)
|
||||||
|
activemodel (>= 6.0.0)
|
||||||
|
bindex (>= 0.4.0)
|
||||||
|
railties (>= 6.0.0)
|
||||||
|
webdrivers (4.6.0)
|
||||||
|
nokogiri (~> 1.6)
|
||||||
|
rubyzip (>= 1.3.0)
|
||||||
|
selenium-webdriver (>= 3.0, < 4.0)
|
||||||
|
webpacker (5.2.1)
|
||||||
|
activesupport (>= 5.2)
|
||||||
|
rack-proxy (>= 0.6.1)
|
||||||
|
railties (>= 5.2)
|
||||||
|
semantic_range (>= 2.3.0)
|
||||||
|
websocket-driver (0.7.3)
|
||||||
|
websocket-extensions (>= 0.1.0)
|
||||||
|
websocket-extensions (0.1.5)
|
||||||
|
xpath (3.2.0)
|
||||||
|
nokogiri (~> 1.8)
|
||||||
|
yard (0.9.26)
|
||||||
|
zeitwerk (2.4.2)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
awesome_print
|
||||||
|
bcrypt (~> 3.1.7)
|
||||||
|
bootsnap (>= 1.4.4)
|
||||||
|
brakeman (~> 5.0.0)
|
||||||
|
byebug
|
||||||
|
capybara (>= 3.26)
|
||||||
|
database_cleaner
|
||||||
|
devise (~> 4.7.3)
|
||||||
|
dotenv-rails
|
||||||
|
listen (~> 3.3)
|
||||||
|
lograge (~> 0.11.2)
|
||||||
|
mobility (~> 1.1.1)
|
||||||
|
omniauth-bnet (~> 2.0.0)
|
||||||
|
pg (~> 1.1)
|
||||||
|
pry-rails (~> 0.3.9)
|
||||||
|
puma (~> 5.0)
|
||||||
|
rack-mini-profiler (~> 2.0)
|
||||||
|
rails (~> 6.1.3, >= 6.1.3.1)
|
||||||
|
rails-i18n (~> 6.0.0)
|
||||||
|
rbattlenet (~> 2.2.4)!
|
||||||
|
redis (~> 4.2.5)
|
||||||
|
rspec-rails
|
||||||
|
rubocop
|
||||||
|
rubocop-performance
|
||||||
|
rubocop-rails
|
||||||
|
sass-rails (>= 6)
|
||||||
|
selenium-webdriver
|
||||||
|
sentry-rails (~> 4.3.4)
|
||||||
|
sentry-ruby (~> 4.3.2)
|
||||||
|
sidekiq (~> 6.2.1)
|
||||||
|
simplecov
|
||||||
|
solargraph
|
||||||
|
spring
|
||||||
|
turbolinks (~> 5)
|
||||||
|
tzinfo-data
|
||||||
|
web-console (>= 4.1.0)
|
||||||
|
webdrivers
|
||||||
|
webpacker (~> 5.0)
|
||||||
|
|
||||||
|
RUBY VERSION
|
||||||
|
ruby 3.0.1p64
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.2.15
|
||||||
24
README.md
Normal file
24
README.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# README
|
||||||
|
|
||||||
|
This README would normally document whatever steps are necessary to get the
|
||||||
|
application up and running.
|
||||||
|
|
||||||
|
Things you may want to cover:
|
||||||
|
|
||||||
|
* Ruby version
|
||||||
|
|
||||||
|
* System dependencies
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
|
||||||
|
* Database creation
|
||||||
|
|
||||||
|
* Database initialization
|
||||||
|
|
||||||
|
* How to run the test suite
|
||||||
|
|
||||||
|
* Services (job queues, cache servers, search engines, etc.)
|
||||||
|
|
||||||
|
* Deployment instructions
|
||||||
|
|
||||||
|
* ...
|
||||||
6
Rakefile
Normal file
6
Rakefile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# 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"
|
||||||
|
|
||||||
|
Rails.application.load_tasks
|
||||||
2
app/assets/config/manifest.js
Normal file
2
app/assets/config/manifest.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
//= link_tree ../images
|
||||||
|
//= link_directory ../stylesheets .css
|
||||||
0
app/assets/images/.keep
Normal file
0
app/assets/images/.keep
Normal file
19
app/assets/stylesheets/application.scss
Normal file
19
app/assets/stylesheets/application.scss
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||||
|
* listed below.
|
||||||
|
*
|
||||||
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
||||||
|
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||||
|
*
|
||||||
|
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||||
|
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||||
|
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||||
|
* It is generally better to create a new file per style scope.
|
||||||
|
*
|
||||||
|
*= require_tree .
|
||||||
|
*= require_self
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: rgb(21, 32, 43);
|
||||||
|
}
|
||||||
3
app/assets/stylesheets/home.scss
Normal file
3
app/assets/stylesheets/home.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the home controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: https://sass-lang.com/
|
||||||
4
app/channels/application_cable/channel.rb
Normal file
4
app/channels/application_cable/channel.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module ApplicationCable
|
||||||
|
class Channel < ActionCable::Channel::Base
|
||||||
|
end
|
||||||
|
end
|
||||||
4
app/channels/application_cable/connection.rb
Normal file
4
app/channels/application_cable/connection.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module ApplicationCable
|
||||||
|
class Connection < ActionCable::Connection::Base
|
||||||
|
end
|
||||||
|
end
|
||||||
12
app/controllers/application_controller.rb
Normal file
12
app/controllers/application_controller.rb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
around_action :switch_locale
|
||||||
|
|
||||||
|
def switch_locale(&action)
|
||||||
|
locale = I18n.default_locale
|
||||||
|
I18n.with_locale(locale, &action)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_session_path(_scope)
|
||||||
|
new_user_session_path
|
||||||
|
end
|
||||||
|
end
|
||||||
0
app/controllers/concerns/.keep
Normal file
0
app/controllers/concerns/.keep
Normal file
4
app/controllers/home_controller.rb
Normal file
4
app/controllers/home_controller.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
class HomeController < ApplicationController
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
end
|
||||||
24
app/controllers/users/omniauth_callbacks_controller.rb
Normal file
24
app/controllers/users/omniauth_callbacks_controller.rb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Controller: Callback
|
||||||
|
#
|
||||||
|
# Description: Callback method for Bnet
|
||||||
|
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||||
|
skip_before_action :verify_authenticity_token, only: :bnet
|
||||||
|
|
||||||
|
def bnet
|
||||||
|
@user = User.from_omniauth(request.env['omniauth.auth'])
|
||||||
|
|
||||||
|
if @user.persisted?
|
||||||
|
sign_in_and_redirect @user, event: :authentication
|
||||||
|
set_flash_message(:notice, :success, kind: 'Bnet') if is_navigational_format?
|
||||||
|
else
|
||||||
|
session['devise.bnet_data'] = request.env['omniauth.auth'].except(:extra)
|
||||||
|
redirect_to new_user_registration_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def failure
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
2
app/helpers/application_helper.rb
Normal file
2
app/helpers/application_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module ApplicationHelper
|
||||||
|
end
|
||||||
2
app/helpers/home_helper.rb
Normal file
2
app/helpers/home_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module HomeHelper
|
||||||
|
end
|
||||||
2
app/helpers/welcome_helper.rb
Normal file
2
app/helpers/welcome_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module WelcomeHelper
|
||||||
|
end
|
||||||
6
app/javascript/channels/consumer.js
Normal file
6
app/javascript/channels/consumer.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Action Cable provides the framework to deal with WebSockets in Rails.
|
||||||
|
// You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
|
||||||
|
|
||||||
|
import { createConsumer } from "@rails/actioncable"
|
||||||
|
|
||||||
|
export default createConsumer()
|
||||||
5
app/javascript/channels/index.js
Normal file
5
app/javascript/channels/index.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// Load all the channels within this directory and all subdirectories.
|
||||||
|
// Channel files must be named *_channel.js.
|
||||||
|
|
||||||
|
const channels = require.context('.', true, /_channel\.js$/)
|
||||||
|
channels.keys().forEach(channels)
|
||||||
23
app/javascript/packs/application.js
Normal file
23
app/javascript/packs/application.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// This file is automatically compiled by Webpack, along with any other files
|
||||||
|
// present in this directory. You're encouraged to place your actual application logic in
|
||||||
|
// a relevant structure within app/javascript and only use these pack files to reference
|
||||||
|
// that code so it'll be compiled.
|
||||||
|
|
||||||
|
import Rails from "@rails/ujs"
|
||||||
|
import Turbolinks from "turbolinks"
|
||||||
|
import * as ActiveStorage from "@rails/activestorage"
|
||||||
|
import "channels"
|
||||||
|
|
||||||
|
import "bootstrap"
|
||||||
|
import "../stylesheets/application"
|
||||||
|
|
||||||
|
import "@fortawesome/fontawesome-free/css/all"
|
||||||
|
|
||||||
|
document.addEventListener("turbolinks:load", () => {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip()
|
||||||
|
$('[data-toggle="popover"]').popover()
|
||||||
|
})
|
||||||
|
|
||||||
|
Rails.start()
|
||||||
|
Turbolinks.start()
|
||||||
|
ActiveStorage.start()
|
||||||
1
app/javascript/stylesheets/application.scss
Normal file
1
app/javascript/stylesheets/application.scss
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@import "~bootstrap/scss/bootstrap";
|
||||||
7
app/jobs/application_job.rb
Normal file
7
app/jobs/application_job.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
class ApplicationJob < ActiveJob::Base
|
||||||
|
# Automatically retry jobs that encountered a deadlock
|
||||||
|
# retry_on ActiveRecord::Deadlocked
|
||||||
|
|
||||||
|
# Most jobs are safe to ignore if the underlying records are no longer available
|
||||||
|
# discard_on ActiveJob::DeserializationError
|
||||||
|
end
|
||||||
4
app/mailers/application_mailer.rb
Normal file
4
app/mailers/application_mailer.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
class ApplicationMailer < ActionMailer::Base
|
||||||
|
default from: 'from@example.com'
|
||||||
|
layout 'mailer'
|
||||||
|
end
|
||||||
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
|
self.abstract_class = true
|
||||||
|
end
|
||||||
0
app/models/concerns/.keep
Normal file
0
app/models/concerns/.keep
Normal file
36
app/models/user.rb
Normal file
36
app/models/user.rb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Model: User
|
||||||
|
#
|
||||||
|
# Description: Define an application user. the only authentication mecanism
|
||||||
|
# is omniauthable with the BattleNet API
|
||||||
|
class User < ApplicationRecord
|
||||||
|
devise :rememberable, :omniauthable, omniauth_providers: [:bnet]
|
||||||
|
|
||||||
|
has_many :wow_characters, dependent: :destroy
|
||||||
|
|
||||||
|
validates :battletag, presence: true, uniqueness: true
|
||||||
|
|
||||||
|
def self.from_omniauth(auth)
|
||||||
|
user = User.where(provider: auth.provider, uid: auth.uid).first_or_initialize
|
||||||
|
|
||||||
|
user.provider = auth.provider
|
||||||
|
user.uid = auth.uid
|
||||||
|
user.battletag = auth.info.battletag
|
||||||
|
user.token_expires = auth.credentials.expires
|
||||||
|
user.token_expire_at = Time.at(auth.credentials.expires_at).utc
|
||||||
|
user.token = auth.credentials.token
|
||||||
|
|
||||||
|
user.save
|
||||||
|
|
||||||
|
user
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.new_with_session(params, session)
|
||||||
|
super.tap do |user|
|
||||||
|
if (data = session['devise.bnet_data']) && session['devise.bnet_data']['extra']['raw_info']
|
||||||
|
user.email = data['email'] if user.email.blank?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
14
app/models/wow_character.rb
Normal file
14
app/models/wow_character.rb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
class WowCharacter < ApplicationRecord
|
||||||
|
extend Mobility
|
||||||
|
translates :translated_faction, :translated_gender
|
||||||
|
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :wow_realm
|
||||||
|
belongs_to :wow_class
|
||||||
|
belongs_to :wow_race
|
||||||
|
belongs_to :wow_character_title, optional: true
|
||||||
|
has_one :wow_character_medium, dependent: :nullify
|
||||||
|
|
||||||
|
validates :name, presence: true
|
||||||
|
validates :character_id, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
3
app/models/wow_character_medium.rb
Normal file
3
app/models/wow_character_medium.rb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
class WowCharacterMedium < ApplicationRecord
|
||||||
|
belongs_to :wow_character
|
||||||
|
end
|
||||||
9
app/models/wow_character_title.rb
Normal file
9
app/models/wow_character_title.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class WowCharacterTitle < ApplicationRecord
|
||||||
|
extend Mobility
|
||||||
|
translates :name, :male_name, :female_name
|
||||||
|
|
||||||
|
has_many :wow_characters, dependent: :nullify
|
||||||
|
|
||||||
|
validates :name, presence: true
|
||||||
|
validates :title_id, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
9
app/models/wow_class.rb
Normal file
9
app/models/wow_class.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class WowClass < ApplicationRecord
|
||||||
|
extend Mobility
|
||||||
|
translates :name, :power_type, :male_name, :female_name
|
||||||
|
|
||||||
|
has_many :wow_characters, dependent: :nullify
|
||||||
|
|
||||||
|
validates :name, presence: true
|
||||||
|
validates :class_id, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
9
app/models/wow_race.rb
Normal file
9
app/models/wow_race.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class WowRace < ApplicationRecord
|
||||||
|
extend Mobility
|
||||||
|
translates :name, :translated_faction, :male_name, :female_name
|
||||||
|
|
||||||
|
has_many :wow_characters, dependent: :nullify
|
||||||
|
|
||||||
|
validates :name, presence: true
|
||||||
|
validates :race_id, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
10
app/models/wow_realm.rb
Normal file
10
app/models/wow_realm.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class WowRealm < ApplicationRecord
|
||||||
|
extend Mobility
|
||||||
|
translates :name, :category, :realm_type
|
||||||
|
|
||||||
|
has_many :wow_characters, dependent: :nullify
|
||||||
|
|
||||||
|
validates :name, presence: true
|
||||||
|
validates :slug, presence: true
|
||||||
|
validates :realm_id, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
2
app/views/home/index.html.erb
Normal file
2
app/views/home/index.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>Home#index</h1>
|
||||||
|
<p>Find me in app/views/home/index.html.erb</p>
|
||||||
25
app/views/layouts/_navbar.html.erb
Normal file
25
app/views/layouts/_navbar.html.erb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<nav class="navbar fixed-top navbar-dark navbar-expand-lg bg-dark">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="#">Northwhale 2</a>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="nav navbar-nav flex-row ml-md-auto d-none d-md-flex">
|
||||||
|
<li class="nav-item">
|
||||||
|
<% if user_signed_in? %>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
Menu
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
|
<li>Bnet: <%= current_user.battletag %></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><%= link_to '<i class="fas fa-sign-out-alt"></i>'.html_safe, destroy_user_session_path, method: :delete %></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to 'Sign in with <i class="fab fa-battle-net"></i>'.html_safe, user_bnet_omniauth_authorize_path, method: :post, class: "btn btn-primary" %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
20
app/views/layouts/application.html.erb
Normal file
20
app/views/layouts/application.html.erb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Northwhale2</title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
<%= csp_meta_tag %>
|
||||||
|
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%= render 'layouts/navbar' %>
|
||||||
|
<p class="notice"><%= notice %></p>
|
||||||
|
<p class="alert"><%= alert %></p>
|
||||||
|
<%= yield %>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
13
app/views/layouts/mailer.html.erb
Normal file
13
app/views/layouts/mailer.html.erb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<style>
|
||||||
|
/* Email styles need to be inline */
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%= yield %>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
app/views/layouts/mailer.text.erb
Normal file
1
app/views/layouts/mailer.text.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<%= yield %>
|
||||||
21
app/workers/wow_character_detail_worker.rb
Normal file
21
app/workers/wow_character_detail_worker.rb
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
class WowCharacterDetailWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform(wow_character_id)
|
||||||
|
return unless (wow_character = WowCharacter.where(character_id: wow_character_id).first)
|
||||||
|
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'en_GB')
|
||||||
|
result = RBattlenet::Wow::Character.find({ name: wow_character.name.downcase, realm: wow_character.wow_realm.slug })
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
wow_character.achievements_points = result.achievement_points
|
||||||
|
wow_character.last_login_timestamp = Time.at(result.last_login_timestamp.to_s[0..-4].to_i).utc
|
||||||
|
wow_character.average_item_level = result.average_item_level
|
||||||
|
wow_character.equipped_item_level = result.equipped_item_level
|
||||||
|
wow_character.wow_character_title = WowCharacterTitle.where(title_id: result.active_title.id).first if result.active_title
|
||||||
|
|
||||||
|
wow_character.save
|
||||||
|
end
|
||||||
|
end
|
||||||
35
app/workers/wow_character_media_worker.rb
Normal file
35
app/workers/wow_character_media_worker.rb
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
class WowCharacterMediaWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform(wow_character_id)
|
||||||
|
return unless (wow_character = WowCharacter.where(character_id: wow_character_id).first)
|
||||||
|
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'en_GB')
|
||||||
|
result = RBattlenet::Wow::Character::Media.find({ name: wow_character.name.downcase, realm: wow_character.wow_realm.slug })
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
return unless (wow_character_media = wow_character.wow_character_medium || WowCharacterMedium.new)
|
||||||
|
|
||||||
|
wow_character_media.wow_character = wow_character
|
||||||
|
wow_character_media.href = result._links.self.href
|
||||||
|
|
||||||
|
return unless result.assets
|
||||||
|
|
||||||
|
result.assets.each do |asset|
|
||||||
|
case asset['key']
|
||||||
|
when 'avatar'
|
||||||
|
wow_character_media.avatar = asset['value']
|
||||||
|
when 'inset'
|
||||||
|
wow_character_media.inset = asset['value']
|
||||||
|
when 'main'
|
||||||
|
wow_character_media.main = asset['value']
|
||||||
|
when 'main-raw'
|
||||||
|
wow_character_media.main_raw = asset['value']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_character_media.save
|
||||||
|
end
|
||||||
|
end
|
||||||
37
app/workers/wow_character_title_detail_worker.rb
Normal file
37
app/workers/wow_character_title_detail_worker.rb
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
class WowCharacterTitleDetailWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform(title_id)
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
return unless (title = WowCharacterTitle.where(title_id: title_id).first)
|
||||||
|
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::Title.find(title_id)
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) do
|
||||||
|
title.male_name = result.gender_name.male[locale[1]]
|
||||||
|
title.female_name = result.gender_name.female[locale[1]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
title.save
|
||||||
|
end
|
||||||
|
end
|
||||||
42
app/workers/wow_character_titles_worker.rb
Normal file
42
app/workers/wow_character_titles_worker.rb
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
class WowCharacterTitlesWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::Title.all
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
result.titles.each do |title|
|
||||||
|
wow_title = WowCharacterTitle.where(title_id: title.id).first_or_initialize
|
||||||
|
|
||||||
|
wow_title.title_id = title.id
|
||||||
|
wow_title.href = title.key.href
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_title.name = title.name[locale[1]] }
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_title.save
|
||||||
|
|
||||||
|
WowCharacterTitleDetailWorker.perform_async(wow_title.title_id) if wow_title.persisted?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
60
app/workers/wow_characters_worker.rb
Normal file
60
app/workers/wow_characters_worker.rb
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
class WowCharactersWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform(user_id)
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
# Update the WoW character list
|
||||||
|
return unless (user = User.find(user_id))
|
||||||
|
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::Profile::User.find(user.token)
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
result.wow_accounts.each do |account|
|
||||||
|
account.characters.each do |character|
|
||||||
|
wow_char = user.wow_characters.where(character_id: character.id).first_or_initialize
|
||||||
|
|
||||||
|
wow_char.name = character.name
|
||||||
|
wow_char.gender = character.gender.type
|
||||||
|
wow_char.faction = character.faction.type
|
||||||
|
wow_char.href = character.character.href
|
||||||
|
wow_char.level = character.level
|
||||||
|
wow_char.wow_realm = WowRealm.where(realm_id: character.realm.id).first
|
||||||
|
wow_char.wow_class = WowClass.where(class_id: character.playable_class.id).first
|
||||||
|
wow_char.wow_race = WowRace.where(race_id: character.playable_race.id).first
|
||||||
|
wow_char.user = user
|
||||||
|
wow_char.account_id = account.id
|
||||||
|
wow_char.character_id = character.id
|
||||||
|
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) do
|
||||||
|
wow_char.translated_faction = character.faction.name[locale[1]]
|
||||||
|
wow_char.translated_gender = character.gender.name[locale[1]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_char.save
|
||||||
|
|
||||||
|
if wow_char.persisted?
|
||||||
|
WowCharacterMediaWorker.perform_async(wow_char.character_id)
|
||||||
|
WowCharacterDetailWorker.perform_async(wow_char.character_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
38
app/workers/wow_class_detail_worker.rb
Normal file
38
app/workers/wow_class_detail_worker.rb
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
class WowClassDetailWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform(class_id)
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
return unless (wow_class = WowClass.where(class_id: class_id).first)
|
||||||
|
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::PlayableClass.find(class_id)
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) do
|
||||||
|
wow_class.power_type = result.power_type.name[locale[1]]
|
||||||
|
wow_class.male_name = result.gender_name.male[locale[1]]
|
||||||
|
wow_class.female_name = result.gender_name.female[locale[1]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_class.save
|
||||||
|
end
|
||||||
|
end
|
||||||
42
app/workers/wow_classes_worker.rb
Normal file
42
app/workers/wow_classes_worker.rb
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
class WowClassesWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::PlayableClass.all
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
result.classes.each do |playable_class|
|
||||||
|
wow_class = WowClass.where(class_id: playable_class.id).first_or_initialize
|
||||||
|
|
||||||
|
wow_class.class_id = playable_class.id
|
||||||
|
wow_class.href = playable_class.key.href
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_class.name = playable_class.name[locale[1]] }
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_class.save
|
||||||
|
|
||||||
|
WowClassDetailWorker.perform_async(wow_class.class_id) if wow_class.persisted?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
42
app/workers/wow_race_detail_worker.rb
Normal file
42
app/workers/wow_race_detail_worker.rb
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
class WowRaceDetailWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform(race_id)
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
return unless (race = WowRace.where(race_id: race_id).first)
|
||||||
|
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::PlayableRace.find(race_id)
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
race.faction = result.faction.type
|
||||||
|
race.is_selectable = result.is_selectable
|
||||||
|
race.is_allied_race = result.is_allied_race
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) do
|
||||||
|
race.translated_faction = result.faction.name[locale[1]]
|
||||||
|
race.male_name = result.gender_name.male[locale[1]]
|
||||||
|
race.female_name = result.gender_name.female[locale[1]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
race.save
|
||||||
|
end
|
||||||
|
end
|
||||||
43
app/workers/wow_races_worker.rb
Normal file
43
app/workers/wow_races_worker.rb
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
class WowRacesWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::PlayableRace.all
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
result.races.each do |playable_race|
|
||||||
|
wow_race = WowRace.where(race_id: playable_race.id).first_or_initialize
|
||||||
|
|
||||||
|
# Global data
|
||||||
|
wow_race.race_id = playable_race.id
|
||||||
|
wow_race.href = playable_race.key.href
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_race.name = playable_race.name[locale[1]] }
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_race.save
|
||||||
|
|
||||||
|
WowRaceDetailWorker.perform_async(wow_race.race_id) if wow_race.persisted?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
41
app/workers/wow_realm_detail_worker.rb
Normal file
41
app/workers/wow_realm_detail_worker.rb
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
class WowRealmDetailWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform(realm_id)
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
return unless (realm = WowRealm.where(realm_id: realm_id).first)
|
||||||
|
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::Realm.find(realm_id)
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
realm.locale = result.locale
|
||||||
|
realm.timezone = result.timezone
|
||||||
|
realm.is_tournament = result.is_tournament
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) do
|
||||||
|
realm.realm_type = result.type.name[locale[1]]
|
||||||
|
realm.category = result.category[locale[1]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
realm.save
|
||||||
|
end
|
||||||
|
end
|
||||||
43
app/workers/wow_realms_worker.rb
Normal file
43
app/workers/wow_realms_worker.rb
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
class WowRealmsWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
def perform
|
||||||
|
locales = [
|
||||||
|
['en-us', 'en_US'],
|
||||||
|
['es-mx', 'es_MX'],
|
||||||
|
['pt-br', 'pt_BR'],
|
||||||
|
['de-de', 'de_DE'],
|
||||||
|
['en-gb', 'en_GB'],
|
||||||
|
['es-es', 'es_ES'],
|
||||||
|
['fr-fr', 'fr_FR'],
|
||||||
|
['it', 'it_IT'],
|
||||||
|
['ru-ru', 'ru_RU'],
|
||||||
|
['ko', 'ko_KR'],
|
||||||
|
['zh-tw', 'zh_TW'],
|
||||||
|
['zh-cn', 'zh_CN']
|
||||||
|
]
|
||||||
|
|
||||||
|
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||||
|
RBattlenet.set_options(locale: 'all')
|
||||||
|
result = RBattlenet::Wow::Realm.all
|
||||||
|
|
||||||
|
return unless result.status_code == 200
|
||||||
|
|
||||||
|
result.realms.each do |realm|
|
||||||
|
wow_realm = WowRealm.where(realm_id: realm.id).first_or_initialize
|
||||||
|
|
||||||
|
wow_realm.realm_id = realm.id
|
||||||
|
wow_realm.slug = realm.slug
|
||||||
|
wow_realm.href = realm.key.href
|
||||||
|
|
||||||
|
# Localisation data
|
||||||
|
locales.each do |locale|
|
||||||
|
Mobility.with_locale(locale[0]) { wow_realm.name = realm.name[locale[1]] }
|
||||||
|
end
|
||||||
|
|
||||||
|
wow_realm.save
|
||||||
|
|
||||||
|
WowRealmDetailWorker.perform_async(wow_realm.realm_id) if wow_realm.persisted?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
70
babel.config.js
Normal file
70
babel.config.js
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
module.exports = function(api) {
|
||||||
|
var validEnv = ['development', 'test', 'production']
|
||||||
|
var currentEnv = api.env()
|
||||||
|
var isDevelopmentEnv = api.env('development')
|
||||||
|
var isProductionEnv = api.env('production')
|
||||||
|
var isTestEnv = api.env('test')
|
||||||
|
|
||||||
|
if (!validEnv.includes(currentEnv)) {
|
||||||
|
throw new Error(
|
||||||
|
'Please specify a valid `NODE_ENV` or ' +
|
||||||
|
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
||||||
|
'"test", and "production". Instead, received: ' +
|
||||||
|
JSON.stringify(currentEnv) +
|
||||||
|
'.'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
presets: [
|
||||||
|
isTestEnv && [
|
||||||
|
'@babel/preset-env',
|
||||||
|
{
|
||||||
|
targets: {
|
||||||
|
node: 'current'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
(isProductionEnv || isDevelopmentEnv) && [
|
||||||
|
'@babel/preset-env',
|
||||||
|
{
|
||||||
|
forceAllTransforms: true,
|
||||||
|
useBuiltIns: 'entry',
|
||||||
|
corejs: 3,
|
||||||
|
modules: false,
|
||||||
|
exclude: ['transform-typeof-symbol']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
].filter(Boolean),
|
||||||
|
plugins: [
|
||||||
|
'babel-plugin-macros',
|
||||||
|
'@babel/plugin-syntax-dynamic-import',
|
||||||
|
isTestEnv && 'babel-plugin-dynamic-import-node',
|
||||||
|
'@babel/plugin-transform-destructuring',
|
||||||
|
[
|
||||||
|
'@babel/plugin-proposal-class-properties',
|
||||||
|
{
|
||||||
|
loose: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'@babel/plugin-proposal-object-rest-spread',
|
||||||
|
{
|
||||||
|
useBuiltIns: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'@babel/plugin-transform-runtime',
|
||||||
|
{
|
||||||
|
helpers: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'@babel/plugin-transform-regenerator',
|
||||||
|
{
|
||||||
|
async: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
].filter(Boolean)
|
||||||
|
}
|
||||||
|
}
|
||||||
114
bin/bundle
Executable file
114
bin/bundle
Executable file
@@ -0,0 +1,114 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'bundle' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
|
||||||
|
m = Module.new do
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def invoked_as_script?
|
||||||
|
File.expand_path($0) == File.expand_path(__FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def env_var_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`
|
||||||
|
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
|
||||||
|
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
||||||
|
bundler_version = $1
|
||||||
|
update_index = i
|
||||||
|
end
|
||||||
|
bundler_version
|
||||||
|
end
|
||||||
|
|
||||||
|
def gemfile
|
||||||
|
gemfile = ENV["BUNDLE_GEMFILE"]
|
||||||
|
return gemfile if gemfile && !gemfile.empty?
|
||||||
|
|
||||||
|
File.expand_path("../../Gemfile", __FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def lockfile
|
||||||
|
lockfile =
|
||||||
|
case File.basename(gemfile)
|
||||||
|
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
||||||
|
else "#{gemfile}.lock"
|
||||||
|
end
|
||||||
|
File.expand_path(lockfile)
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
def bundler_requirement
|
||||||
|
return "#{Gem::Requirement.default}.a" unless bundler_version
|
||||||
|
|
||||||
|
bundler_gem_version = Gem::Version.new(bundler_version)
|
||||||
|
|
||||||
|
requirement = bundler_gem_version.approximate_recommendation
|
||||||
|
|
||||||
|
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
||||||
|
|
||||||
|
requirement += ".a" if bundler_gem_version.prerelease?
|
||||||
|
|
||||||
|
requirement
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_bundler!
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
||||||
|
|
||||||
|
activate_bundler
|
||||||
|
end
|
||||||
|
|
||||||
|
def activate_bundler
|
||||||
|
gem_error = activation_error_handling do
|
||||||
|
gem "bundler", bundler_requirement
|
||||||
|
end
|
||||||
|
return if gem_error.nil?
|
||||||
|
require_error = activation_error_handling do
|
||||||
|
require "bundler/version"
|
||||||
|
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
|
||||||
|
|
||||||
|
def activation_error_handling
|
||||||
|
yield
|
||||||
|
nil
|
||||||
|
rescue StandardError, LoadError => e
|
||||||
|
e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
m.load_bundler!
|
||||||
|
|
||||||
|
if m.invoked_as_script?
|
||||||
|
load Gem.bin_path("bundler", "bundle")
|
||||||
|
end
|
||||||
5
bin/rails
Executable file
5
bin/rails
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
load File.expand_path("spring", __dir__)
|
||||||
|
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||||
|
require_relative "../config/boot"
|
||||||
|
require "rails/commands"
|
||||||
5
bin/rake
Executable file
5
bin/rake
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
load File.expand_path("spring", __dir__)
|
||||||
|
require_relative "../config/boot"
|
||||||
|
require "rake"
|
||||||
|
Rake.application.run
|
||||||
36
bin/setup
Executable file
36
bin/setup
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require "fileutils"
|
||||||
|
|
||||||
|
# path to your application root.
|
||||||
|
APP_ROOT = File.expand_path('..', __dir__)
|
||||||
|
|
||||||
|
def system!(*args)
|
||||||
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
|
end
|
||||||
|
|
||||||
|
FileUtils.chdir APP_ROOT do
|
||||||
|
# This script is a way to set up or update your development environment automatically.
|
||||||
|
# This script is idempotent, so that you can run it at any time 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
|
||||||
|
system! 'bin/yarn'
|
||||||
|
|
||||||
|
# puts "\n== Copying sample files =="
|
||||||
|
# unless File.exist?('config/database.yml')
|
||||||
|
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
||||||
|
# end
|
||||||
|
|
||||||
|
puts "\n== Preparing database =="
|
||||||
|
system! 'bin/rails db:prepare'
|
||||||
|
|
||||||
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
|
system! 'bin/rails log:clear tmp:clear'
|
||||||
|
|
||||||
|
puts "\n== Restarting application server =="
|
||||||
|
system! 'bin/rails restart'
|
||||||
|
end
|
||||||
14
bin/spring
Executable file
14
bin/spring
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
|
||||||
|
gem "bundler"
|
||||||
|
require "bundler"
|
||||||
|
|
||||||
|
# Load Spring without loading other gems in the Gemfile, for speed.
|
||||||
|
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"
|
||||||
|
rescue Gem::LoadError
|
||||||
|
# Ignore when Spring is not installed.
|
||||||
|
end
|
||||||
|
end
|
||||||
18
bin/webpack
Executable file
18
bin/webpack
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
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 "bundler/setup"
|
||||||
|
|
||||||
|
require "webpacker"
|
||||||
|
require "webpacker/webpack_runner"
|
||||||
|
|
||||||
|
APP_ROOT = File.expand_path("..", __dir__)
|
||||||
|
Dir.chdir(APP_ROOT) do
|
||||||
|
Webpacker::WebpackRunner.run(ARGV)
|
||||||
|
end
|
||||||
18
bin/webpack-dev-server
Executable file
18
bin/webpack-dev-server
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
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 "bundler/setup"
|
||||||
|
|
||||||
|
require "webpacker"
|
||||||
|
require "webpacker/dev_server_runner"
|
||||||
|
|
||||||
|
APP_ROOT = File.expand_path("..", __dir__)
|
||||||
|
Dir.chdir(APP_ROOT) do
|
||||||
|
Webpacker::DevServerRunner.run(ARGV)
|
||||||
|
end
|
||||||
17
bin/yarn
Executable file
17
bin/yarn
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_ROOT = File.expand_path('..', __dir__)
|
||||||
|
Dir.chdir(APP_ROOT) do
|
||||||
|
yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
|
||||||
|
select { |dir| File.expand_path(dir) != __dir__ }.
|
||||||
|
product(["yarn", "yarn.cmd", "yarn.ps1"]).
|
||||||
|
map { |dir, file| File.expand_path(file, dir) }.
|
||||||
|
find { |file| File.executable?(file) }
|
||||||
|
|
||||||
|
if yarn
|
||||||
|
exec yarn, *ARGV
|
||||||
|
else
|
||||||
|
$stderr.puts "Yarn executable was not detected in the system."
|
||||||
|
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
end
|
||||||
6
config.ru
Normal file
6
config.ru
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
|
require_relative "config/environment"
|
||||||
|
|
||||||
|
run Rails.application
|
||||||
|
Rails.application.load_server
|
||||||
27
config/application.rb
Normal file
27
config/application.rb
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require_relative "boot"
|
||||||
|
|
||||||
|
require "rails/all"
|
||||||
|
|
||||||
|
# Require the gems listed in Gemfile, including any gems
|
||||||
|
# you've limited to :test, :development, or :production.
|
||||||
|
Bundler.require(*Rails.groups)
|
||||||
|
|
||||||
|
module Northwhale2
|
||||||
|
class Application < Rails::Application
|
||||||
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
|
config.load_defaults 6.1
|
||||||
|
|
||||||
|
# Configuration for the application, engines, and railties goes here.
|
||||||
|
#
|
||||||
|
# These settings can be overridden in specific environments using the files
|
||||||
|
# in config/environments, which are processed later.
|
||||||
|
#
|
||||||
|
# config.time_zone = "Central Time (US & Canada)"
|
||||||
|
# config.eager_load_paths << Rails.root.join("extras")
|
||||||
|
config.autoload_paths << "#{Rails.root}/app/workers"
|
||||||
|
config.i18n.default_locale = 'en-gb'
|
||||||
|
config.i18n.available_locales = ['de-de', 'en-gb', 'en-us', 'es-mx', 'pt-br', 'es-es', 'fr-fr', 'it', 'ru-ru', 'ko', 'zh-tw', 'zh-cn']
|
||||||
|
end
|
||||||
|
end
|
||||||
4
config/boot.rb
Normal file
4
config/boot.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
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.
|
||||||
10
config/cable.yml
Normal file
10
config/cable.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
development:
|
||||||
|
adapter: async
|
||||||
|
|
||||||
|
test:
|
||||||
|
adapter: test
|
||||||
|
|
||||||
|
production:
|
||||||
|
adapter: redis
|
||||||
|
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||||
|
channel_prefix: northwhale2_production
|
||||||
1
config/credentials.yml.enc
Normal file
1
config/credentials.yml.enc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
zxST0mW+h2ep644oEtPW0li2XRu4gFs7akDyTORXoaKnj9Ht4b5xbQHFeKlJnJo1Xz/FlfQo9UEIrxp/yfwo70xqbF64+r6Epn0DvXfTnn9vV0UM/gAVY374ETC7unvVB+5+oeMTsV58lV79qHlH3a+ecCpn4Xfs1vEdVoaFDjieS+DWo+/CeORMCgBfBudvNCzdx1Z1RPRGs1gqYDlBlZudjKxx+t1UFrzFSShBZkjTVR/EJc08tGEoFtkHkXezXtY7hvhciuu9o6WZZaumDGvhsynRNHhxsBJ6Iu6ibW+lY8hi905AWUR6DN462CBLRFfwhnPw2m5dPZxGKbCpeqra9cnsvyVBeRzuPJKDQS/GJpanllO12U5HbaVIt897azp/8PKg9Zt9oFRrkXF0GyOEdIGwXkfLDUTo--cjnlVLB34AUyNCme--7F7OxrK7aJIw4GcSsjWeXQ==
|
||||||
87
config/database.yml
Normal file
87
config/database.yml
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# PostgreSQL. Versions 9.3 and up are supported.
|
||||||
|
#
|
||||||
|
# Install the pg driver:
|
||||||
|
# gem install pg
|
||||||
|
# On macOS with Homebrew:
|
||||||
|
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
||||||
|
# On macOS with MacPorts:
|
||||||
|
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
||||||
|
# On Windows:
|
||||||
|
# gem install pg
|
||||||
|
# Choose the win32 build.
|
||||||
|
# Install PostgreSQL and put its /bin directory on your path.
|
||||||
|
#
|
||||||
|
# Configure Using Gemfile
|
||||||
|
# gem 'pg'
|
||||||
|
#
|
||||||
|
default: &default
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
# For details on connection pooling, see Rails configuration guide
|
||||||
|
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
||||||
|
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||||
|
username: <%= ENV['DATABASE_URL'] %>
|
||||||
|
password: <%= ENV['DATABASE_URL'] %>
|
||||||
|
host: <%= ENV['DATABASE_URL'] %>
|
||||||
|
port: <%= ENV['DATABASE_URL'] %>
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *default
|
||||||
|
database: northwhale2_development
|
||||||
|
|
||||||
|
# The specified database role being used to connect to postgres.
|
||||||
|
# To create additional roles in postgres see `$ createuser --help`.
|
||||||
|
# When left blank, postgres will use the default role. This is
|
||||||
|
# the same name as the operating system user running Rails.
|
||||||
|
# username: northwhale
|
||||||
|
|
||||||
|
# The password associated with the postgres role (username).
|
||||||
|
# password: northwhale,123
|
||||||
|
|
||||||
|
# Connect on a TCP socket. Omitted by default since the client uses a
|
||||||
|
# domain socket that doesn't need configuration. Windows does not have
|
||||||
|
# domain sockets, so uncomment these lines.
|
||||||
|
# host: localhost
|
||||||
|
|
||||||
|
# The TCP port the server listens on. Defaults to 5432.
|
||||||
|
# If your server runs on a different port number, change accordingly.
|
||||||
|
# port: 5432
|
||||||
|
|
||||||
|
# Schema search path. The server defaults to $user,public
|
||||||
|
#schema_search_path: myapp,sharedapp,public
|
||||||
|
|
||||||
|
# Minimum log levels, in increasing order:
|
||||||
|
# debug5, debug4, debug3, debug2, debug1,
|
||||||
|
# log, notice, warning, error, fatal, and panic
|
||||||
|
# Defaults to warning.
|
||||||
|
#min_messages: notice
|
||||||
|
|
||||||
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
# re-generated from your development database when you run "rake".
|
||||||
|
# Do not set this db to the same as development or production.
|
||||||
|
test:
|
||||||
|
<<: *default
|
||||||
|
database: northwhale2_test
|
||||||
|
|
||||||
|
# As with config/credentials.yml, you never want to store sensitive information,
|
||||||
|
# like your database password, in your source code. If your source code is
|
||||||
|
# ever seen by anyone, they now have access to your database.
|
||||||
|
#
|
||||||
|
# Instead, provide the password or a full connection URL as an environment
|
||||||
|
# variable when you boot the app. For example:
|
||||||
|
#
|
||||||
|
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
||||||
|
#
|
||||||
|
# If the connection URL is provided in the special DATABASE_URL environment
|
||||||
|
# variable, Rails will automatically merge its configuration values on top of
|
||||||
|
# the values provided in this file. Alternatively, you can specify a connection
|
||||||
|
# URL environment variable explicitly:
|
||||||
|
#
|
||||||
|
# production:
|
||||||
|
# url: <%= ENV['MY_APP_DATABASE_URL'] %>
|
||||||
|
#
|
||||||
|
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
||||||
|
# for a full overview on how database connection configuration can be specified.
|
||||||
|
#
|
||||||
|
production:
|
||||||
|
url: <%= ENV['DATABASE_URL'] %>
|
||||||
5
config/environment.rb
Normal file
5
config/environment.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Load the Rails application.
|
||||||
|
require_relative "application"
|
||||||
|
|
||||||
|
# Initialize the Rails application.
|
||||||
|
Rails.application.initialize!
|
||||||
79
config/environments/development.rb
Normal file
79
config/environments/development.rb
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
require "active_support/core_ext/integer/time"
|
||||||
|
|
||||||
|
Rails.application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# In the development environment your application's code is reloaded any time
|
||||||
|
# it changes. This slows down response time but is perfect for development
|
||||||
|
# since you don't have to restart the web server when you make code changes.
|
||||||
|
config.cache_classes = false
|
||||||
|
|
||||||
|
# Do not eager load code on boot.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
|
# Show full error reports.
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
|
||||||
|
# Enable/disable caching. By default caching is disabled.
|
||||||
|
# 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.to_i}"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
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.perform_caching = false
|
||||||
|
|
||||||
|
# Print deprecation notices to the Rails logger.
|
||||||
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
# Raise exceptions for disallowed deprecations.
|
||||||
|
config.active_support.disallowed_deprecation = :raise
|
||||||
|
|
||||||
|
# Tell Active Support which deprecation messages to disallow.
|
||||||
|
config.active_support.disallowed_deprecation_warnings = []
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
config.assets.debug = true
|
||||||
|
|
||||||
|
# Suppress logger output for asset requests.
|
||||||
|
config.assets.quiet = true
|
||||||
|
|
||||||
|
# Raises error for missing translations.
|
||||||
|
config.i18n.raise_on_missing_translations = false
|
||||||
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
|
# Annotate rendered view with file names.
|
||||||
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||||
|
|
||||||
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||||
|
# routes, locales, etc. This feature depends on the listen gem.
|
||||||
|
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||||
|
|
||||||
|
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
||||||
|
|
||||||
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||||
|
# config.action_cable.disable_request_forgery_protection = true
|
||||||
|
end
|
||||||
120
config/environments/production.rb
Normal file
120
config/environments/production.rb
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
require "active_support/core_ext/integer/time"
|
||||||
|
|
||||||
|
Rails.application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# Code is not reloaded between requests.
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Eager load code on boot. This eager loads most of Rails and
|
||||||
|
# your application in memory, allowing both threaded web servers
|
||||||
|
# and those relying on copy on write to perform better.
|
||||||
|
# Rake tasks automatically ignore this option for performance.
|
||||||
|
config.eager_load = true
|
||||||
|
|
||||||
|
# Full error reports are disabled and caching is turned on.
|
||||||
|
config.consider_all_requests_local = false
|
||||||
|
config.action_controller.perform_caching = 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 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
|
||||||
|
|
||||||
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
|
# config.asset_host = 'http://assets.example.com'
|
||||||
|
|
||||||
|
# Specifies the header that your server uses for sending files.
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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', /http:\/\/example.*/ ]
|
||||||
|
|
||||||
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
|
# config.force_ssl = true
|
||||||
|
|
||||||
|
# Include generic and useful information about system operation, but avoid logging too much
|
||||||
|
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
||||||
|
config.log_level = :info
|
||||||
|
|
||||||
|
# Prepend all log lines with the following tags.
|
||||||
|
config.log_tags = [ :request_id ]
|
||||||
|
|
||||||
|
# Use a different cache store in production.
|
||||||
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
# 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 = "northwhale2_production"
|
||||||
|
|
||||||
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
|
# config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# 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 = true
|
||||||
|
|
||||||
|
# Send deprecation notices to registered listeners.
|
||||||
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
|
# Log disallowed deprecations.
|
||||||
|
config.active_support.disallowed_deprecation = :log
|
||||||
|
|
||||||
|
# Tell Active Support which deprecation messages to disallow.
|
||||||
|
config.active_support.disallowed_deprecation_warnings = []
|
||||||
|
|
||||||
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
|
# Use a different logger for distributed setups.
|
||||||
|
# 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)
|
||||||
|
logger.formatter = config.log_formatter
|
||||||
|
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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
|
||||||
60
config/environments/test.rb
Normal file
60
config/environments/test.rb
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
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
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
config.cache_classes = false
|
||||||
|
config.action_view.cache_template_loading = true
|
||||||
|
|
||||||
|
# Do not eager load code on boot. This avoids loading your whole application
|
||||||
|
# just for the purpose of running a single test. If you are using a tool that
|
||||||
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
|
# 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.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.
|
||||||
|
# The :test delivery method accumulates sent emails in the
|
||||||
|
# ActionMailer::Base.deliveries array.
|
||||||
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
|
# Print deprecation notices to the stderr.
|
||||||
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
# Raise exceptions for disallowed deprecations.
|
||||||
|
config.active_support.disallowed_deprecation = :raise
|
||||||
|
|
||||||
|
# Tell Active Support which deprecation messages to disallow.
|
||||||
|
config.active_support.disallowed_deprecation_warnings = []
|
||||||
|
|
||||||
|
# Raises error for missing translations.
|
||||||
|
# config.i18n.raise_on_missing_translations = true
|
||||||
|
|
||||||
|
# Annotate rendered view with file names.
|
||||||
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||||
|
end
|
||||||
8
config/initializers/application_controller_renderer.rb
Normal file
8
config/initializers/application_controller_renderer.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# ActiveSupport::Reloader.to_prepare do
|
||||||
|
# ApplicationController.renderer.defaults.merge!(
|
||||||
|
# http_host: 'example.org',
|
||||||
|
# https: false
|
||||||
|
# )
|
||||||
|
# end
|
||||||
14
config/initializers/assets.rb
Normal file
14
config/initializers/assets.rb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# 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.
|
||||||
|
Rails.application.config.assets.version = '1.0'
|
||||||
|
|
||||||
|
# Add additional assets to the asset load path.
|
||||||
|
# Rails.application.config.assets.paths << Emoji.images_path
|
||||||
|
# Add Yarn node_modules folder to the asset load path.
|
||||||
|
Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
||||||
|
|
||||||
|
# Precompile additional assets.
|
||||||
|
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||||
|
# folder are already added.
|
||||||
|
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
||||||
8
config/initializers/backtrace_silencers.rb
Normal file
8
config/initializers/backtrace_silencers.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# 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.
|
||||||
|
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
|
||||||
|
|
||||||
|
# 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"]
|
||||||
30
config/initializers/content_security_policy.rb
Normal file
30
config/initializers/content_security_policy.rb
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# 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
|
||||||
|
# # If you are using webpack-dev-server then specify webpack-dev-server host
|
||||||
|
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
|
||||||
|
|
||||||
|
# # 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) }
|
||||||
|
|
||||||
|
# Set the nonce only to specific directives
|
||||||
|
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
|
||||||
|
|
||||||
|
# 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
|
||||||
5
config/initializers/cookies_serializer.rb
Normal file
5
config/initializers/cookies_serializer.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Specify a serializer for the signed and encrypted cookie jars.
|
||||||
|
# Valid options are :json, :marshal, and :hybrid.
|
||||||
|
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||||
316
config/initializers/devise.rb
Normal file
316
config/initializers/devise.rb
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Assuming you have not yet modified this file, each configuration option below
|
||||||
|
# is set to its default value. Note that some are commented out while others
|
||||||
|
# are not: uncommented lines are intended to protect your configuration from
|
||||||
|
# breaking changes in upgrades (i.e., in the event that future versions of
|
||||||
|
# Devise change the default values for those options).
|
||||||
|
#
|
||||||
|
# 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 = ENV['DEVISE_SECRET_KEY']
|
||||||
|
|
||||||
|
# ==> Controller configuration
|
||||||
|
# Configure the parent class to the devise controllers.
|
||||||
|
# config.parent_controller = 'DeviseController'
|
||||||
|
|
||||||
|
# ==> Mailer Configuration
|
||||||
|
# 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 = 'noreply@northwhale.com'
|
||||||
|
|
||||||
|
# Configure the class responsible to send e-mails.
|
||||||
|
# config.mailer = 'Devise::Mailer'
|
||||||
|
|
||||||
|
# Configure the parent class responsible to send e-mails.
|
||||||
|
# config.parent_mailer = 'ActionMailer::Base'
|
||||||
|
|
||||||
|
# ==> ORM configuration
|
||||||
|
# Load and configure the ORM. Supports :active_record (default) and
|
||||||
|
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||||
|
# available as additional gems.
|
||||||
|
require 'devise/orm/active_record'
|
||||||
|
|
||||||
|
# ==> Configuration for any authentication mechanism
|
||||||
|
# Configure which keys are used when authenticating a user. The default is
|
||||||
|
# just :email. You can configure it to use [:username, :subdomain], so for
|
||||||
|
# authenticating a user, both parameters are required. Remember that those
|
||||||
|
# parameters are used only when authenticating and not when retrieving from
|
||||||
|
# session. If you need permissions, you should implement that in a before filter.
|
||||||
|
# You can also supply a hash where the value is a boolean determining whether
|
||||||
|
# or not authentication should be aborted when the value is not present.
|
||||||
|
config.authentication_keys = [:battletag]
|
||||||
|
|
||||||
|
# Configure parameters from the request object used for authentication. Each entry
|
||||||
|
# given should be a request method and it will automatically be passed to the
|
||||||
|
# find_for_authentication method and considered in your model lookup. For instance,
|
||||||
|
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
||||||
|
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
||||||
|
# config.request_keys = []
|
||||||
|
|
||||||
|
# Configure which authentication keys should be case-insensitive.
|
||||||
|
# These keys will be downcased upon creating or modifying a user and when used
|
||||||
|
# to authenticate or find a user. Default is :email.
|
||||||
|
config.case_insensitive_keys = [:email]
|
||||||
|
|
||||||
|
# Configure which authentication keys should have whitespace stripped.
|
||||||
|
# These keys will have whitespace before and after removed upon creating or
|
||||||
|
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||||
|
config.strip_whitespace_keys = [:email]
|
||||||
|
|
||||||
|
# Tell if authentication through request.params is enabled. True by default.
|
||||||
|
# It can be set to an array that will enable params authentication only for the
|
||||||
|
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
||||||
|
# enable it only for database (email + password) authentication.
|
||||||
|
# config.params_authenticatable = true
|
||||||
|
|
||||||
|
# Tell if authentication through HTTP Auth is enabled. False by default.
|
||||||
|
# It can be set to an array that will enable http authentication only for the
|
||||||
|
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
||||||
|
# enable it only for database authentication.
|
||||||
|
# For API-only applications to support authentication "out-of-the-box", you will likely want to
|
||||||
|
# enable this with :database unless you are using a custom strategy.
|
||||||
|
# The supported strategies are:
|
||||||
|
# :database = Support basic authentication with authentication key + password
|
||||||
|
# config.http_authenticatable = false
|
||||||
|
|
||||||
|
# If 401 status code should be returned for AJAX requests. True by default.
|
||||||
|
# config.http_authenticatable_on_xhr = true
|
||||||
|
|
||||||
|
# The realm used in Http Basic Authentication. 'Application' by default.
|
||||||
|
# config.http_authentication_realm = 'Application'
|
||||||
|
|
||||||
|
# It will change confirmation, password recovery and other workflows
|
||||||
|
# to behave the same regardless if the e-mail provided was right or wrong.
|
||||||
|
# Does not affect registerable.
|
||||||
|
# config.paranoid = true
|
||||||
|
|
||||||
|
# By default Devise will store the user in session. You can skip storage for
|
||||||
|
# particular strategies by setting this option.
|
||||||
|
# Notice that if you are skipping storage for all authentication paths, you
|
||||||
|
# may want to disable generating routes to Devise's sessions controller by
|
||||||
|
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
||||||
|
config.skip_session_storage = [:http_auth]
|
||||||
|
|
||||||
|
# By default, Devise cleans up the CSRF token on authentication to
|
||||||
|
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
||||||
|
# requests for sign in and sign up, you need to get a new CSRF token
|
||||||
|
# from the server. You can disable this option at your own risk.
|
||||||
|
# config.clean_up_csrf_token_on_authentication = true
|
||||||
|
|
||||||
|
# When false, Devise will not attempt to reload routes on eager load.
|
||||||
|
# This can reduce the time taken to boot the app but if your application
|
||||||
|
# requires the Devise mappings to be loaded during boot time the application
|
||||||
|
# won't boot properly.
|
||||||
|
# config.reload_routes = true
|
||||||
|
|
||||||
|
# ==> Configuration for :database_authenticatable
|
||||||
|
# For bcrypt, this is the cost for hashing the password and defaults to 12. If
|
||||||
|
# using other algorithms, it sets how many times you want the password to be hashed.
|
||||||
|
# The number of stretches used for generating the hashed password are stored
|
||||||
|
# with the hashed password. This allows you to change the stretches without
|
||||||
|
# invalidating existing passwords.
|
||||||
|
#
|
||||||
|
# Limiting the stretches to just one in testing will increase the performance of
|
||||||
|
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
||||||
|
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
||||||
|
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
||||||
|
# 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 = 'c8434599148d8e341b1a2e9cfd9aba1fd0acb14823ad13e1c99965fc3f29435e36515764fb5751e9707da8125014fd68e6d9cad7f77f17d7f7fcf091ae3960cb'
|
||||||
|
|
||||||
|
# Send a notification to the original email when the user's email is changed.
|
||||||
|
# config.send_email_changed_notification = false
|
||||||
|
|
||||||
|
# Send a notification email when the user's password is changed.
|
||||||
|
# config.send_password_change_notification = false
|
||||||
|
|
||||||
|
# ==> Configuration for :confirmable
|
||||||
|
# A period that the user is allowed to access the website even without
|
||||||
|
# confirming their account. For instance, if set to 2.days, the user will be
|
||||||
|
# able to access the website for two days without confirming their account,
|
||||||
|
# access will be blocked just in the third day.
|
||||||
|
# You can also set it to nil, which will allow the user to access the website
|
||||||
|
# without confirming their account.
|
||||||
|
# Default is 0.days, meaning the user cannot access the website without
|
||||||
|
# confirming their account.
|
||||||
|
# config.allow_unconfirmed_access_for = 2.days
|
||||||
|
|
||||||
|
# A period that the user is allowed to confirm their account before their
|
||||||
|
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
||||||
|
# their account within 3 days after the mail was sent, but on the fourth day
|
||||||
|
# their account can't be confirmed with the token any more.
|
||||||
|
# Default is nil, meaning there is no restriction on how long a user can take
|
||||||
|
# before confirming their account.
|
||||||
|
# config.confirm_within = 3.days
|
||||||
|
|
||||||
|
# If true, requires any email changes to be confirmed (exactly the same way as
|
||||||
|
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||||
|
# db field (see migrations). Until confirmed, new email is stored in
|
||||||
|
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||||
|
config.reconfirmable = true
|
||||||
|
|
||||||
|
# Defines which key will be used when confirming an account
|
||||||
|
# config.confirmation_keys = [:email]
|
||||||
|
|
||||||
|
# ==> Configuration for :rememberable
|
||||||
|
# The time the user will be remembered without asking for credentials again.
|
||||||
|
# config.remember_for = 2.weeks
|
||||||
|
|
||||||
|
# Invalidates all the remember me tokens when the user signs out.
|
||||||
|
config.expire_all_remember_me_on_sign_out = true
|
||||||
|
|
||||||
|
# If true, extends the user's remember period when remembered via cookie.
|
||||||
|
# config.extend_remember_period = false
|
||||||
|
|
||||||
|
# Options to be passed to the created cookie. For instance, you can set
|
||||||
|
# secure: true in order to force SSL only cookies.
|
||||||
|
# config.rememberable_options = {}
|
||||||
|
|
||||||
|
# ==> Configuration for :validatable
|
||||||
|
# Range for password length.
|
||||||
|
config.password_length = 6..128
|
||||||
|
|
||||||
|
# Email regex used to validate email formats. It simply asserts that
|
||||||
|
# one (and only one) @ exists in the given string. This is mainly
|
||||||
|
# to give user feedback and not to assert the e-mail validity.
|
||||||
|
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
||||||
|
|
||||||
|
# ==> Configuration for :timeoutable
|
||||||
|
# The time you want to timeout the user session without activity. After this
|
||||||
|
# time the user will be asked for credentials again. Default is 30 minutes.
|
||||||
|
# config.timeout_in = 30.minutes
|
||||||
|
|
||||||
|
# ==> Configuration for :lockable
|
||||||
|
# Defines which strategy will be used to lock an account.
|
||||||
|
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
||||||
|
# :none = No lock strategy. You should handle locking by yourself.
|
||||||
|
# config.lock_strategy = :failed_attempts
|
||||||
|
|
||||||
|
# Defines which key will be used when locking and unlocking an account
|
||||||
|
# config.unlock_keys = [:email]
|
||||||
|
|
||||||
|
# Defines which strategy will be used to unlock an account.
|
||||||
|
# :email = Sends an unlock link to the user email
|
||||||
|
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
||||||
|
# :both = Enables both strategies
|
||||||
|
# :none = No unlock strategy. You should handle unlocking by yourself.
|
||||||
|
# config.unlock_strategy = :both
|
||||||
|
|
||||||
|
# Number of authentication tries before locking an account if lock_strategy
|
||||||
|
# is failed attempts.
|
||||||
|
# config.maximum_attempts = 20
|
||||||
|
|
||||||
|
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
||||||
|
# config.unlock_in = 1.hour
|
||||||
|
|
||||||
|
# Warn on the last attempt before the account is locked.
|
||||||
|
# config.last_attempt_warning = true
|
||||||
|
|
||||||
|
# ==> Configuration for :recoverable
|
||||||
|
#
|
||||||
|
# Defines which key will be used when recovering the password for an account
|
||||||
|
# config.reset_password_keys = [:email]
|
||||||
|
|
||||||
|
# Time interval you can reset your password with a reset password key.
|
||||||
|
# Don't put a too small interval or your users won't have the time to
|
||||||
|
# change their passwords.
|
||||||
|
config.reset_password_within = 6.hours
|
||||||
|
|
||||||
|
# When set to false, does not sign a user in automatically after their password is
|
||||||
|
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
||||||
|
# config.sign_in_after_reset_password = true
|
||||||
|
|
||||||
|
# ==> Configuration for :encryptable
|
||||||
|
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
||||||
|
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
||||||
|
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
||||||
|
# for default behavior) and :restful_authentication_sha1 (then you should set
|
||||||
|
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
||||||
|
#
|
||||||
|
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
||||||
|
# config.encryptor = :sha512
|
||||||
|
|
||||||
|
# ==> Scopes configuration
|
||||||
|
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||||
|
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||||
|
# are using only default views.
|
||||||
|
# config.scoped_views = false
|
||||||
|
|
||||||
|
# Configure the default scope given to Warden. By default it's the first
|
||||||
|
# devise role declared in your routes (usually :user).
|
||||||
|
# config.default_scope = :user
|
||||||
|
|
||||||
|
# Set this configuration to false if you want /users/sign_out to sign out
|
||||||
|
# only the current scope. By default, Devise signs out all scopes.
|
||||||
|
# config.sign_out_all_scopes = true
|
||||||
|
|
||||||
|
# ==> Navigation configuration
|
||||||
|
# Lists the formats that should be treated as navigational. Formats like
|
||||||
|
# :html, should redirect to the sign in page when the user does not have
|
||||||
|
# access, but formats like :xml or :json, should return 401.
|
||||||
|
#
|
||||||
|
# If you have any extra navigational formats, like :iphone or :mobile, you
|
||||||
|
# should add them to the navigational formats lists.
|
||||||
|
#
|
||||||
|
# The "*/*" below is required to match Internet Explorer requests.
|
||||||
|
# config.navigational_formats = ['*/*', :html]
|
||||||
|
|
||||||
|
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||||
|
config.sign_out_via = :delete
|
||||||
|
|
||||||
|
# ==> OmniAuth
|
||||||
|
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||||
|
# up on your models and hooks.
|
||||||
|
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||||
|
config.omniauth :bnet,
|
||||||
|
ENV['BLIZZARD_API_CLIENT_ID'],
|
||||||
|
ENV['BLIZZARD_API_CLIENT_SECRET'],
|
||||||
|
scope: 'wow.profile',
|
||||||
|
region: 'eu'
|
||||||
|
|
||||||
|
# ==> Warden configuration
|
||||||
|
# If you want to use other strategies, that are not supported by Devise, or
|
||||||
|
# change the failure app, you can configure them inside the config.warden block.
|
||||||
|
#
|
||||||
|
# config.warden do |manager|
|
||||||
|
# manager.intercept_401 = false
|
||||||
|
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||||
|
# end
|
||||||
|
|
||||||
|
# ==> Mountable engine configurations
|
||||||
|
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
||||||
|
# is mountable, there are some extra configurations to be taken into account.
|
||||||
|
# The following options are available, assuming the engine is mounted as:
|
||||||
|
#
|
||||||
|
# mount MyEngine, at: '/my_engine'
|
||||||
|
#
|
||||||
|
# The router that invoked `devise_for`, in the example above, would be:
|
||||||
|
# config.router_name = :my_engine
|
||||||
|
#
|
||||||
|
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
||||||
|
# so you need to do it manually. For the users scope, it would be:
|
||||||
|
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
||||||
|
|
||||||
|
# ==> Turbolinks configuration
|
||||||
|
# If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
|
||||||
|
#
|
||||||
|
# ActiveSupport.on_load(:devise_failure_app) do
|
||||||
|
# include Turbolinks::Controller
|
||||||
|
# end
|
||||||
|
|
||||||
|
# ==> Configuration for :registerable
|
||||||
|
|
||||||
|
# When set to false, does not sign a user in automatically after their password is
|
||||||
|
# changed. Defaults to true, so a user is signed in automatically after changing a password.
|
||||||
|
# config.sign_in_after_change_password = true
|
||||||
|
end
|
||||||
6
config/initializers/filter_parameter_logging.rb
Normal file
6
config/initializers/filter_parameter_logging.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# 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
|
||||||
|
]
|
||||||
16
config/initializers/inflections.rb
Normal file
16
config/initializers/inflections.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new inflection rules using the following format. Inflections
|
||||||
|
# are locale specific, and you may define rules for as many different
|
||||||
|
# locales as you wish. All of these examples are active by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.plural /^(ox)$/i, '\1en'
|
||||||
|
# inflect.singular /^(ox)en/i, '\1'
|
||||||
|
# inflect.irregular 'person', 'people'
|
||||||
|
# inflect.uncountable %w( fish sheep )
|
||||||
|
# end
|
||||||
|
|
||||||
|
# These inflection rules are supported but not enabled by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.acronym 'RESTful'
|
||||||
|
# end
|
||||||
6
config/initializers/lograge.rb
Normal file
6
config/initializers/lograge.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
Rails.application.configure do
|
||||||
|
config.lograge.enabled = true
|
||||||
|
config.lograge.formatter = Lograge::Formatters::KeyValue.new
|
||||||
|
end
|
||||||
4
config/initializers/mime_types.rb
Normal file
4
config/initializers/mime_types.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new mime types for use in respond_to blocks:
|
||||||
|
# Mime::Type.register "text/richtext", :rtf
|
||||||
116
config/initializers/mobility.rb
Normal file
116
config/initializers/mobility.rb
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
Mobility.configure do
|
||||||
|
# PLUGINS
|
||||||
|
plugins do
|
||||||
|
# Backend
|
||||||
|
#
|
||||||
|
# Sets the default backend to use in models. This can be overridden in models
|
||||||
|
# by passing +backend: ...+ to +translates+.
|
||||||
|
#
|
||||||
|
# To default to a different backend globally, replace +:key_value+ by another
|
||||||
|
# backend name.
|
||||||
|
#
|
||||||
|
backend :jsonb
|
||||||
|
|
||||||
|
# ActiveRecord
|
||||||
|
#
|
||||||
|
# Defines ActiveRecord as ORM, and enables ActiveRecord-specific plugins.
|
||||||
|
active_record
|
||||||
|
|
||||||
|
# Accessors
|
||||||
|
#
|
||||||
|
# Define reader and writer methods for translated attributes. Remove either
|
||||||
|
# to disable globally, or pass +reader: false+ or +writer: false+ to
|
||||||
|
# +translates+ in any translated model.
|
||||||
|
#
|
||||||
|
reader
|
||||||
|
writer
|
||||||
|
|
||||||
|
# Backend Reader
|
||||||
|
#
|
||||||
|
# Defines reader to access the backend for any attribute, of the form
|
||||||
|
# +<attribute>_backend+.
|
||||||
|
#
|
||||||
|
backend_reader
|
||||||
|
#
|
||||||
|
# Or pass an interpolation string to define a different pattern:
|
||||||
|
# backend_reader "%s_translations"
|
||||||
|
|
||||||
|
# Query
|
||||||
|
#
|
||||||
|
# Defines a scope on the model class which allows querying on
|
||||||
|
# translated attributes. The default scope is named +i18n+, pass a different
|
||||||
|
# name as default to change the global default, or to +translates+ in any
|
||||||
|
# model to change it for that model alone.
|
||||||
|
#
|
||||||
|
query
|
||||||
|
|
||||||
|
# Cache
|
||||||
|
#
|
||||||
|
# Comment out to disable caching reads and writes.
|
||||||
|
#
|
||||||
|
cache
|
||||||
|
|
||||||
|
# Dirty
|
||||||
|
#
|
||||||
|
# Uncomment this line to include and enable globally:
|
||||||
|
# dirty
|
||||||
|
#
|
||||||
|
# Or uncomment this line to include but disable by default, and only enable
|
||||||
|
# per model by passing +dirty: true+ to +translates+.
|
||||||
|
# dirty false
|
||||||
|
|
||||||
|
# Fallbacks
|
||||||
|
#
|
||||||
|
# Uncomment line below to enable fallbacks, using +I18n.fallbacks+.
|
||||||
|
# fallbacks
|
||||||
|
#
|
||||||
|
# Or uncomment this line to enable fallbacks with a global default.
|
||||||
|
# fallbacks { :pt => :en }
|
||||||
|
|
||||||
|
# Presence
|
||||||
|
#
|
||||||
|
# Converts blank strings to nil on reads and writes. Comment out to
|
||||||
|
# disable.
|
||||||
|
#
|
||||||
|
presence
|
||||||
|
|
||||||
|
# Default
|
||||||
|
#
|
||||||
|
# Set a default translation per attributes. When enabled, passing +default:
|
||||||
|
# 'foo'+ sets a default translation string to show in case no translation is
|
||||||
|
# present. Can also be passed a proc.
|
||||||
|
#
|
||||||
|
# default 'foo'
|
||||||
|
|
||||||
|
# Fallthrough Accessors
|
||||||
|
#
|
||||||
|
# Uses method_missing to define locale-specific accessor methods like
|
||||||
|
# +title_en+, +title_en=+, +title_fr+, +title_fr=+ for each translated
|
||||||
|
# attribute. If you know what set of locales you want to support, it's
|
||||||
|
# generally better to use Locale Accessors (or both together) since
|
||||||
|
# +method_missing+ is very slow. (You can use both fallthrough and locale
|
||||||
|
# accessor plugins together without conflict.)
|
||||||
|
#
|
||||||
|
# fallthrough_accessors
|
||||||
|
|
||||||
|
# Locale Accessors
|
||||||
|
#
|
||||||
|
# Uses +def+ to define accessor methods for a set of locales. By default uses
|
||||||
|
# +I18n.available_locales+, but you can pass the set of locales with
|
||||||
|
# +translates+ and/or set a global default here.
|
||||||
|
#
|
||||||
|
# locale_accessors
|
||||||
|
#
|
||||||
|
# Or define specific defaults by uncommenting line below
|
||||||
|
# locale_accessors [:en, :ja]
|
||||||
|
|
||||||
|
# Attribute Methods
|
||||||
|
#
|
||||||
|
# Adds translated attributes to +attributes+ hash, and defines methods
|
||||||
|
# +translated_attributes+ and +untranslated_attributes+ which return hashes
|
||||||
|
# with translated and untranslated attributes, respectively. Be aware that
|
||||||
|
# this plugin can create conflicts with other gems.
|
||||||
|
#
|
||||||
|
# attribute_methods
|
||||||
|
end
|
||||||
|
end
|
||||||
11
config/initializers/permissions_policy.rb
Normal file
11
config/initializers/permissions_policy.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Define an application-wide HTTP permissions policy. For further
|
||||||
|
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
||||||
|
#
|
||||||
|
# Rails.application.config.permissions_policy do |f|
|
||||||
|
# f.camera :none
|
||||||
|
# f.gyroscope :none
|
||||||
|
# f.microphone :none
|
||||||
|
# f.usb :none
|
||||||
|
# f.fullscreen :self
|
||||||
|
# f.payment :self, "https://secure.example.com"
|
||||||
|
# end
|
||||||
1
config/initializers/sidekiq.rb
Normal file
1
config/initializers/sidekiq.rb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Redis.exists_returns_integer = true
|
||||||
14
config/initializers/wrap_parameters.rb
Normal file
14
config/initializers/wrap_parameters.rb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# This file contains settings for ActionController::ParamsWrapper which
|
||||||
|
# is enabled by default.
|
||||||
|
|
||||||
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
|
ActiveSupport.on_load(:action_controller) do
|
||||||
|
wrap_parameters format: [:json]
|
||||||
|
end
|
||||||
|
|
||||||
|
# To enable root element in JSON for ActiveRecord objects.
|
||||||
|
# ActiveSupport.on_load(:active_record) do
|
||||||
|
# self.include_root_in_json = true
|
||||||
|
# end
|
||||||
65
config/locales/devise.en.yml
Normal file
65
config/locales/devise.en.yml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# Additional translations at https://github.com/heartcombo/devise/wiki/I18n
|
||||||
|
|
||||||
|
en:
|
||||||
|
devise:
|
||||||
|
confirmations:
|
||||||
|
confirmed: "Your email address has been successfully confirmed."
|
||||||
|
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||||
|
failure:
|
||||||
|
already_authenticated: "You are already signed in."
|
||||||
|
inactive: "Your account is not activated yet."
|
||||||
|
invalid: "Invalid %{authentication_keys} or password."
|
||||||
|
locked: "Your account is locked."
|
||||||
|
last_attempt: "You have one more attempt before your account is locked."
|
||||||
|
not_found_in_database: "Invalid %{authentication_keys} or password."
|
||||||
|
timeout: "Your session expired. Please sign in again to continue."
|
||||||
|
unauthenticated: "You need to sign in or sign up before continuing."
|
||||||
|
unconfirmed: "You have to confirm your email address before continuing."
|
||||||
|
mailer:
|
||||||
|
confirmation_instructions:
|
||||||
|
subject: "Confirmation instructions"
|
||||||
|
reset_password_instructions:
|
||||||
|
subject: "Reset password instructions"
|
||||||
|
unlock_instructions:
|
||||||
|
subject: "Unlock instructions"
|
||||||
|
email_changed:
|
||||||
|
subject: "Email Changed"
|
||||||
|
password_change:
|
||||||
|
subject: "Password Changed"
|
||||||
|
omniauth_callbacks:
|
||||||
|
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
||||||
|
success: "Successfully authenticated from %{kind} account."
|
||||||
|
passwords:
|
||||||
|
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
||||||
|
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||||
|
updated: "Your password has been changed successfully. You are now signed in."
|
||||||
|
updated_not_active: "Your password has been changed successfully."
|
||||||
|
registrations:
|
||||||
|
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
||||||
|
signed_up: "Welcome! You have signed up successfully."
|
||||||
|
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
||||||
|
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
||||||
|
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
||||||
|
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
|
||||||
|
updated: "Your account has been updated successfully."
|
||||||
|
updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
|
||||||
|
sessions:
|
||||||
|
signed_in: "Signed in successfully."
|
||||||
|
signed_out: "Signed out successfully."
|
||||||
|
already_signed_out: "Signed out successfully."
|
||||||
|
unlocks:
|
||||||
|
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
||||||
|
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
||||||
|
errors:
|
||||||
|
messages:
|
||||||
|
already_confirmed: "was already confirmed, please try signing in"
|
||||||
|
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
||||||
|
expired: "has expired, please request a new one"
|
||||||
|
not_found: "not found"
|
||||||
|
not_locked: "was not locked"
|
||||||
|
not_saved:
|
||||||
|
one: "1 error prohibited this %{resource} from being saved:"
|
||||||
|
other: "%{count} errors prohibited this %{resource} from being saved:"
|
||||||
33
config/locales/en.yml
Normal file
33
config/locales/en.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# 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:
|
||||||
|
hello: "Hello world"
|
||||||
43
config/puma.rb
Normal file
43
config/puma.rb
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# 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 }
|
||||||
|
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"
|
||||||
|
|
||||||
|
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||||
|
#
|
||||||
|
port ENV.fetch("PORT") { 3000 }
|
||||||
|
|
||||||
|
# Specifies the `environment` that Puma will run in.
|
||||||
|
#
|
||||||
|
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 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).
|
||||||
|
#
|
||||||
|
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# preload_app!
|
||||||
|
|
||||||
|
# Allow puma to be restarted by `rails restart` command.
|
||||||
|
plugin :tmp_restart
|
||||||
12
config/routes.rb
Normal file
12
config/routes.rb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
require 'sidekiq/web'
|
||||||
|
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
get 'home/index'
|
||||||
|
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
|
||||||
|
devise_scope :user do
|
||||||
|
get 'sign_in', :to => 'devise/sessions#new', :as => :new_user_session
|
||||||
|
delete 'sign_out', :to => 'devise/sessions#destroy', :as => :destroy_user_session
|
||||||
|
end
|
||||||
|
root to: "home#index"
|
||||||
|
mount Sidekiq::Web => '/sidekiq'
|
||||||
|
end
|
||||||
2
config/sidekiq.yml
Normal file
2
config/sidekiq.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
:concurrency: 5
|
||||||
6
config/spring.rb
Normal file
6
config/spring.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Spring.watch(
|
||||||
|
".ruby-version",
|
||||||
|
".rbenv-vars",
|
||||||
|
"tmp/restart.txt",
|
||||||
|
"tmp/caching-dev.txt"
|
||||||
|
)
|
||||||
34
config/storage.yml
Normal file
34
config/storage.yml
Normal 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 ]
|
||||||
5
config/webpack/development.js
Normal file
5
config/webpack/development.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||||
|
|
||||||
|
const environment = require('./environment')
|
||||||
|
|
||||||
|
module.exports = environment.toWebpackConfig()
|
||||||
11
config/webpack/environment.js
Normal file
11
config/webpack/environment.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const { environment } = require('@rails/webpacker')
|
||||||
|
const webpack = require("webpack")
|
||||||
|
|
||||||
|
environment.plugins.append("Provide", new webpack.ProvidePlugin({
|
||||||
|
$: 'jquery',
|
||||||
|
jQuery: 'jquery',
|
||||||
|
'window.jQuery': 'jquery',
|
||||||
|
Popper: ['popper.js', 'default']
|
||||||
|
}))
|
||||||
|
|
||||||
|
module.exports = environment
|
||||||
5
config/webpack/production.js
Normal file
5
config/webpack/production.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
||||||
|
|
||||||
|
const environment = require('./environment')
|
||||||
|
|
||||||
|
module.exports = environment.toWebpackConfig()
|
||||||
5
config/webpack/test.js
Normal file
5
config/webpack/test.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||||
|
|
||||||
|
const environment = require('./environment')
|
||||||
|
|
||||||
|
module.exports = environment.toWebpackConfig()
|
||||||
92
config/webpacker.yml
Normal file
92
config/webpacker.yml
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
||||||
|
|
||||||
|
default: &default
|
||||||
|
source_path: app/javascript
|
||||||
|
source_entry_path: packs
|
||||||
|
public_root_path: public
|
||||||
|
public_output_path: packs
|
||||||
|
cache_path: tmp/cache/webpacker
|
||||||
|
webpack_compile_output: true
|
||||||
|
|
||||||
|
# Additional paths webpack should lookup modules
|
||||||
|
# ['app/assets', 'engine/foo/app/assets']
|
||||||
|
additional_paths: []
|
||||||
|
|
||||||
|
# Reload manifest.json on all requests so we reload latest compiled packs
|
||||||
|
cache_manifest: false
|
||||||
|
|
||||||
|
# Extract and emit a css file
|
||||||
|
extract_css: false
|
||||||
|
|
||||||
|
static_assets_extensions:
|
||||||
|
- .jpg
|
||||||
|
- .jpeg
|
||||||
|
- .png
|
||||||
|
- .gif
|
||||||
|
- .tiff
|
||||||
|
- .ico
|
||||||
|
- .svg
|
||||||
|
- .eot
|
||||||
|
- .otf
|
||||||
|
- .ttf
|
||||||
|
- .woff
|
||||||
|
- .woff2
|
||||||
|
|
||||||
|
extensions:
|
||||||
|
- .mjs
|
||||||
|
- .js
|
||||||
|
- .sass
|
||||||
|
- .scss
|
||||||
|
- .css
|
||||||
|
- .module.sass
|
||||||
|
- .module.scss
|
||||||
|
- .module.css
|
||||||
|
- .png
|
||||||
|
- .svg
|
||||||
|
- .gif
|
||||||
|
- .jpeg
|
||||||
|
- .jpg
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *default
|
||||||
|
compile: true
|
||||||
|
|
||||||
|
# Reference: https://webpack.js.org/configuration/dev-server/
|
||||||
|
dev_server:
|
||||||
|
https: false
|
||||||
|
host: localhost
|
||||||
|
port: 3035
|
||||||
|
public: localhost:3035
|
||||||
|
hmr: false
|
||||||
|
# Inline should be set to true if using HMR
|
||||||
|
inline: true
|
||||||
|
overlay: true
|
||||||
|
compress: true
|
||||||
|
disable_host_check: true
|
||||||
|
use_local_ip: false
|
||||||
|
quiet: false
|
||||||
|
pretty: false
|
||||||
|
headers:
|
||||||
|
'Access-Control-Allow-Origin': '*'
|
||||||
|
watch_options:
|
||||||
|
ignored: '**/node_modules/**'
|
||||||
|
|
||||||
|
|
||||||
|
test:
|
||||||
|
<<: *default
|
||||||
|
compile: true
|
||||||
|
|
||||||
|
# Compile test packs to a separate directory
|
||||||
|
public_output_path: packs-test
|
||||||
|
|
||||||
|
production:
|
||||||
|
<<: *default
|
||||||
|
|
||||||
|
# Production depends on precompilation of packs prior to booting for performance.
|
||||||
|
compile: false
|
||||||
|
|
||||||
|
# Extract and emit a css file
|
||||||
|
extract_css: true
|
||||||
|
|
||||||
|
# Cache manifest.json for performance
|
||||||
|
cache_manifest: true
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user