├── log └── .keep ├── storage └── .keep ├── tmp ├── .keep └── pids │ └── .keep ├── vendor └── .keep ├── .rubocop_todo.yml ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── public ├── favicon.ico ├── apple-touch-icon.png ├── apple-touch-icon-precomposed.png ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── app ├── assets │ ├── images │ │ └── .keep │ ├── config │ │ └── manifest.js │ ├── stylesheets │ │ ├── homepage.scss │ │ └── application.css │ └── javascripts │ │ └── application.js ├── models │ ├── concerns │ │ └── .keep │ └── application_record.rb ├── controllers │ ├── concerns │ │ └── .keep │ ├── application_controller.rb │ └── homepage_controller.rb ├── views │ ├── homepage │ │ └── index.html.erb │ └── layouts │ │ ├── mailer.text.erb │ │ ├── mailer.html.erb │ │ └── application.html.erb ├── helpers │ ├── homepage_helper.rb │ └── application_helper.rb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── mailers │ └── application_mailer.rb ├── javascript │ ├── components │ │ ├── App.jsx │ │ └── Home.jsx │ ├── channels │ │ ├── index.js │ │ └── consumer.js │ ├── routes │ │ └── Index.jsx │ └── packs │ │ ├── Index.jsx │ │ └── application.js └── jobs │ └── application_job.rb ├── .browserslistrc ├── .tool-versions ├── .prettierrc.yml ├── config ├── spring.rb ├── webpack │ ├── environment.js │ ├── test.js │ ├── production.js │ └── development.js ├── environment.rb ├── routes.rb ├── initializers │ ├── mime_types.rb │ ├── application_controller_renderer.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── permissions_policy.rb │ ├── wrap_parameters.rb │ ├── backtrace_silencers.rb │ ├── assets.rb │ ├── inflections.rb │ └── content_security_policy.rb ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── locales │ └── en.yml ├── storage.yml ├── application.rb ├── puma.rb ├── webpacker.yml ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb └── database.yml ├── bin ├── rake ├── rails ├── spring ├── webpack ├── webpack-dev-server ├── yarn ├── setup └── bundle ├── config.ru ├── Rakefile ├── postcss.config.js ├── .gitattributes ├── db └── seeds.rb ├── tsconfig.json ├── README.md ├── package.json ├── .gitignore ├── babel.config.js ├── .eslintrc.js ├── Gemfile ├── .rubocop.yml └── Gemfile.lock /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rubocop_todo.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/pids/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/homepage/index.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | ruby 2.7.2 2 | nodejs 14.15.1 3 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/helpers/homepage_helper.rb: -------------------------------------------------------------------------------- 1 | module HomepageHelper; end 2 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper; end 2 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base; end 2 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | rubySingleQuote: false 2 | trailingComma: "es5" 3 | rubyToProc: true 4 | printWidth: 120 5 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | Spring.watch(".ruby-version", ".rbenv-vars", "tmp/restart.txt", "tmp/caching-dev.txt") 2 | -------------------------------------------------------------------------------- /app/controllers/homepage_controller.rb: -------------------------------------------------------------------------------- 1 | class HomepageController < ApplicationController 2 | def index; end 3 | end 4 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | module.exports = environment 4 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base; end 3 | end 4 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | //= link_directory ../javascripts .js 4 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base; end 3 | end 4 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: "from@example.com" 3 | layout "mailer" 4 | end 5 | -------------------------------------------------------------------------------- /app/javascript/components/App.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Routes from "../routes/Index"; 3 | 4 | export default props => <>{Routes}; 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | load File.expand_path("spring", __dir__) 3 | require_relative "../config/boot" 4 | require "rake" 5 | Rake.application.run 6 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative "application" 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative "config/environment" 4 | 5 | run Rails.application 6 | Rails.application.load_server 7 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | root "homepage#index" 3 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 4 | end 5 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # Add new mime types for use in respond_to blocks: 3 | # Mime::Type.register "text/richtext", :rtf 4 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | load File.expand_path("spring", __dir__) 3 | APP_PATH = File.expand_path('../config/application', __dir__) 4 | require_relative "../config/boot" 5 | require "rails/commands" 6 | -------------------------------------------------------------------------------- /app/assets/stylesheets/homepage.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Homepage controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: https://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) 2 | 3 | require "bundler/setup" # Set up gems listed in the Gemfile. 4 | require "bootsnap/setup" # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative "config/application" 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/javascript/channels/index.js: -------------------------------------------------------------------------------- 1 | // Load all the channels within this directory and all subdirectories. 2 | // Channel files must be named *_channel.js. 3 | 4 | const channels = require.context('.', true, /_channel\.js$/) 5 | channels.keys().forEach(channels) 6 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: react_on_rails_template_production 11 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # ActiveSupport::Reloader.to_prepare do 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | # end 8 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }) 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += %i[passw secret token _key crypt salt certificate otp ssn] 5 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | # Most jobs are safe to ignore if the underlying records are no longer available 5 | # discard_on ActiveJob::DeserializationError 6 | end 7 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/javascript/channels/consumer.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `bin/rails generate channel` command. 3 | 4 | import { createConsumer } from "@rails/actioncable" 5 | 6 | export default createConsumer() 7 | -------------------------------------------------------------------------------- /app/javascript/routes/Index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; 3 | import Home from "../components/Home"; 4 | 5 | export default ( 6 | 7 | 8 | 9 | 10 | 11 | ); 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files. 2 | 3 | # Mark the database schema as having been generated. 4 | db/schema.rb linguist-generated 5 | 6 | # Mark the yarn lockfile as having been generated. 7 | yarn.lock linguist-generated 8 | 9 | # Mark any vendored files as having been vendored. 10 | vendor/* linguist-vendored 11 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) 3 | # Load Spring without loading other gems in the Gemfile, for speed. 4 | require "bundler" 5 | Bundler.locked_gems.specs.find { |spec| spec.name == "spring" }&.tap do |spring| 6 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 7 | gem "spring", spring.version 8 | require "spring/binstub" 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/permissions_policy.rb: -------------------------------------------------------------------------------- 1 | # Define an application-wide HTTP permissions policy. For further 2 | # information see https://developers.google.com/web/updates/2018/06/feature-policy 3 | # 4 | # Rails.application.config.permissions_policy do |f| 5 | # f.camera :none 6 | # f.gyroscope :none 7 | # f.microphone :none 8 | # f.usb :none 9 | # f.fullscreen :self 10 | # f.payment :self, "https://secure.example.com" 11 | # end 12 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | cVVsUXBuWqW8CbYynmZLH8/Zv76XnuzRirgHeqiD1wKzJ0Avsbwh3yKOI+QrwZpG24/zJy0IyfLAQRQaSfj9gYC4OrxT4Qblb3AUZFbEeqRb6AF93GkISB9OduE1hZjUVnL6e48YOVlt/IDFcMQQLrNun8hXV+ZVa05C+g2I6qEuJ5Q9oKbzyBfJomzofP4KYYKGYHgVj8x6ScObD3FjhKvhD9bJ4lmeTBbkBblosRgvaSPUrhPVVaAW57rfhoOTjDauSu9YkI4dWDfnGiPXKJTR9ftEgGwETPxPJmn/xMKrC5BQKIgp6+Ai4Ub4M7NcQFzYGoFhlZCWp92+nyUlBtC1RaOoNTE9yvnncxSU/OyePx5tR9bFXw0KpDvS2/i/cFz2hiWnm9ykXPfJIo7xUk20FA+Gl1hG+ct4--cf3qy310lPulxUM2--32L0ZCh6HkJySuevxTnfPw== -------------------------------------------------------------------------------- /app/javascript/packs/Index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { render } from "react-dom"; 3 | import 'bootstrap/dist/css/bootstrap.min.css'; 4 | import $ from 'jquery'; 5 | import Popper from 'popper.js'; 6 | import 'bootstrap/dist/js/bootstrap.bundle.min'; 7 | import App from "../components/App"; 8 | 9 | document.addEventListener("DOMContentLoaded", () => { 10 | render( 11 | , 12 | document.body.appendChild(document.createElement("div")) 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/webpack_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::WebpackRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/dev_server_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::DevServerRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": false, 4 | "emitDecoratorMetadata": true, 5 | "experimentalDecorators": true, 6 | "lib": ["es6", "dom"], 7 | "module": "es6", 8 | "moduleResolution": "node", 9 | "sourceMap": true, 10 | "target": "es5", 11 | "jsx": "react", 12 | "noEmit": true, 13 | "allowSyntheticDefaultImports": true, 14 | }, 15 | "exclude": [ 16 | "**/*.spec.ts", 17 | "node_modules", 18 | "vendor", 19 | "public" 20 | ], 21 | "compileOnSave": false 22 | } 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React on Rails Template 2 | 3 | ## Prerequisites 4 | - Postgres 5 | - Ruby 2.7.2 6 | - Rails 6.1 7 | 8 | ## Installation (Local) 9 | - `bundle install` 10 | - `rake db:create` 11 | - `rake db:migrate` 12 | - `rake db:seed` 13 | - `bundle exec rails webpacker:install` 14 | - `yarn install` 15 | - `rails s` 16 | 17 | ## Heroku Deployment 18 | Application is hosted on Heroku. 19 | 20 | ## Notes 21 | - Deployments that require database migrations must run `heroku run rake db:migrate -a app-name` where app-name is the name of the application on Heroku. 22 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) { wrap_parameters format: [:json] } 8 | 9 | # To enable root element in JSON for ActiveRecord objects. 10 | # ActiveSupport.on_load(:active_record) do 11 | # self.include_root_in_json = true 12 | # end 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rails_react_recipe", 3 | "private": true, 4 | "dependencies": { 5 | "@babel/preset-react": "^7.0.0", 6 | "@rails/webpacker": "^4.0.2", 7 | "babel-plugin-transform-react-remove-prop-types": "^0.4.24", 8 | "bootstrap": "^4.3.1", 9 | "jquery": "^3.4.0", 10 | "popper.js": "^1.15.0", 11 | "prop-types": "^15.7.2", 12 | "react": "^16.8.6", 13 | "react-dom": "^16.8.6", 14 | "react-router-dom": "^5.0.0" 15 | }, 16 | "devDependencies": { 17 | "webpack-dev-server": "^3.2.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code 7 | # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". 8 | Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] 9 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | React on Rails Template 5 | 6 | <%= csrf_meta_tags %> 7 | <%= csp_meta_tag %> 8 | 9 | 10 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 11 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 12 | <%= javascript_pack_tag 'Index' %> 13 | 14 | 15 | 16 | <%= yield %> 17 | 18 | 19 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | APP_ROOT = File.expand_path('..', __dir__) 5 | Dir.chdir(APP_ROOT) do 6 | executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path| 7 | normalized_path = File.expand_path(path) 8 | 9 | normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn')) 10 | end 11 | 12 | if executable_path 13 | exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV 14 | else 15 | $stderr.puts "Yarn executable was not detected in the system." 16 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 17 | exit 1 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = "1.0" 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | # Add Yarn node_modules folder to the asset load path. 9 | Rails.application.config.assets.paths << Rails.root.join("node_modules") 10 | 11 | # Precompile additional assets. 12 | # application.js, application.css, and all non-JS/CSS in the app/assets 13 | # folder are already added. 14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 15 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # Add new inflection rules using the following format. Inflections 3 | # are locale specific, and you may define rules for as many different 4 | # locales as you wish. All of these examples are active by default: 5 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # These inflection rules are supported but not enabled by default: 12 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 13 | # inflect.acronym 'RESTful' 14 | # end 15 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/javascript/components/Home.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Link } from "react-router-dom"; 3 | 4 | export default () => ( 5 |
6 |
7 |
8 |

Lorem Ipsum

9 |

10 | Lorem Ipsum is simply dummy text of the printing and typesetting industry. 11 | Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 12 | when an unknown printer took a galley of type and scrambled it to make a type specimen book. 13 |

14 |
15 |
16 |
17 | ); 18 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 5 | // vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require activestorage 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | # Ignore pidfiles, but keep the directory. 17 | /tmp/pids/* 18 | !/tmp/pids/ 19 | !/tmp/pids/.keep 20 | 21 | # Ignore uploaded files in development. 22 | /storage/* 23 | !/storage/.keep 24 | 25 | /public/assets 26 | .byebug_history 27 | 28 | # Ignore master key for decrypting credentials and more. 29 | /config/master.key 30 | 31 | /public/packs 32 | /public/packs-test 33 | /node_modules 34 | /yarn-error.log 35 | yarn-debug.log* 36 | .yarn-integrity 37 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | /* eslint no-console:0 */ 2 | // This file is automatically compiled by Webpack, along with any other files 3 | // present in this directory. You're encouraged to place your actual application logic in 4 | // a relevant structure within app/javascript and only use these pack files to reference 5 | // that code so it'll be compiled. 6 | // 7 | // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate 8 | // layout file, like app/views/layouts/application.html.erb 9 | 10 | 11 | // Uncomment to copy all static images under ../images to the output folder and reference 12 | // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) 13 | // or the `imagePath` JavaScript helper below. 14 | // 15 | // const images = require.context('../images', true) 16 | // const imagePath = (name) => images(name, true) 17 | 18 | console.log('Hello World from Webpacker') 19 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "fileutils" 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path('..', __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to set up or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies 21 | system! 'bin/yarn' 22 | 23 | # puts "\n== Copying sample files ==" 24 | # unless File.exist?('config/database.yml') 25 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' 26 | # end 27 | 28 | puts "\n== Preparing database ==" 29 | system! 'bin/rails db:prepare' 30 | 31 | puts "\n== Removing old logs and tempfiles ==" 32 | system! 'bin/rails log:clear tmp:clear' 33 | 34 | puts "\n== Restarting application server ==" 35 | system! 'bin/rails restart' 36 | end 37 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative "boot" 2 | 3 | require "rails" 4 | 5 | # Pick the frameworks you want: 6 | require "active_model/railtie" 7 | require "active_job/railtie" 8 | require "active_record/railtie" 9 | require "active_storage/engine" 10 | require "action_controller/railtie" 11 | require "action_mailer/railtie" 12 | require "action_mailbox/engine" 13 | require "action_text/engine" 14 | require "action_view/railtie" 15 | require "action_cable/engine" 16 | require "sprockets/railtie" 17 | 18 | # require "rails/test_unit/railtie" 19 | 20 | # Require the gems listed in Gemfile, including any gems 21 | # you've limited to :test, :development, or :production. 22 | Bundler.require(*Rails.groups) 23 | 24 | module ReactOnRailsTemplate 25 | class Application < Rails::Application 26 | # Initialize configuration defaults for originally generated Rails version. 27 | config.load_defaults 6.1 28 | 29 | # Configuration for the application, engines, and railties goes here. 30 | # 31 | # These settings can be overridden in specific environments using the files 32 | # in config/environments, which are processed later. 33 | # 34 | # config.time_zone = "Central Time (US & Canada)" 35 | # config.eager_load_paths << Rails.root.join("extras") 36 | 37 | # Don't generate system test files. 38 | config.generators.system_tests = nil 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # Define an application-wide content security policy 3 | # For further information see the following documentation 4 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 5 | # Rails.application.config.content_security_policy do |policy| 6 | # policy.default_src :self, :https 7 | # policy.font_src :self, :https, :data 8 | # policy.img_src :self, :https, :data 9 | # policy.object_src :none 10 | # policy.script_src :self, :https 11 | # policy.style_src :self, :https 12 | # # If you are using webpack-dev-server then specify webpack-dev-server host 13 | # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? 14 | # # Specify URI for violation reports 15 | # # policy.report_uri "/csp-violation-report-endpoint" 16 | # end 17 | # If you are using UJS then enable automatic nonce generation 18 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 19 | # Set the nonce only to specific directives 20 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) 21 | # Report CSP violations to a specified URI 22 | # For further information see the following documentation: 23 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 24 | # Rails.application.config.content_security_policy_report_only = true 25 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5) 8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `worker_timeout` threshold that Puma will use to wait before 12 | # terminating a worker in development environments. 13 | # 14 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" 15 | 16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 17 | # 18 | port ENV.fetch("PORT", 3000) 19 | 20 | # Specifies the `environment` that Puma will run in. 21 | # 22 | environment ENV.fetch("RAILS_ENV") { "development" } 23 | 24 | # Specifies the `pidfile` that Puma will use. 25 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 26 | 27 | # Specifies the number of `workers` to boot in clustered mode. 28 | # Workers are forked web server processes. If using threads and workers together 29 | # the concurrency of the application would be max `threads` * `workers`. 30 | # Workers do not work on JRuby or Windows (both of which do not support 31 | # processes). 32 | # 33 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 34 | 35 | # Use the `preload_app!` method when specifying a `workers` number. 36 | # This directive tells Puma to first boot the application and load code 37 | # before forking the application. This takes advantage of Copy On Write 38 | # process behavior so workers use less memory. 39 | # 40 | # preload_app! 41 | 42 | # Allow puma to be restarted by `rails restart` command. 43 | plugin :tmp_restart 44 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /config/webpacker.yml: -------------------------------------------------------------------------------- 1 | # Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | default: &default 4 | source_path: app/javascript 5 | source_entry_path: packs 6 | public_root_path: public 7 | public_output_path: packs 8 | cache_path: tmp/cache/webpacker 9 | check_yarn_integrity: false 10 | webpack_compile_output: false 11 | 12 | # Additional paths webpack should lookup modules 13 | # ['app/assets', 'engine/foo/app/assets'] 14 | resolved_paths: [] 15 | 16 | # Reload manifest.json on all requests so we reload latest compiled packs 17 | cache_manifest: false 18 | 19 | # Extract and emit a css file 20 | extract_css: false 21 | 22 | static_assets_extensions: 23 | - .jpg 24 | - .jpeg 25 | - .png 26 | - .gif 27 | - .tiff 28 | - .ico 29 | - .svg 30 | - .eot 31 | - .otf 32 | - .ttf 33 | - .woff 34 | - .woff2 35 | 36 | extensions: 37 | - .jsx 38 | - .mjs 39 | - .js 40 | - .sass 41 | - .scss 42 | - .css 43 | - .module.sass 44 | - .module.scss 45 | - .module.css 46 | - .png 47 | - .svg 48 | - .gif 49 | - .jpeg 50 | - .jpg 51 | 52 | development: 53 | <<: *default 54 | compile: true 55 | 56 | # Verifies that versions and hashed value of the package contents in the project's package.json 57 | check_yarn_integrity: true 58 | 59 | # Reference: https://webpack.js.org/configuration/dev-server/ 60 | dev_server: 61 | https: false 62 | host: localhost 63 | port: 3035 64 | public: localhost:3035 65 | hmr: false 66 | # Inline should be set to true if using HMR 67 | inline: true 68 | overlay: true 69 | compress: true 70 | disable_host_check: true 71 | use_local_ip: false 72 | quiet: false 73 | headers: 74 | 'Access-Control-Allow-Origin': '*' 75 | watch_options: 76 | ignored: '**/node_modules/**' 77 | 78 | 79 | test: 80 | <<: *default 81 | compile: true 82 | 83 | # Compile test packs to a separate directory 84 | public_output_path: packs-test 85 | 86 | production: 87 | <<: *default 88 | 89 | # Production depends on precompilation of packs prior to booting for performance. 90 | compile: false 91 | 92 | # Extract and emit a css file 93 | extract_css: true 94 | 95 | # Cache manifest.json for performance 96 | cache_manifest: true 97 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | var validEnv = ['development', 'test', 'production'] 3 | var currentEnv = api.env() 4 | var isDevelopmentEnv = api.env('development') 5 | var isProductionEnv = api.env('production') 6 | var isTestEnv = api.env('test') 7 | 8 | if (!validEnv.includes(currentEnv)) { 9 | throw new Error( 10 | 'Please specify a valid `NODE_ENV` or ' + 11 | '`BABEL_ENV` environment variables. Valid values are "development", ' + 12 | '"test", and "production". Instead, received: ' + 13 | JSON.stringify(currentEnv) + 14 | '.' 15 | ) 16 | } 17 | 18 | return { 19 | presets: [ 20 | isTestEnv && [ 21 | require('@babel/preset-env').default, 22 | { 23 | targets: { 24 | node: 'current' 25 | } 26 | } 27 | ], 28 | (isProductionEnv || isDevelopmentEnv) && [ 29 | require('@babel/preset-env').default, 30 | { 31 | forceAllTransforms: true, 32 | useBuiltIns: 'entry', 33 | modules: false, 34 | exclude: ['transform-typeof-symbol'] 35 | } 36 | ], 37 | [ 38 | require('@babel/preset-react').default, 39 | { 40 | development: isDevelopmentEnv || isTestEnv, 41 | useBuiltIns: true 42 | } 43 | ] 44 | ].filter(Boolean), 45 | plugins: [ 46 | require('babel-plugin-macros'), 47 | require('@babel/plugin-syntax-dynamic-import').default, 48 | isTestEnv && require('babel-plugin-dynamic-import-node'), 49 | require('@babel/plugin-transform-destructuring').default, 50 | [ 51 | require('@babel/plugin-proposal-class-properties').default, 52 | { 53 | loose: true 54 | } 55 | ], 56 | [ 57 | require('@babel/plugin-proposal-object-rest-spread').default, 58 | { 59 | useBuiltIns: true 60 | } 61 | ], 62 | [ 63 | require('@babel/plugin-transform-runtime').default, 64 | { 65 | helpers: false, 66 | regenerator: true 67 | } 68 | ], 69 | [ 70 | require('@babel/plugin-transform-regenerator').default, 71 | { 72 | async: false 73 | } 74 | ], 75 | isProductionEnv && [ 76 | require('babel-plugin-transform-react-remove-prop-types').default, 77 | { 78 | removeImport: true 79 | } 80 | ] 81 | ].filter(Boolean) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', // Specifies the ESLint parser 3 | parserOptions: { 4 | ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features 5 | sourceType: 'module', // Allows for the use of imports 6 | ecmaFeatures: { 7 | jsx: true, // Allows for the parsing of JSX 8 | }, 9 | }, 10 | settings: { 11 | react: { 12 | version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use 13 | }, 14 | }, 15 | extends: [ 16 | 'react-app', 17 | 'airbnb', 18 | 'plugin:jsx-a11y/recommended', 19 | 'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react 20 | 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin 21 | 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier 22 | 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. 23 | 'plugin:import/typescript', 24 | ], 25 | rules: { 26 | // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs 27 | // e.g. "@typescript-eslint/explicit-function-return-type": "off", 28 | 'react/jsx-wrap-multilines': 'off', // Turn off this rule because it can conflict with prettier 29 | 'react/jsx-curly-newline': 'off', // Turn off this rule because it can conflict with prettier 30 | 'import/no-cycle': 'off', // Turn off so 2 models can import each other 31 | 'react/prop-types': 'off', // No need for prop-types when using typescript 32 | 'lines-between-class-members': 'off', // Turn off unnecessary newlines inside state stores 33 | 'react/jsx-filename-extension': ['warn', { extensions: ['.tsx'] }], // Allow .tsx files to have JSX 34 | 'max-classes-per-file': ['error', 2], // Allow two classes per file for state/store design 35 | 'import/extensions': 'off', // Turn off to skip .tsx/.ts file extensions on imports 36 | 'react/display-name': 'off', // Turn off to allow inline components in DataTable columns definition 37 | 'no-console': 'off', // TODO: Temporarily allow console.log statements while we clean up context menus 38 | camelcase: 'off', // Turn off to allow Rails snake_case variables 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | 8 | Rails.application.configure do 9 | # Settings specified here will take precedence over those in config/application.rb. 10 | 11 | config.cache_classes = false 12 | config.action_view.cache_template_loading = true 13 | 14 | # Do not eager load code on boot. This avoids loading your whole application 15 | # just for the purpose of running a single test. If you are using a tool that 16 | # preloads Rails for running tests, you may have to set it to true. 17 | config.eager_load = false 18 | 19 | # Configure public file server for tests with Cache-Control for performance. 20 | config.public_file_server.enabled = true 21 | config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" } 22 | 23 | # Show full error reports and disable caching. 24 | config.consider_all_requests_local = true 25 | config.action_controller.perform_caching = false 26 | config.cache_store = :null_store 27 | 28 | # Raise exceptions instead of rendering exception templates. 29 | config.action_dispatch.show_exceptions = false 30 | 31 | # Disable request forgery protection in test environment. 32 | config.action_controller.allow_forgery_protection = false 33 | 34 | # Store uploaded files on the local file system in a temporary directory. 35 | config.active_storage.service = :test 36 | 37 | config.action_mailer.perform_caching = false 38 | 39 | # Tell Action Mailer not to deliver emails to the real world. 40 | # The :test delivery method accumulates sent emails in the 41 | # ActionMailer::Base.deliveries array. 42 | config.action_mailer.delivery_method = :test 43 | 44 | # Print deprecation notices to the stderr. 45 | config.active_support.deprecation = :stderr 46 | 47 | # Raise exceptions for disallowed deprecations. 48 | config.active_support.disallowed_deprecation = :raise 49 | 50 | # Tell Active Support which deprecation messages to disallow. 51 | config.active_support.disallowed_deprecation_warnings = [] 52 | 53 | # Raises error for missing translations. 54 | # config.i18n.raise_on_missing_translations = true 55 | 56 | # Annotate rendered view with file names. 57 | # config.action_view.annotate_rendered_view_with_filenames = true 58 | end 59 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded any time 7 | # it changes. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable/disable caching. By default caching is disabled. 18 | # Run rails dev:cache to toggle caching. 19 | if Rails.root.join("tmp", "caching-dev.txt").exist? 20 | config.action_controller.perform_caching = true 21 | config.action_controller.enable_fragment_cache_logging = true 22 | 23 | config.cache_store = :memory_store 24 | config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" } 25 | else 26 | config.action_controller.perform_caching = false 27 | 28 | config.cache_store = :null_store 29 | end 30 | 31 | # Store uploaded files on the local file system (see config/storage.yml for options). 32 | config.active_storage.service = :local 33 | 34 | # Don't care if the mailer can't send. 35 | config.action_mailer.raise_delivery_errors = false 36 | 37 | config.action_mailer.perform_caching = false 38 | 39 | # Print deprecation notices to the Rails logger. 40 | config.active_support.deprecation = :log 41 | 42 | # Raise exceptions for disallowed deprecations. 43 | config.active_support.disallowed_deprecation = :raise 44 | 45 | # Tell Active Support which deprecation messages to disallow. 46 | config.active_support.disallowed_deprecation_warnings = [] 47 | 48 | # Raise an error on page load if there are pending migrations. 49 | config.active_record.migration_error = :page_load 50 | 51 | # Highlight code that triggered database queries in logs. 52 | config.active_record.verbose_query_logs = true 53 | 54 | # Debug mode disables concatenation and preprocessing of assets. 55 | # This option may cause significant delays in view rendering with a large 56 | # number of complex assets. 57 | config.assets.debug = false 58 | 59 | # Suppress logger output for asset requests. 60 | config.assets.quiet = true 61 | 62 | # Raises error for missing translations. 63 | # config.i18n.raise_on_missing_translations = true 64 | 65 | # Annotate rendered view with file names. 66 | # config.action_view.annotate_rendered_view_with_filenames = true 67 | 68 | # Use an evented file watcher to asynchronously detect changes in source code, 69 | # routes, locales, etc. This feature depends on the listen gem. 70 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 71 | 72 | # Uncomment if you wish to allow Action Cable access from any origin. 73 | # config.action_cable.disable_request_forgery_protection = true 74 | end 75 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby "2.7.2" 5 | gem "rails", "~> 6.1.0" 6 | gem "pg", "~> 1.1" # Default gem installation for Rails 6.1 7 | gem "puma", "~> 5.0" # Default gem installation for Rails 6.1 8 | gem "sass-rails", ">= 6" # Default gem installation for Rails 6.1 9 | gem "webpacker", "~> 5.0" # Default gem installation for Rails 6.1 10 | gem "turbolinks", "~> 5" # Default gem installation for Rails 6.1 11 | gem "jbuilder", "~> 2.7" # Default gem installation for Rails 6.1 12 | gem "bootsnap", ">= 1.4.4", require: false # Default gem installation for Rails 6.1 13 | gem "newrelic_rpm" # Performance Monitoring 14 | gem "draper" # Easy decorator setup 15 | 16 | group :development, :test do 17 | gem "bullet" # N+1 query detection 18 | gem "dotenv-rails" # Load environment variables from .env into ENV in development. 19 | gem "pry" # Console Improvements 20 | gem "rb-readline" # Error Logging 21 | gem "rspec-rails", "~> 3.6" # Testing Library 22 | end 23 | 24 | group :development do 25 | gem "web-console", ">= 4.1.0" # Interactive console on exception pages or by calling 'console' 26 | gem "rack-mini-profiler", "~> 2.0" # Default gem installation for Rails 6.1 27 | gem "listen", "~> 3.3" # Default gem installation for Rails 6.1 28 | gem "awesome_print" # Pretty print your Ruby objects with indentation 29 | gem "better_errors" # Interactive console on exception pages 30 | gem "binding_of_caller" # Interactive console on exception pages 31 | gem "prettier" # Linting tool specifically for line length warnings 32 | gem "rubocop" # Style Monitoring 33 | gem "rubocop-performance" # Performance Monitoring 34 | gem "rubocop-rails" # Rails Style Monitoring 35 | gem "rubocop-rspec" # Rspec Style Monitoring 36 | end 37 | 38 | group :test do 39 | gem "capybara", ">= 2.15", "< 4.0", require: false 40 | gem "database_cleaner" # DB resets between tests 41 | gem "email_spec" # Adds email helper methods to RSpec 42 | gem "factory_bot_rails" 43 | gem "launchy" # Easier launch commands 44 | gem "rails-controller-testing" # Rails controller testing 45 | gem "rspec-sidekiq" 46 | gem "selenium-webdriver", require: false 47 | gem "shoulda-matchers" 48 | gem "simplecov", require: false # Test coverage 49 | gem "timecop" # Improve control of time in tests 50 | gem "vcr" # Record http requests for more reliable testing 51 | gem "webdrivers", require: false 52 | gem "webmock" # Test HTTP requests 53 | end 54 | 55 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 56 | gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] 57 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.3 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On macOS with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On macOS with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see Rails configuration guide 21 | # https://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: react_on_rails_template_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user running Rails. 32 | #username: react_on_rails_template 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: react_on_rails_template_test 61 | 62 | # As with config/credentials.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password or a full connection URL as an environment 67 | # variable when you boot the app. For example: 68 | # 69 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 70 | # 71 | # If the connection URL is provided in the special DATABASE_URL environment 72 | # variable, Rails will automatically merge its configuration values on top of 73 | # the values provided in this file. Alternatively, you can specify a connection 74 | # URL environment variable explicitly: 75 | # 76 | # production: 77 | # url: <%= ENV['MY_APP_DATABASE_URL'] %> 78 | # 79 | # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database 80 | # for a full overview on how database connection configuration can be specified. 81 | # 82 | production: 83 | <<: *default 84 | database: react_on_rails_template_production 85 | username: react_on_rails_template 86 | password: <%= ENV['REACT_ON_RAILS_TEMPLATE_DATABASE_PASSWORD'] %> 87 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'bundle' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "rubygems" 12 | 13 | m = Module.new do 14 | module_function 15 | 16 | def invoked_as_script? 17 | File.expand_path($0) == File.expand_path(__FILE__) 18 | end 19 | 20 | def env_var_version 21 | ENV["BUNDLER_VERSION"] 22 | end 23 | 24 | def cli_arg_version 25 | return unless invoked_as_script? # don't want to hijack other binstubs 26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` 27 | bundler_version = nil 28 | update_index = nil 29 | ARGV.each_with_index do |a, i| 30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 31 | bundler_version = a 32 | end 33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 34 | bundler_version = $1 35 | update_index = i 36 | end 37 | bundler_version 38 | end 39 | 40 | def gemfile 41 | gemfile = ENV["BUNDLE_GEMFILE"] 42 | return gemfile if gemfile && !gemfile.empty? 43 | 44 | File.expand_path("../../Gemfile", __FILE__) 45 | end 46 | 47 | def lockfile 48 | lockfile = 49 | case File.basename(gemfile) 50 | when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) 51 | else "#{gemfile}.lock" 52 | end 53 | File.expand_path(lockfile) 54 | end 55 | 56 | def lockfile_version 57 | return unless File.file?(lockfile) 58 | lockfile_contents = File.read(lockfile) 59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 60 | Regexp.last_match(1) 61 | end 62 | 63 | def bundler_version 64 | @bundler_version ||= 65 | env_var_version || cli_arg_version || 66 | lockfile_version 67 | end 68 | 69 | def bundler_requirement 70 | return "#{Gem::Requirement.default}.a" unless bundler_version 71 | 72 | bundler_gem_version = Gem::Version.new(bundler_version) 73 | 74 | requirement = bundler_gem_version.approximate_recommendation 75 | 76 | return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") 77 | 78 | requirement += ".a" if bundler_gem_version.prerelease? 79 | 80 | requirement 81 | end 82 | 83 | def load_bundler! 84 | ENV["BUNDLE_GEMFILE"] ||= gemfile 85 | 86 | activate_bundler 87 | end 88 | 89 | def activate_bundler 90 | gem_error = activation_error_handling do 91 | gem "bundler", bundler_requirement 92 | end 93 | return if gem_error.nil? 94 | require_error = activation_error_handling do 95 | require "bundler/version" 96 | end 97 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 98 | 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}'`" 99 | exit 42 100 | end 101 | 102 | def activation_error_handling 103 | yield 104 | nil 105 | rescue StandardError, LoadError => e 106 | e 107 | end 108 | end 109 | 110 | m.load_bundler! 111 | 112 | if m.invoked_as_script? 113 | load Gem.bin_path("bundler", "bundle") 114 | end 115 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: .rubocop_todo.yml 2 | 3 | require: 4 | - rubocop-performance 5 | - rubocop-rails 6 | - rubocop-rspec 7 | 8 | AllCops: 9 | NewCops: enable 10 | Exclude: 11 | - 'vendor/**/*' 12 | - 'test/fixtures/**/*' 13 | - 'db/**/*' 14 | - 'bin/**/*' 15 | - 'log/**/*' 16 | - 'tmp/**/*' 17 | - 'app/views/**/*' 18 | - 'config/environments/*' 19 | - 'node_modules/**/*' 20 | 21 | # Metrics Cops 22 | 23 | Metrics/ClassLength: 24 | Description: 'Avoid classes longer than 100 lines of code.' 25 | Max: 100 26 | Enabled: true 27 | 28 | Metrics/ModuleLength: 29 | Description: 'Avoid modules longer than 100 lines of code.' 30 | Max: 100 31 | Enabled: true 32 | 33 | Metrics/ParameterLists: 34 | Description: 'Pass no more than four parameters into a method.' 35 | Max: 4 36 | Enabled: true 37 | 38 | Metrics/MethodLength: 39 | Description: 'Avoid methods longer than 5 lines of code.' 40 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods' 41 | Max: 5 42 | Enabled: true 43 | 44 | Metrics/BlockLength: 45 | CountComments: false 46 | Max: 5 47 | IgnoredMethods: 48 | - context 49 | - describe 50 | - it 51 | - shared_examples 52 | - shared_examples_for 53 | - namespace 54 | - draw 55 | - configure 56 | - group 57 | 58 | # Style Cops 59 | 60 | Style/BlockDelimiters: 61 | Exclude: 62 | - 'spec/**/*' 63 | 64 | Style/SymbolArray: 65 | Enabled: false 66 | 67 | Style/ClassAndModuleChildren: 68 | Description: 'Checks style of children classes and modules.' 69 | Enabled: false 70 | EnforcedStyle: nested 71 | 72 | Style/CollectionMethods: 73 | Enabled: true 74 | PreferredMethods: 75 | find: detect 76 | inject: reduce 77 | collect: map 78 | find_all: select 79 | 80 | Style/Documentation: 81 | Description: 'Document classes and non-namespace modules.' 82 | Enabled: false 83 | 84 | Style/FrozenStringLiteralComment: 85 | Description: >- 86 | Add the frozen_string_literal comment to the top of files 87 | to help transition from Ruby 2.3.0 to Ruby 3.0. 88 | Enabled: false 89 | 90 | Style/IfUnlessModifier: 91 | Description: >- 92 | Favor modifier if/unless usage when you have a 93 | single-line body. 94 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier' 95 | Enabled: false 96 | 97 | Style/InlineComment: 98 | Description: 'Avoid inline comments.' 99 | Enabled: false 100 | 101 | Style/LineEndConcatenation: 102 | Description: >- 103 | Use \ instead of + or << to concatenate two string literals at 104 | line end. 105 | Enabled: true 106 | 107 | Style/StringLiterals: 108 | Description: 'Checks if uses of quotes match the configured preference.' 109 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals' 110 | EnforcedStyle: double_quotes 111 | Enabled: true 112 | 113 | Style/TrailingCommaInArguments: 114 | Description: 'Checks for trailing comma in argument lists.' 115 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas' 116 | EnforcedStyleForMultiline: comma 117 | SupportedStylesForMultiline: 118 | - comma 119 | - consistent_comma 120 | - no_comma 121 | Enabled: true 122 | 123 | Style/TrailingCommaInArrayLiteral: 124 | Description: 'Checks for trailing comma in array literals.' 125 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas' 126 | EnforcedStyleForMultiline: comma 127 | SupportedStylesForMultiline: 128 | - comma 129 | - consistent_comma 130 | - no_comma 131 | Enabled: true 132 | 133 | Style/TrailingCommaInHashLiteral: 134 | Description: 'Checks for trailing comma in hash literals.' 135 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas' 136 | EnforcedStyleForMultiline: comma 137 | SupportedStylesForMultiline: 138 | - comma 139 | - consistent_comma 140 | - no_comma 141 | Enabled: true 142 | 143 | # Layout Cops 144 | 145 | Layout/ArgumentAlignment: 146 | Exclude: 147 | - 'config/initializers/*' 148 | 149 | Layout/FirstArgumentIndentation: 150 | Enabled: false 151 | 152 | Layout/DotPosition: 153 | Description: 'Checks the position of the dot in multi-line method calls.' 154 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains' 155 | Enabled: false 156 | 157 | Layout/LineLength: 158 | Description: 'Limit lines to 120 characters.' 159 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits' 160 | Max: 120 161 | 162 | Layout/MultilineOperationIndentation: 163 | Description: >- 164 | Checks indentation of binary operations that span more than 165 | one line. 166 | Enabled: true 167 | EnforcedStyle: indented 168 | 169 | Layout/MultilineMethodCallIndentation: 170 | Description: >- 171 | Checks indentation of method calls with the dot operator 172 | that span more than one line. 173 | Enabled: true 174 | EnforcedStyle: indented 175 | 176 | # Rails Cops 177 | 178 | Rails/Delegate: 179 | Description: 'Prefer delegate method for delegations.' 180 | Enabled: false 181 | 182 | # Bundler Cops 183 | 184 | Bundler/OrderedGems: 185 | Enabled: false 186 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # Code is not reloaded between requests. 7 | config.cache_classes = true 8 | 9 | # Eager load code on boot. This eager loads most of Rails and 10 | # your application in memory, allowing both threaded web servers 11 | # and those relying on copy on write to perform better. 12 | # Rake tasks automatically ignore this option for performance. 13 | config.eager_load = true 14 | 15 | # Full error reports are disabled and caching is turned on. 16 | config.consider_all_requests_local = false 17 | config.action_controller.perform_caching = true 18 | 19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 21 | # config.require_master_key = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? 26 | 27 | # Compress CSS using a preprocessor. 28 | # config.assets.css_compressor = :sass 29 | 30 | # Do not fallback to assets pipeline if a precompiled asset is missed. 31 | config.assets.compile = false 32 | 33 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 34 | # config.asset_host = 'http://assets.example.com' 35 | 36 | # Specifies the header that your server uses for sending files. 37 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 38 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 39 | 40 | # Store uploaded files on the local file system (see config/storage.yml for options). 41 | config.active_storage.service = :local 42 | 43 | # Mount Action Cable outside main process or domain. 44 | # config.action_cable.mount_path = nil 45 | # config.action_cable.url = 'wss://example.com/cable' 46 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 47 | 48 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 49 | # config.force_ssl = true 50 | 51 | # Include generic and useful information about system operation, but avoid logging too much 52 | # information to avoid inadvertent exposure of personally identifiable information (PII). 53 | config.log_level = :info 54 | 55 | # Prepend all log lines with the following tags. 56 | config.log_tags = [:request_id] 57 | 58 | # Use a different cache store in production. 59 | # config.cache_store = :mem_cache_store 60 | 61 | config.action_mailer.perform_caching = false 62 | 63 | # Ignore bad email addresses and do not raise email delivery errors. 64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 65 | # config.action_mailer.raise_delivery_errors = false 66 | 67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 | # the I18n.default_locale when a translation cannot be found). 69 | config.i18n.fallbacks = true 70 | 71 | # Send deprecation notices to registered listeners. 72 | config.active_support.deprecation = :notify 73 | 74 | # Log disallowed deprecations. 75 | config.active_support.disallowed_deprecation = :log 76 | 77 | # Tell Active Support which deprecation messages to disallow. 78 | config.active_support.disallowed_deprecation_warnings = [] 79 | 80 | # Use default logging formatter so that PID and timestamp are not suppressed. 81 | config.log_formatter = ::Logger::Formatter.new 82 | 83 | # Use a different logger for distributed setups. 84 | # require "syslog/logger" 85 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 86 | 87 | if ENV["RAILS_LOG_TO_STDOUT"].present? 88 | logger = ActiveSupport::Logger.new(STDOUT) 89 | logger.formatter = config.log_formatter 90 | config.logger = ActiveSupport::TaggedLogging.new(logger) 91 | end 92 | 93 | # Do not dump schema after migrations. 94 | config.active_record.dump_schema_after_migration = false 95 | 96 | # Inserts middleware to perform automatic connection switching. 97 | # The `database_selector` hash is used to pass options to the DatabaseSelector 98 | # middleware. The `delay` is used to determine how long to wait after a write 99 | # to send a subsequent read to the primary. 100 | # 101 | # The `database_resolver` class is used by the middleware to determine which 102 | # database is appropriate to use based on the time delay. 103 | # 104 | # The `database_resolver_context` class is used by the middleware to set 105 | # timestamps for the last write to the primary. The resolver uses the context 106 | # class timestamps to determine how long to wait before reading from the 107 | # replica. 108 | # 109 | # By default Rails will store a last write timestamp in the session. The 110 | # DatabaseSelector middleware is designed as such you can define your own 111 | # strategy for connection switching and pass that into the middleware through 112 | # these configuration options. 113 | # config.active_record.database_selector = { delay: 2.seconds } 114 | # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver 115 | # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session 116 | end 117 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (6.1.0) 5 | actionpack (= 6.1.0) 6 | activesupport (= 6.1.0) 7 | nio4r (~> 2.0) 8 | websocket-driver (>= 0.6.1) 9 | actionmailbox (6.1.0) 10 | actionpack (= 6.1.0) 11 | activejob (= 6.1.0) 12 | activerecord (= 6.1.0) 13 | activestorage (= 6.1.0) 14 | activesupport (= 6.1.0) 15 | mail (>= 2.7.1) 16 | actionmailer (6.1.0) 17 | actionpack (= 6.1.0) 18 | actionview (= 6.1.0) 19 | activejob (= 6.1.0) 20 | activesupport (= 6.1.0) 21 | mail (~> 2.5, >= 2.5.4) 22 | rails-dom-testing (~> 2.0) 23 | actionpack (6.1.0) 24 | actionview (= 6.1.0) 25 | activesupport (= 6.1.0) 26 | rack (~> 2.0, >= 2.0.9) 27 | rack-test (>= 0.6.3) 28 | rails-dom-testing (~> 2.0) 29 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 30 | actiontext (6.1.0) 31 | actionpack (= 6.1.0) 32 | activerecord (= 6.1.0) 33 | activestorage (= 6.1.0) 34 | activesupport (= 6.1.0) 35 | nokogiri (>= 1.8.5) 36 | actionview (6.1.0) 37 | activesupport (= 6.1.0) 38 | builder (~> 3.1) 39 | erubi (~> 1.4) 40 | rails-dom-testing (~> 2.0) 41 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 42 | activejob (6.1.0) 43 | activesupport (= 6.1.0) 44 | globalid (>= 0.3.6) 45 | activemodel (6.1.0) 46 | activesupport (= 6.1.0) 47 | activemodel-serializers-xml (1.0.2) 48 | activemodel (> 5.x) 49 | activesupport (> 5.x) 50 | builder (~> 3.1) 51 | activerecord (6.1.0) 52 | activemodel (= 6.1.0) 53 | activesupport (= 6.1.0) 54 | activestorage (6.1.0) 55 | actionpack (= 6.1.0) 56 | activejob (= 6.1.0) 57 | activerecord (= 6.1.0) 58 | activesupport (= 6.1.0) 59 | marcel (~> 0.3.1) 60 | mimemagic (~> 0.3.2) 61 | activesupport (6.1.0) 62 | concurrent-ruby (~> 1.0, >= 1.0.2) 63 | i18n (>= 1.6, < 2) 64 | minitest (>= 5.1) 65 | tzinfo (~> 2.0) 66 | zeitwerk (~> 2.3) 67 | addressable (2.7.0) 68 | public_suffix (>= 2.0.2, < 5.0) 69 | ast (2.4.1) 70 | awesome_print (1.8.0) 71 | better_errors (2.9.1) 72 | coderay (>= 1.0.0) 73 | erubi (>= 1.0.0) 74 | rack (>= 0.9.0) 75 | bindex (0.8.1) 76 | binding_of_caller (0.8.0) 77 | debug_inspector (>= 0.0.1) 78 | bootsnap (1.5.1) 79 | msgpack (~> 1.0) 80 | builder (3.2.4) 81 | bullet (6.1.2) 82 | activesupport (>= 3.0.0) 83 | uniform_notifier (~> 1.11) 84 | capybara (3.34.0) 85 | addressable 86 | mini_mime (>= 0.1.3) 87 | nokogiri (~> 1.8) 88 | rack (>= 1.6.0) 89 | rack-test (>= 0.6.3) 90 | regexp_parser (~> 1.5) 91 | xpath (~> 3.2) 92 | childprocess (3.0.0) 93 | coderay (1.1.3) 94 | concurrent-ruby (1.1.7) 95 | connection_pool (2.2.3) 96 | crack (0.4.4) 97 | crass (1.0.6) 98 | database_cleaner (1.8.5) 99 | debug_inspector (0.0.3) 100 | diff-lcs (1.4.4) 101 | docile (1.3.2) 102 | dotenv (2.7.6) 103 | dotenv-rails (2.7.6) 104 | dotenv (= 2.7.6) 105 | railties (>= 3.2) 106 | draper (4.0.1) 107 | actionpack (>= 5.0) 108 | activemodel (>= 5.0) 109 | activemodel-serializers-xml (>= 1.0) 110 | activesupport (>= 5.0) 111 | request_store (>= 1.0) 112 | email_spec (2.2.0) 113 | htmlentities (~> 4.3.3) 114 | launchy (~> 2.1) 115 | mail (~> 2.7) 116 | erubi (1.10.0) 117 | factory_bot (6.1.0) 118 | activesupport (>= 5.0.0) 119 | factory_bot_rails (6.1.0) 120 | factory_bot (~> 6.1.0) 121 | railties (>= 5.0.0) 122 | ffi (1.13.1) 123 | globalid (0.4.2) 124 | activesupport (>= 4.2.0) 125 | hashdiff (1.0.1) 126 | htmlentities (4.3.4) 127 | i18n (1.8.5) 128 | concurrent-ruby (~> 1.0) 129 | jbuilder (2.10.1) 130 | activesupport (>= 5.0.0) 131 | launchy (2.5.0) 132 | addressable (~> 2.7) 133 | listen (3.3.3) 134 | rb-fsevent (~> 0.10, >= 0.10.3) 135 | rb-inotify (~> 0.9, >= 0.9.10) 136 | loofah (2.8.0) 137 | crass (~> 1.0.2) 138 | nokogiri (>= 1.5.9) 139 | mail (2.7.1) 140 | mini_mime (>= 0.1.1) 141 | marcel (0.3.3) 142 | mimemagic (~> 0.3.2) 143 | method_source (1.0.0) 144 | mimemagic (0.3.5) 145 | mini_mime (1.0.2) 146 | mini_portile2 (2.4.0) 147 | minitest (5.14.2) 148 | msgpack (1.3.3) 149 | newrelic_rpm (6.14.0) 150 | nio4r (2.5.4) 151 | nokogiri (1.10.10) 152 | mini_portile2 (~> 2.4.0) 153 | parallel (1.20.1) 154 | parser (2.7.2.0) 155 | ast (~> 2.4.1) 156 | pg (1.2.3) 157 | prettier (1.0.1) 158 | pry (0.13.1) 159 | coderay (~> 1.1) 160 | method_source (~> 1.0) 161 | public_suffix (4.0.6) 162 | puma (5.1.1) 163 | nio4r (~> 2.0) 164 | rack (2.2.3) 165 | rack-mini-profiler (2.2.0) 166 | rack (>= 1.2.0) 167 | rack-proxy (0.6.5) 168 | rack 169 | rack-test (1.1.0) 170 | rack (>= 1.0, < 3) 171 | rails (6.1.0) 172 | actioncable (= 6.1.0) 173 | actionmailbox (= 6.1.0) 174 | actionmailer (= 6.1.0) 175 | actionpack (= 6.1.0) 176 | actiontext (= 6.1.0) 177 | actionview (= 6.1.0) 178 | activejob (= 6.1.0) 179 | activemodel (= 6.1.0) 180 | activerecord (= 6.1.0) 181 | activestorage (= 6.1.0) 182 | activesupport (= 6.1.0) 183 | bundler (>= 1.15.0) 184 | railties (= 6.1.0) 185 | sprockets-rails (>= 2.0.0) 186 | rails-controller-testing (1.0.5) 187 | actionpack (>= 5.0.1.rc1) 188 | actionview (>= 5.0.1.rc1) 189 | activesupport (>= 5.0.1.rc1) 190 | rails-dom-testing (2.0.3) 191 | activesupport (>= 4.2.0) 192 | nokogiri (>= 1.6) 193 | rails-html-sanitizer (1.3.0) 194 | loofah (~> 2.3) 195 | railties (6.1.0) 196 | actionpack (= 6.1.0) 197 | activesupport (= 6.1.0) 198 | method_source 199 | rake (>= 0.8.7) 200 | thor (~> 1.0) 201 | rainbow (3.0.0) 202 | rake (13.0.1) 203 | rb-fsevent (0.10.4) 204 | rb-inotify (0.10.1) 205 | ffi (~> 1.0) 206 | rb-readline (0.5.5) 207 | redis (4.2.5) 208 | regexp_parser (1.8.2) 209 | request_store (1.5.0) 210 | rack (>= 1.4) 211 | rexml (3.2.4) 212 | rspec-core (3.9.3) 213 | rspec-support (~> 3.9.3) 214 | rspec-expectations (3.9.4) 215 | diff-lcs (>= 1.2.0, < 2.0) 216 | rspec-support (~> 3.9.0) 217 | rspec-mocks (3.9.1) 218 | diff-lcs (>= 1.2.0, < 2.0) 219 | rspec-support (~> 3.9.0) 220 | rspec-rails (3.9.1) 221 | actionpack (>= 3.0) 222 | activesupport (>= 3.0) 223 | railties (>= 3.0) 224 | rspec-core (~> 3.9.0) 225 | rspec-expectations (~> 3.9.0) 226 | rspec-mocks (~> 3.9.0) 227 | rspec-support (~> 3.9.0) 228 | rspec-sidekiq (3.1.0) 229 | rspec-core (~> 3.0, >= 3.0.0) 230 | sidekiq (>= 2.4.0) 231 | rspec-support (3.9.4) 232 | rubocop (1.6.1) 233 | parallel (~> 1.10) 234 | parser (>= 2.7.1.5) 235 | rainbow (>= 2.2.2, < 4.0) 236 | regexp_parser (>= 1.8, < 3.0) 237 | rexml 238 | rubocop-ast (>= 1.2.0, < 2.0) 239 | ruby-progressbar (~> 1.7) 240 | unicode-display_width (>= 1.4.0, < 2.0) 241 | rubocop-ast (1.3.0) 242 | parser (>= 2.7.1.5) 243 | rubocop-performance (1.9.1) 244 | rubocop (>= 0.90.0, < 2.0) 245 | rubocop-ast (>= 0.4.0) 246 | rubocop-rails (2.9.0) 247 | activesupport (>= 4.2.0) 248 | rack (>= 1.1) 249 | rubocop (>= 0.90.0, < 2.0) 250 | rubocop-rspec (2.0.1) 251 | rubocop (~> 1.0) 252 | rubocop-ast (>= 1.1.0) 253 | ruby-progressbar (1.10.1) 254 | rubyzip (2.3.0) 255 | sass-rails (6.0.0) 256 | sassc-rails (~> 2.1, >= 2.1.1) 257 | sassc (2.4.0) 258 | ffi (~> 1.9) 259 | sassc-rails (2.1.2) 260 | railties (>= 4.0.0) 261 | sassc (>= 2.0) 262 | sprockets (> 3.0) 263 | sprockets-rails 264 | tilt 265 | selenium-webdriver (3.142.7) 266 | childprocess (>= 0.5, < 4.0) 267 | rubyzip (>= 1.2.2) 268 | semantic_range (2.3.1) 269 | shoulda-matchers (4.4.1) 270 | activesupport (>= 4.2.0) 271 | sidekiq (6.1.2) 272 | connection_pool (>= 2.2.2) 273 | rack (~> 2.0) 274 | redis (>= 4.2.0) 275 | simplecov (0.20.0) 276 | docile (~> 1.1) 277 | simplecov-html (~> 0.11) 278 | simplecov_json_formatter (~> 0.1) 279 | simplecov-html (0.12.3) 280 | simplecov_json_formatter (0.1.2) 281 | sprockets (4.0.2) 282 | concurrent-ruby (~> 1.0) 283 | rack (> 1, < 3) 284 | sprockets-rails (3.2.2) 285 | actionpack (>= 4.0) 286 | activesupport (>= 4.0) 287 | sprockets (>= 3.0.0) 288 | thor (1.0.1) 289 | tilt (2.0.10) 290 | timecop (0.9.2) 291 | turbolinks (5.2.1) 292 | turbolinks-source (~> 5.2) 293 | turbolinks-source (5.2.0) 294 | tzinfo (2.0.3) 295 | concurrent-ruby (~> 1.0) 296 | unicode-display_width (1.7.0) 297 | uniform_notifier (1.13.0) 298 | vcr (6.0.0) 299 | web-console (4.1.0) 300 | actionview (>= 6.0.0) 301 | activemodel (>= 6.0.0) 302 | bindex (>= 0.4.0) 303 | railties (>= 6.0.0) 304 | webdrivers (4.4.1) 305 | nokogiri (~> 1.6) 306 | rubyzip (>= 1.3.0) 307 | selenium-webdriver (>= 3.0, < 4.0) 308 | webmock (3.10.0) 309 | addressable (>= 2.3.6) 310 | crack (>= 0.3.2) 311 | hashdiff (>= 0.4.0, < 2.0.0) 312 | webpacker (5.2.1) 313 | activesupport (>= 5.2) 314 | rack-proxy (>= 0.6.1) 315 | railties (>= 5.2) 316 | semantic_range (>= 2.3.0) 317 | websocket-driver (0.7.3) 318 | websocket-extensions (>= 0.1.0) 319 | websocket-extensions (0.1.5) 320 | xpath (3.2.0) 321 | nokogiri (~> 1.8) 322 | zeitwerk (2.4.2) 323 | 324 | PLATFORMS 325 | ruby 326 | 327 | DEPENDENCIES 328 | awesome_print 329 | better_errors 330 | binding_of_caller 331 | bootsnap (>= 1.4.4) 332 | bullet 333 | capybara (>= 2.15, < 4.0) 334 | database_cleaner 335 | dotenv-rails 336 | draper 337 | email_spec 338 | factory_bot_rails 339 | jbuilder (~> 2.7) 340 | launchy 341 | listen (~> 3.3) 342 | newrelic_rpm 343 | pg (~> 1.1) 344 | prettier 345 | pry 346 | puma (~> 5.0) 347 | rack-mini-profiler (~> 2.0) 348 | rails (~> 6.1.0) 349 | rails-controller-testing 350 | rb-readline 351 | rspec-rails (~> 3.6) 352 | rspec-sidekiq 353 | rubocop 354 | rubocop-performance 355 | rubocop-rails 356 | rubocop-rspec 357 | sass-rails (>= 6) 358 | selenium-webdriver 359 | shoulda-matchers 360 | simplecov 361 | timecop 362 | turbolinks (~> 5) 363 | tzinfo-data 364 | vcr 365 | web-console (>= 4.1.0) 366 | webdrivers 367 | webmock 368 | webpacker (~> 5.0) 369 | 370 | RUBY VERSION 371 | ruby 2.7.2p137 372 | 373 | BUNDLED WITH 374 | 2.1.4 375 | --------------------------------------------------------------------------------