9 |
10 |
11 |
12 | ## Overview
13 | Blueprint is a boilerplate to create Rails 6 apps easily and quickly.
14 |
15 | Ideas/feedback/suggestions are welcome. Please open a PR to suggest a new feature.
16 |
17 | ### Table of Contents
18 | - [Built-in features](#built-in-features)
19 | - [Installation](#installation)
20 | - [Sending Emails](#sending-emails)
21 | - [Organised Mail Folders](#organised-mailers-folders)
22 | - [Customize Tailwind](#customize-tailwindcss)
23 | - [Flash Messages](#flash-messages)
24 | - [Trigger Flash Messages Manually](#trigger-flash-messages-manually)
25 | - [Flash Messages Position](#flash-messages-position)
26 | - [Form Validation](#form-validation)
27 | - [Basic Admin Area](#basic-admin-area)
28 | - [Other Options](#other-options)
29 | - [Roadmap](#roadmap)
30 |
31 | ## Built-in features
32 | Blueprint's goal is to make creating a modern Rails app as simple and fast as possible, which is why it comes with a few popular gems/plugins/libraries already set up:
33 | * User authentication via [Devise](https://github.com/plataformatec/devise)
34 | * Login/Sign up pages already designed and easily customizable
35 | * Script that handles flash messages
36 | * Transactional emails sent via [Postmark](https://postmarkapp.com/)
37 | * Easy CSS animations with [Animated.css](https://daneden.github.io/animate.css/)
38 | * Design via [TailwindCSS](https://tailwindcss.com/)
39 | * Troubleshoot problems faster with [Better Errors](https://github.com/BetterErrors/better_errors)
40 | * Production-ready DB setup via postgres
41 | * Google Analytics with Turbolinks support
42 | * Preview emails in your browser (instead of sending them) in development with [LetterOpener](https://github.com/ryanb/letter_opener)
43 | * [DotEnv](https://github.com/bkeepers/dotenv) for environment variables support
44 |
45 | ## Installation
46 | 1. Clone the repo `git clone git@github.com:ManuelFrigerio/rails-blueprint.git`
47 | 2. Go to the folder `cd rails-blueprint` and run `gem install bundle && bundle install`
48 | 3. Run `rails db:setup && rails db:migrate` to create db and included Users table
49 |
50 | ## Environment variables
51 | Blueprint uses a few environment variables to set defaults and save you time.
52 | You can see which environment variables you need in the `.env-example` file. In your development environment, rename the `.env-example` file to `.env` and restart the server.
53 |
54 | ## Sending emails
55 | To send emails Blueprint uses [Postmark](https://postmarkapp.com), an extremely realiable, developer-friendly and cheap ($10/month for 10K emails) email service. After you signup/login, create your first server and get your API key.
56 |
57 | Simply make sure to set the `POSTMARK_API_KEY` variable in your environment with your Postmark API key.
58 |
59 | ### Organised mailers folders
60 | By default, when you create a new mailer in Rails you have to create a folder under the `views` folder. However, if you have many mailers (eg: UserMailer, OrderMailer, NotificationMailer, etc), this often results in a messy `view` folder.
61 |
62 | To solve this problem, Blueprint allows you to create you mailer folders under the new `views/mailers` folder.
63 | When you create a new mailer (e.g: OrderMailer), simply create the corresponding folder (e.g: order_mailer) under the `views/mailers` folder.
64 |
65 | 
66 |
67 | Check out the user_mailer folder as an example.
68 |
69 | ## Customize TailwindCSS
70 | Tailwind is a utility-first CSS framework to build custom designs. You can [learn TailwindCSS for free here](https://scrimba.com/g/gtailwind). When it makes sense to create re-usable components, the recommended approach is to add all the classes related to a component in a `.scss` file under `app/javascript/css/components`. Don't forget to also `@import` the file in the `app/javascript/css/application.scss` file.
71 |
72 | Blueprint comes with 4 component files: Animations, Notifications, Buttons and Forms.
73 |
74 | ### Animations
75 | The animation.scss file ships the [Animate.css] library of CSS animations.
76 |
77 | ### Notifications
78 | The notifications.scss file stores the CSS for the flash messages (check the [flash messages](#flash-messages) section below).
79 |
80 | ### Buttons & Forms
81 | The buttons.scss and forms.scss files store very simple classes to style buttons and form inputs. These files are used primarily to show how to use Tailwind.
82 |
83 | ## Flash messages
84 | Blueprint ships with a built-in JavaScript utility to handle flash messages.
85 | Flash messages will appear as notifications at the top of the screen for 3.5 seconds.
86 |
87 | 
88 |
89 | You can use 4 different type of flash messages:
90 | ```
91 | flash[:notice] = "This is a notice notification"
92 | flash[:error] = "This is a error notification"
93 | flash[:success] = "This is a success notification"
94 | flash[:warning] = "This is a warning notification"
95 | ```
96 | Each flash type comes with a different colour.
97 |
98 | 
99 |
100 | ### Trigger flash messages manually
101 | You can manually trigger flash messages everywhere in your app with the following code:
102 | ```
103 | showNotice("This is a notice notification");
104 | showSuccess("This is a success notification");
105 | showError("This is a error notification");
106 | showWarning("This is a warning notification");
107 | ```
108 | ### Flash messages position
109 | You can change the default position by adding a second parameter "bottom" to the function, like this:
110 | ```
111 | showNotice("This is a notice notification", "bottom");
112 | ```
113 |
114 | You can change the position of all flash messages in your app to bottom by editing the file **layouts/scripts/flash**, eg:
115 | ```
116 | <% if flash[:success] %>
117 | showSuccess("<%= flash[:success] %>", "bottom");
118 | <% end %>
119 | ```
120 |
121 | ## Form validation
122 | Form validations are also handled automatically.
123 | If any validations fail, the respective inputs will turn red as shown in the screenshot below.
124 |
125 | 
126 |
127 | This is done with the help of an initializer that overrides Rails's default behaviour and add a `.border-red-500` class to the inputs that fail the validation. You can customize the error class by changing line 4 of the **customize_errors.rb** initializer.
128 |
129 | You can also use flash messages to show validation errors.
130 | Blueprint has got a handy helper that you simply paste inside a form:
131 |
132 | ```
133 | <%= form_for @object %>
134 | <%= render "layouts/scripts/form_errors", obj: @object %>
135 | <% end %>
136 | ```
137 |
138 | 
139 |
140 | ## Basic Admin Area
141 | A common functionality for Rails apps is the ability to log in as a specific user (usually to troubleshoot problems). Blueprint ships a very simple, yet flexible Admin Area that automatically lists all your users and allows you to log in as one of them with one click.
142 |
143 | To see this page, visit the `/admin` path of your app. You will be prompted to authenticate (you don't want to expose this info to the world). The default login credentials are `admin` and `password`. Clearly, they are not very hacker-proof. You can change them in the `admin/base_controller.rb` file, line 4.
144 |
145 | ## Other options
146 | * If you are on Heroku, generate a master key by running this command `$ heroku config:set RAILS_MASTER_KEY=` Make sure `your-master-key` is an alphanumeric string 32 chars.
147 | * Go to **devise.rb** and change the default email address `config.mailer_sender`
148 | * Create `.env` file and set your environment variables on your machine (see `.env-example`)
149 |
150 | ## Roadmap
151 | * ✅ Migrated to TailwindCSS
152 | * ✅ Migrate to Rails 6
153 | * ☑️ Add logic to handle subscriptions using Stripe's webhooks
154 | * ✅ Basic admin dashboard which also allows to [sign in as another user](https://github.com/plataformatec/devise/wiki/How-To:-Sign-in-as-another-user-if-you-are-an-admin)
155 | * ☑️ Create a command line based script to customize the installation (add/remove gems, create tables, etc)
156 |
157 | ## Contributions
158 |
159 | Feel free to implement anything from the roadmap, submit pull requests, create issues, discuss ideas or spread the word.
160 | When adding a gem, make sure to add clear instructions in the **Installation** section on how to use it.
161 |
162 | ## Screenshots
163 |
164 | Flash messages
165 |
166 | 
167 |
168 | Signup screen
169 |
170 | 
171 |
--------------------------------------------------------------------------------
/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/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../stylesheets .css
3 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/app/assets/images/.keep
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/app/assets/stylesheets/application.scss
--------------------------------------------------------------------------------
/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Channel < ActionCable::Channel::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Connection < ActionCable::Connection::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/controllers/admin/base_controller.rb:
--------------------------------------------------------------------------------
1 | module Admin
2 | class BaseController < ApplicationController
3 |
4 | http_basic_authenticate_with name: "admin", password: "password"
5 |
6 | layout "admin"
7 |
8 | end
9 | end
--------------------------------------------------------------------------------
/app/controllers/admin/users_controller.rb:
--------------------------------------------------------------------------------
1 | module Admin
2 | class UsersController < BaseController
3 |
4 | before_action :get_user, only: [:show]
5 |
6 | def index
7 | @users = User.order(created_at: :desc)
8 | end
9 |
10 | def show
11 | end
12 |
13 | def become
14 | sign_in(:user, User.find(params[:id]), { :bypass => true })
15 | redirect_to root_path
16 | end
17 |
18 | private
19 |
20 | def get_user
21 | @user = User.find_by(id: params[:id])
22 | redirect_to users_admin_index_path unless @user
23 | end
24 |
25 | end
26 | end
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 |
3 | before_action :set_raven_context
4 | layout :layout_by_resource
5 |
6 | private
7 |
8 | def set_raven_context
9 | Raven.user_context(id: session[:current_user_id]) # or anything else in session
10 | Raven.extra_context(params: params.to_unsafe_h, url: request.url)
11 | end
12 |
13 | def layout_by_resource
14 | if devise_controller?
15 | "devise"
16 | else
17 | "application"
18 | end
19 | end
20 |
21 | end
22 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/app/controllers/pages_controller.rb:
--------------------------------------------------------------------------------
1 | class PagesController < ApplicationController
2 |
3 | def home
4 | end
5 |
6 | end
7 |
--------------------------------------------------------------------------------
/app/controllers/users/confirmations_controller.rb:
--------------------------------------------------------------------------------
1 | class Users::ConfirmationsController < Devise::ConfirmationsController
2 |
3 | private
4 |
5 | def after_confirmation_path_for(resource_name, resource)
6 | sign_in(resource)
7 | root_path
8 | end
9 |
10 | end
--------------------------------------------------------------------------------
/app/controllers/users/passwords_controller.rb:
--------------------------------------------------------------------------------
1 | class Users::PasswordsController < Devise::PasswordsController
2 | end
--------------------------------------------------------------------------------
/app/controllers/users/registrations_controller.rb:
--------------------------------------------------------------------------------
1 | class Users::RegistrationsController < Devise::RegistrationsController
2 |
3 | before_action :configure_permitted_parameters
4 |
5 | def destroy
6 | super
7 | end
8 |
9 | protected
10 |
11 | def configure_permitted_parameters
12 | devise_parameter_sanitizer.permit(:sign_up) {|u| u.permit(:first_name, :last_name, :email, :password)}
13 | devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:first_name, :last_name, :email, :password) }
14 | end
15 |
16 | def after_sign_up_path_for(resource)
17 | flash[:success] = "We have sent a confirmation email to your inbox. Verify your email address to get started."
18 | root_path
19 | end
20 |
21 | def after_inactive_sign_up_path_for(resource)
22 | flash[:success] = "We have sent a confirmation email to your inbox. Verify your email address to get started."
23 | root_path
24 | end
25 |
26 | end
--------------------------------------------------------------------------------
/app/controllers/users/sessions_controller.rb:
--------------------------------------------------------------------------------
1 | class Users::SessionsController < Devise::SessionsController
2 |
3 | def new
4 | super
5 | end
6 |
7 | protected
8 |
9 | def after_sign_in_path_for(resource)
10 | flash[:success] = "Welcome back #{resource.first_name}!"
11 | root_path
12 | end
13 |
14 | end
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 |
3 | def generate_page_title(title)
4 | title ? "#{title} - #{ENV['APP_NAME']}" : "#{ENV['APP_NAME']} - #{ENV['APP_DESCRIPTION']}"
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/app/javascript/css/application.scss:
--------------------------------------------------------------------------------
1 | /* purgecss start ignore */
2 | @import "tailwindcss/base";
3 | @import "tailwindcss/components";
4 | /* purgecss end ignore */
5 |
6 | @import "components/animations";
7 | @import "components/notifications";
8 | @import "components/forms";
9 | @import "components/buttons";
10 |
11 | @import "tailwindcss/utilities";
--------------------------------------------------------------------------------
/app/javascript/css/components/buttons.scss:
--------------------------------------------------------------------------------
1 | .btn {
2 | @apply bg-green-500 rounded py-2 px-5 text-white
3 | }
4 |
5 | .btn:hover {
6 | @apply bg-green-700 cursor-pointer
7 | }
--------------------------------------------------------------------------------
/app/javascript/css/components/forms.scss:
--------------------------------------------------------------------------------
1 | .input {
2 | @apply appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight
3 | }
4 |
5 | .input:focus {
6 | @apply outline-none shadow-outline
7 | }
8 |
9 | label {
10 | @apply block text-gray-700 text-sm font-bold mb-1
11 | }
--------------------------------------------------------------------------------
/app/javascript/css/components/notifications.scss:
--------------------------------------------------------------------------------
1 | .notification {
2 | @apply text-white text-sm rounded-md text-center px-4 py-3 z-50 fixed;
3 | right: 20px;
4 | left: 20px;
5 | top: 20px;
6 |
7 | &.success {
8 | @apply bg-green-500
9 | }
10 |
11 | &.error {
12 | @apply bg-red-500
13 | }
14 |
15 | &.warning {
16 | @apply bg-yellow-500
17 | }
18 |
19 | &.notice {
20 | @apply bg-blue-500
21 | }
22 |
23 | &.bottom {
24 | @apply top-auto mb-0;
25 | bottom: 20px;
26 | }
27 | }
28 |
29 | /*On tablet and desktops*/
30 | @media only screen and (min-width: 768px) {
31 |
32 | .notification {
33 | right: 25px;
34 | left: 25px;
35 | margin: 0 auto;
36 | max-width: 350px;
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/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 | require("css/application.scss")
11 |
12 | require("@rails/ujs").start()
13 | require("turbolinks").start()
14 | require("@rails/activestorage").start()
15 |
16 | require("../src/notifications")
--------------------------------------------------------------------------------
/app/javascript/src/notifications.js:
--------------------------------------------------------------------------------
1 | var notification = function(color, msg, pos) {
2 | var notification = document.createElement("div");
3 | var direction = (pos == "bottom" ? "Up" : "Down");
4 | notification.classList = "notification animated fadeIn"+ direction +" "+color+" "+ pos;
5 | notification.innerHTML = msg;
6 | document.getElementsByTagName('body')[0].appendChild(notification);
7 | setTimeout(function() {
8 | notification.classList.remove("fadeInDown");
9 | notification.classList.add("fadeOutUp");
10 | }, 3500);
11 | };
12 |
13 | window.showSuccess = function(msg, pos = "") {
14 | notification('success', msg, pos);
15 | };
16 |
17 | window.showError = function(msg, pos = "") {
18 | notification('error', msg, pos);
19 | };
20 |
21 | window.showWarning = function(msg, pos = "") {
22 | notification('warning', msg, pos);
23 | };
24 |
25 | window.showNotice = function(msg, pos = "") {
26 | notification('notice', msg, pos);
27 | };
--------------------------------------------------------------------------------
/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | class ApplicationJob < ActiveJob::Base
2 | end
3 |
--------------------------------------------------------------------------------
/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | class ApplicationMailer < ActionMailer::Base
2 |
3 | append_view_path Rails.root.join('app', 'views', 'mailers')
4 | default from: "#{ENV['APP_NAME']} <#{ENV['DEFAULT_EMAIL']}>"
5 |
6 | private
7 |
8 | def send_email(email, subject)
9 | begin
10 | mail(
11 | to: email,
12 | subject: subject
13 | )
14 | rescue => e
15 | raise "Email error: #{e}"
16 | end
17 | end
18 |
19 | end
--------------------------------------------------------------------------------
/app/mailers/user_mailer.rb:
--------------------------------------------------------------------------------
1 | class UserMailer < ApplicationMailer
2 |
3 | def welcome(user)
4 | @user = user
5 |
6 | send_email(user.email, "Welcome to #{ENV['APP_NAME']}!")
7 | end
8 |
9 | end
10 |
--------------------------------------------------------------------------------
/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | class ApplicationRecord < ActiveRecord::Base
2 | self.abstract_class = true
3 | end
4 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/app/models/concerns/.keep
--------------------------------------------------------------------------------
/app/models/user.rb:
--------------------------------------------------------------------------------
1 | class User < ApplicationRecord
2 | # Include default devise modules. Others available are:
3 | # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
4 | devise :database_authenticatable, :registerable,
5 | :recoverable, :rememberable, :validatable, :confirmable
6 |
7 |
8 | def full_name
9 | [first_name, last_name].join(" ")
10 | end
11 |
12 | end
13 |
--------------------------------------------------------------------------------
/app/views/admin/users/index.html.erb:
--------------------------------------------------------------------------------
1 |
30 | <%= f.label :current_password %> (we need your current password to confirm your changes)
31 | <%= f.password_field :current_password, autocomplete: "current-password" %>
32 |
33 |
34 |
35 | <%= f.submit "Update" %>
36 |
37 | <% end %>
38 |
39 |
Cancel my account
40 |
41 |
Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
14 | <% end %>
15 |
16 | <%= render "users/shared/links" %>
17 |
--------------------------------------------------------------------------------
/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 | '@babel/preset-env',
22 | {
23 | targets: {
24 | node: 'current'
25 | }
26 | }
27 | ],
28 | (isProductionEnv || isDevelopmentEnv) && [
29 | '@babel/preset-env',
30 | {
31 | forceAllTransforms: true,
32 | useBuiltIns: 'entry',
33 | corejs: 3,
34 | modules: false,
35 | exclude: ['transform-typeof-symbol']
36 | }
37 | ]
38 | ].filter(Boolean),
39 | plugins: [
40 | 'babel-plugin-macros',
41 | '@babel/plugin-syntax-dynamic-import',
42 | isTestEnv && 'babel-plugin-dynamic-import-node',
43 | '@babel/plugin-transform-destructuring',
44 | [
45 | '@babel/plugin-proposal-class-properties',
46 | {
47 | loose: true
48 | }
49 | ],
50 | [
51 | '@babel/plugin-proposal-object-rest-spread',
52 | {
53 | useBuiltIns: true
54 | }
55 | ],
56 | [
57 | '@babel/plugin-transform-runtime',
58 | {
59 | helpers: false,
60 | regenerator: true,
61 | corejs: false
62 | }
63 | ],
64 | [
65 | '@babel/plugin-transform-regenerator',
66 | {
67 | async: false
68 | }
69 | ]
70 | ].filter(Boolean)
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | APP_PATH = File.expand_path('../config/application', __dir__)
8 | require_relative '../config/boot'
9 | require 'rails/commands'
10 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | require_relative '../config/boot'
8 | require 'rake'
9 | Rake.application.run
10 |
--------------------------------------------------------------------------------
/bin/rspec:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | require 'bundler/setup'
8 | load Gem.bin_path('rspec-core', 'rspec')
9 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 | include FileUtils
4 |
5 | # path to your application root.
6 | APP_ROOT = File.expand_path('..', __dir__)
7 |
8 | def system!(*args)
9 | system(*args) || abort("\n== Command #{args} failed ==")
10 | end
11 |
12 | chdir APP_ROOT do
13 | # This script is a starting point to setup your application.
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 if using Yarn
21 | # system('bin/yarn')
22 |
23 | # puts "\n== Copying sample files =="
24 | # unless File.exist?('config/database.yml')
25 | # cp 'config/database.yml.sample', 'config/database.yml'
26 | # end
27 |
28 | puts "\n== Preparing database =="
29 | system! 'bin/rails db:setup'
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 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This file loads Spring without using Bundler, in order to be fast.
4 | # It gets overwritten when you run the `spring binstub` command.
5 |
6 | unless defined?(Spring)
7 | require 'rubygems'
8 | require 'bundler'
9 |
10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11 | spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
12 | if spring
13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14 | gem 'spring', spring.version
15 | require 'spring/binstub'
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 | include FileUtils
4 |
5 | # path to your application root.
6 | APP_ROOT = File.expand_path('..', __dir__)
7 |
8 | def system!(*args)
9 | system(*args) || abort("\n== Command #{args} failed ==")
10 | end
11 |
12 | chdir APP_ROOT do
13 | # This script is a way to update your development environment automatically.
14 | # Add necessary update 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 if using Yarn
21 | # system('bin/yarn')
22 |
23 | puts "\n== Updating database =="
24 | system! 'bin/rails db:migrate'
25 |
26 | puts "\n== Removing old logs and tempfiles =="
27 | system! 'bin/rails log:clear tmp:clear'
28 |
29 | puts "\n== Restarting application server =="
30 | system! 'bin/rails restart'
31 | end
32 |
--------------------------------------------------------------------------------
/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 "rubygems"
11 | require "bundler/setup"
12 |
13 | require "webpacker"
14 | require "webpacker/webpack_runner"
15 | Webpacker::WebpackRunner.run(ARGV)
16 |
--------------------------------------------------------------------------------
/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 "rubygems"
11 | require "bundler/setup"
12 |
13 | require "webpacker"
14 | require "webpacker/dev_server_runner"
15 | Webpacker::DevServerRunner.run(ARGV)
16 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | # #!/usr/bin/env ruby
2 | # APP_ROOT = File.expand_path('..', __dir__)
3 | # Dir.chdir(APP_ROOT) do
4 | # begin
5 | # exec "yarnpkg", *ARGV
6 | # rescue Errno::ENOENT
7 | # $stderr.puts "Yarn executable was not detected in the system."
8 | # $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 | # exit 1
10 | # end
11 | # end
12 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | Dotenv::Railtie.load
10 |
11 | module Referralhero
12 | class Application < Rails::Application
13 | # Initialize configuration defaults for originally generated Rails version.
14 | # config.load_defaults 5.2
15 | config.load_defaults 6.0
16 |
17 | config.autoload_paths << Rails.root.join('lib') # adds Lib folder to autoloaded files
18 |
19 | # allow cross origin requests. Comment it out if you're not interested in cross-origin requests
20 | config.middleware.insert_before 0, Rack::Cors do
21 | allow do
22 | origins '*'
23 | resource '*', :headers => :any, :methods => [:get, :post, :patch, :put, :delete]
24 | end
25 | end
26 |
27 | # disable superfluous generator extras
28 | config.generators do |g|
29 | g.assets = false # remove auto stylesheets
30 | g.helper = false
31 | g.test_framework :rspec, view_specs: false, helper_specs: false, routing_specs: false
32 | end
33 |
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: async
6 |
7 | production:
8 | adapter: redis
9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 | channel_prefix: myapp_production
11 |
--------------------------------------------------------------------------------
/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | DR12J3rErpspr0YfoATIk0W5cZyVR//fUgfwyjGrdUqnhnMFKgrXdifxca4uJcV08KwmOxyBZ6UexAZPgMPxFYZYW1y7rNLTaPCdXlEIl4K6mO3G1v3LuA+jArii5Y/NPiGLNrRDnsbE9jiUVzVIvzwykozXBwCFvQI/BEwVph6B2aF3xRzdKB4pI3wV9JhwLN9x5sH+KkkUF0qllHHzCCy+y6hRwOX0wjLxTu4CIDFxdgF+9RKsAmxE2YSKBX7zY0Nu29NIbHxwauRyP7nnyaxl18kFicyxm/IfDLHaRgvsNI1IYfwkFyUzOnWNO5rA5ovHFerPqBC/blKy6wSrq1XpCnH4tby/yA1RsVvPmJCBknZveMD8gm6Es2PrTJq+/gFmwHeEDm8f9lXVz2Zueu3UtKOBPDvVyZKw--gf1DzDZ1LP95c2e8--vmS7GnCtdmmQKRnQ1P4SNQ==
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # PostgreSQL. Versions 9.1 and up are supported.
2 | #
3 | # Install the pg driver:
4 | # gem install pg
5 | # On OS X with Homebrew:
6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7 | # On OS X 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 | # http://guides.rubyonrails.org/configuring.html#database-pooling
22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23 |
24 | development:
25 | <<: *default
26 | database: <%= ENV['DATABASE_NAME'] %>
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 that initialized the database.
32 | username: <%= ENV['DATABASE_USERNAME'] %>
33 |
34 | # The password associated with the postgres role (username).
35 | password: <%= ENV['DATABASE_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: db_test
61 |
62 | # As with config/secrets.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 as a unix environment variable when you boot
67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
68 | # for a full rundown on how to provide these environment variables in a
69 | # production deployment.
70 | #
71 | # On Heroku and other platform providers, you may have a full connection URL
72 | # available as an environment variable. For example:
73 | #
74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
75 | #
76 | # You can use this database configuration with:
77 | #
78 | # production:
79 | # url: <%= ENV['DATABASE_URL'] %>
80 | #
81 | production:
82 | <<: *default
83 | database: db_production
84 | username: admin
85 | password: <%= ENV['DATABASE_PASSWORD'] %>
86 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative 'application'
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Verifies that versions and hashed value of the package contents in the project's package.json
3 | # config.webpacker.check_yarn_integrity = true
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 on
7 | # every request. 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 |
22 | config.cache_store = :memory_store
23 | config.public_file_server.headers = {
24 | 'Cache-Control' => "public, max-age=#{2.days.to_i}"
25 | }
26 | else
27 | config.action_controller.perform_caching = false
28 |
29 | config.cache_store = :null_store
30 | end
31 |
32 | # Store uploaded files on the local file system (see config/storage.yml for options)
33 | config.active_storage.service = :local
34 |
35 | # Don't care if the mailer can't send.
36 | config.action_mailer.raise_delivery_errors = false
37 |
38 | config.action_mailer.perform_caching = false
39 |
40 | # Print deprecation notices to the Rails logger.
41 | config.active_support.deprecation = :log
42 |
43 | # Raise an error on page load if there are pending migrations.
44 | config.active_record.migration_error = :page_load
45 |
46 | # Highlight code that triggered database queries in logs.
47 | config.active_record.verbose_query_logs = true
48 |
49 | # Debug mode disables concatenation and preprocessing of assets.
50 | # This option may cause significant delays in view rendering with a large
51 | # number of complex assets.
52 | config.assets.debug = true
53 |
54 | # Suppress logger output for asset requests.
55 | config.assets.quiet = true
56 |
57 | config.action_controller.asset_host = "http://localhost:3000"
58 |
59 | config.action_mailer.default_url_options = { :host => "localhost:3000" }
60 | config.action_mailer.delivery_method = :letter_opener
61 | config.action_mailer.perform_deliveries = true
62 | config.action_mailer.raise_delivery_errors = true
63 | config.action_mailer.default :charset => "utf-8"
64 | config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
65 |
66 | # Raises error for missing translations
67 | # config.action_view.raise_on_missing_translations = true
68 |
69 | # Use an evented file watcher to asynchronously detect changes in source code,
70 | # routes, locales, etc. This feature depends on the listen gem.
71 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
72 | end
73 |
74 | require 'sidekiq/testing/inline' # So the emails send
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Verifies that versions and hashed value of the package contents in the project's package.json
3 | # config.webpacker.check_yarn_integrity = false
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 JavaScripts and CSS.
28 | # config.assets.js_compressor = Uglifier.new(harmony: true)
29 | # config.assets.css_compressor = :sass
30 |
31 | # Do not fallback to assets pipeline if a precompiled asset is missed.
32 | config.assets.compile = false
33 |
34 | config.filter_parameters << :password
35 |
36 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
37 |
38 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
39 | # config.action_controller.asset_host = 'http://assets.example.com'
40 |
41 | # Specifies the header that your server uses for sending files.
42 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
43 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
44 |
45 | # Store uploaded files on the local file system (see config/storage.yml for options)
46 | config.active_storage.service = :local
47 |
48 | # Mount Action Cable outside main process or domain
49 | # config.action_cable.mount_path = nil
50 | # config.action_cable.url = 'wss://example.com/cable'
51 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
52 |
53 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
54 | # config.force_ssl = true
55 |
56 | # Use the lowest log level to ensure availability of diagnostic information
57 | # when problems arise.
58 | config.log_level = :debug
59 |
60 | # Prepend all log lines with the following tags.
61 | config.log_tags = [ :request_id ]
62 |
63 | # Use a different cache store in production.
64 | config.cache_store = :mem_cache_store,
65 | (ENV["MEMCACHIER_SERVERS"] || "").split(","),
66 | {:username => ENV["MEMCACHIER_USERNAME"],
67 | :password => ENV["MEMCACHIER_PASSWORD"],
68 | :failover => true,
69 | :socket_timeout => 1.5,
70 | :socket_failure_delay => 0.2,
71 | :down_retry_delay => 60
72 | }
73 |
74 | # Use a real queuing backend for Active Job (and separate queues per environment)
75 | config.active_job.queue_adapter = :sidekiq
76 | # config.active_job.queue_name_prefix = "myapp_#{Rails.env}"
77 |
78 | config.action_mailer.perform_caching = false
79 |
80 | # Ignore bad email addresses and do not raise email delivery errors.
81 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
82 | # config.action_mailer.raise_delivery_errors = false
83 |
84 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
85 | # the I18n.default_locale when a translation cannot be found).
86 | config.i18n.fallbacks = true
87 |
88 | # Send deprecation notices to registered listeners.
89 | config.active_support.deprecation = :notify
90 |
91 | # Use default logging formatter so that PID and timestamp are not suppressed.
92 | config.log_formatter = ::Logger::Formatter.new
93 |
94 | # Use a different logger for distributed setups.
95 | # require 'syslog/logger'
96 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
97 |
98 | config.action_mailer.default_url_options = { :host => ENV['APP_URL'] }
99 | config.action_mailer.delivery_method = :postmark
100 | config.action_mailer.postmark_settings = { api_token: ENV['POSTMARK_API_KEY'] }
101 | config.action_mailer.perform_deliveries = true
102 | config.action_mailer.raise_delivery_errors = true
103 | config.action_mailer.default :charset => "utf-8"
104 |
105 | if ENV["RAILS_LOG_TO_STDOUT"].present?
106 | logger = ActiveSupport::Logger.new(STDOUT)
107 | logger.formatter = config.log_formatter
108 | config.logger = ActiveSupport::TaggedLogging.new(logger)
109 | end
110 |
111 | # Do not dump schema after migrations.
112 | config.active_record.dump_schema_after_migration = false
113 | end
114 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 |
31 | # Store uploaded files on the local file system in a temporary directory
32 | config.active_storage.service = :test
33 |
34 | config.action_mailer.perform_caching = false
35 |
36 | # Tell Action Mailer not to deliver emails to the real world.
37 | # The :test delivery method accumulates sent emails in the
38 | # ActionMailer::Base.deliveries array.
39 | config.action_mailer.delivery_method = :test
40 |
41 | # Print deprecation notices to the stderr.
42 | config.active_support.deprecation = :stderr
43 |
44 | # Raises error for missing translations
45 | # config.action_view.raise_on_missing_translations = true
46 | end
47 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ActiveSupport::Reloader.to_prepare do
4 | # ApplicationController.renderer.defaults.merge!(
5 | # http_host: 'example.org',
6 | # https: false
7 | # )
8 | # end
9 |
--------------------------------------------------------------------------------
/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/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| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Define an application-wide content security policy
4 | # For further information see the following documentation
5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6 |
7 | # Rails.application.config.content_security_policy do |policy|
8 | # policy.default_src :self, :https
9 | # policy.font_src :self, :https, :data
10 | # policy.img_src :self, :https, :data
11 | # policy.object_src :none
12 | # policy.script_src :self, :https
13 | # policy.style_src :self, :https
14 |
15 | # # Specify URI for violation reports
16 | # # policy.report_uri "/csp-violation-report-endpoint"
17 | # end
18 |
19 | # If you are using UJS then enable automatic nonce generation
20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21 |
22 | # Report CSP violations to a specified URI
23 | # For further information see the following documentation:
24 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25 | # Rails.application.config.content_security_policy_report_only = true
26 |
--------------------------------------------------------------------------------
/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/customize_errors.rb:
--------------------------------------------------------------------------------
1 | ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
2 | class_attr_index = html_tag.index 'class="'
3 |
4 | error_class = "border-red-500"
5 |
6 | if class_attr_index
7 | html_tag.insert class_attr_index+7, "#{error_class} "
8 | else
9 | html_tag.insert html_tag.index('>'), " class='#{error_class}'"
10 | end
11 | end
--------------------------------------------------------------------------------
/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Use this hook to configure devise mailer, warden hooks and so forth.
4 | # Many of these configuration options can be set straight in your model.
5 | Devise.setup do |config|
6 | # The secret key used by Devise. Devise uses this key to generate
7 | # random tokens. Changing this key will render invalid all existing
8 | # confirmation, reset password and unlock tokens in the database.
9 | # Devise will use the `secret_key_base` as its `secret_key`
10 | # by default. You can change it below and use your own secret key.
11 | # config.secret_key = 'ad079e7d6b9b0c196393bf81f10768896aa3de18e57a8f5ee5d3bd0970183f18b692c7a171cf3257bbeddfef3d38393c9dbf5510683625e7198bd6ced1ac6685'
12 |
13 | # ==> Controller configuration
14 | # Configure the parent class to the devise controllers.
15 | # config.parent_controller = 'DeviseController'
16 |
17 | # ==> Mailer Configuration
18 | # Configure the e-mail address which will be shown in Devise::Mailer,
19 | # note that it will be overwritten if you use your own mailer class
20 | # with default "from" parameter.
21 | config.mailer_sender = 'hello@mywebsite.com'
22 |
23 | # Configure the class responsible to send e-mails.
24 | # config.mailer = 'Devise::Mailer'
25 |
26 | # Configure the parent class responsible to send e-mails.
27 | # config.parent_mailer = 'ActionMailer::Base'
28 |
29 | # ==> ORM configuration
30 | # Load and configure the ORM. Supports :active_record (default) and
31 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
32 | # available as additional gems.
33 | require 'devise/orm/active_record'
34 |
35 | # ==> Configuration for any authentication mechanism
36 | # Configure which keys are used when authenticating a user. The default is
37 | # just :email. You can configure it to use [:username, :subdomain], so for
38 | # authenticating a user, both parameters are required. Remember that those
39 | # parameters are used only when authenticating and not when retrieving from
40 | # session. If you need permissions, you should implement that in a before filter.
41 | # You can also supply a hash where the value is a boolean determining whether
42 | # or not authentication should be aborted when the value is not present.
43 | # config.authentication_keys = [:email]
44 |
45 | # Configure parameters from the request object used for authentication. Each entry
46 | # given should be a request method and it will automatically be passed to the
47 | # find_for_authentication method and considered in your model lookup. For instance,
48 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
49 | # The same considerations mentioned for authentication_keys also apply to request_keys.
50 | # config.request_keys = []
51 |
52 | # Configure which authentication keys should be case-insensitive.
53 | # These keys will be downcased upon creating or modifying a user and when used
54 | # to authenticate or find a user. Default is :email.
55 | config.case_insensitive_keys = [:email]
56 |
57 | # Configure which authentication keys should have whitespace stripped.
58 | # These keys will have whitespace before and after removed upon creating or
59 | # modifying a user and when used to authenticate or find a user. Default is :email.
60 | config.strip_whitespace_keys = [:email]
61 |
62 | # Tell if authentication through request.params is enabled. True by default.
63 | # It can be set to an array that will enable params authentication only for the
64 | # given strategies, for example, `config.params_authenticatable = [:database]` will
65 | # enable it only for database (email + password) authentication.
66 | # config.params_authenticatable = true
67 |
68 | # Tell if authentication through HTTP Auth is enabled. False by default.
69 | # It can be set to an array that will enable http authentication only for the
70 | # given strategies, for example, `config.http_authenticatable = [:database]` will
71 | # enable it only for database authentication. The supported strategies are:
72 | # :database = Support basic authentication with authentication key + password
73 | # config.http_authenticatable = false
74 |
75 | # If 401 status code should be returned for AJAX requests. True by default.
76 | # config.http_authenticatable_on_xhr = true
77 |
78 | # The realm used in Http Basic Authentication. 'Application' by default.
79 | # config.http_authentication_realm = 'Application'
80 |
81 | # It will change confirmation, password recovery and other workflows
82 | # to behave the same regardless if the e-mail provided was right or wrong.
83 | # Does not affect registerable.
84 | # config.paranoid = true
85 |
86 | # By default Devise will store the user in session. You can skip storage for
87 | # particular strategies by setting this option.
88 | # Notice that if you are skipping storage for all authentication paths, you
89 | # may want to disable generating routes to Devise's sessions controller by
90 | # passing skip: :sessions to `devise_for` in your config/routes.rb
91 | config.skip_session_storage = [:http_auth]
92 |
93 | # By default, Devise cleans up the CSRF token on authentication to
94 | # avoid CSRF token fixation attacks. This means that, when using AJAX
95 | # requests for sign in and sign up, you need to get a new CSRF token
96 | # from the server. You can disable this option at your own risk.
97 | # config.clean_up_csrf_token_on_authentication = true
98 |
99 | # When false, Devise will not attempt to reload routes on eager load.
100 | # This can reduce the time taken to boot the app but if your application
101 | # requires the Devise mappings to be loaded during boot time the application
102 | # won't boot properly.
103 | # config.reload_routes = true
104 |
105 | # ==> Configuration for :database_authenticatable
106 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If
107 | # using other algorithms, it sets how many times you want the password to be hashed.
108 | #
109 | # Limiting the stretches to just one in testing will increase the performance of
110 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
111 | # a value less than 10 in other environments. Note that, for bcrypt (the default
112 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
113 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114 | config.stretches = Rails.env.test? ? 1 : 11
115 |
116 | # Set up a pepper to generate the hashed password.
117 | # config.pepper = '489441105613d5b1e583cc03a1a834141481ec66b79251fb17f8e46e85e606de42e0708a4e1236850cfa9408e15264bf92d2513fce029f12073284d932b9b077'
118 |
119 | # Send a notification to the original email when the user's email is changed.
120 | # config.send_email_changed_notification = false
121 |
122 | # Send a notification email when the user's password is changed.
123 | # config.send_password_change_notification = false
124 |
125 | # ==> Configuration for :confirmable
126 | # A period that the user is allowed to access the website even without
127 | # confirming their account. For instance, if set to 2.days, the user will be
128 | # able to access the website for two days without confirming their account,
129 | # access will be blocked just in the third day. Default is 0.days, meaning
130 | # the user cannot access the website without confirming their account.
131 | # config.allow_unconfirmed_access_for = 2.days
132 |
133 | # A period that the user is allowed to confirm their account before their
134 | # token becomes invalid. For example, if set to 3.days, the user can confirm
135 | # their account within 3 days after the mail was sent, but on the fourth day
136 | # their account can't be confirmed with the token any more.
137 | # Default is nil, meaning there is no restriction on how long a user can take
138 | # before confirming their account.
139 | # config.confirm_within = 3.days
140 |
141 | # If true, requires any email changes to be confirmed (exactly the same way as
142 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
143 | # db field (see migrations). Until confirmed, new email is stored in
144 | # unconfirmed_email column, and copied to email column on successful confirmation.
145 | config.reconfirmable = false
146 |
147 | # Defines which key will be used when confirming an account
148 | # config.confirmation_keys = [:email]
149 |
150 | # ==> Configuration for :rememberable
151 | # The time the user will be remembered without asking for credentials again.
152 | # config.remember_for = 2.weeks
153 |
154 | # Invalidates all the remember me tokens when the user signs out.
155 | config.expire_all_remember_me_on_sign_out = true
156 |
157 | # If true, extends the user's remember period when remembered via cookie.
158 | # config.extend_remember_period = false
159 |
160 | # Options to be passed to the created cookie. For instance, you can set
161 | # secure: true in order to force SSL only cookies.
162 | # config.rememberable_options = {}
163 |
164 | # ==> Configuration for :validatable
165 | # Range for password length.
166 | config.password_length = 6..128
167 |
168 | # Email regex used to validate email formats. It simply asserts that
169 | # one (and only one) @ exists in the given string. This is mainly
170 | # to give user feedback and not to assert the e-mail validity.
171 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
172 |
173 | # ==> Configuration for :timeoutable
174 | # The time you want to timeout the user session without activity. After this
175 | # time the user will be asked for credentials again. Default is 30 minutes.
176 | # config.timeout_in = 30.minutes
177 |
178 | # ==> Configuration for :lockable
179 | # Defines which strategy will be used to lock an account.
180 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
181 | # :none = No lock strategy. You should handle locking by yourself.
182 | # config.lock_strategy = :failed_attempts
183 |
184 | # Defines which key will be used when locking and unlocking an account
185 | # config.unlock_keys = [:email]
186 |
187 | # Defines which strategy will be used to unlock an account.
188 | # :email = Sends an unlock link to the user email
189 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
190 | # :both = Enables both strategies
191 | # :none = No unlock strategy. You should handle unlocking by yourself.
192 | # config.unlock_strategy = :both
193 |
194 | # Number of authentication tries before locking an account if lock_strategy
195 | # is failed attempts.
196 | # config.maximum_attempts = 20
197 |
198 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
199 | # config.unlock_in = 1.hour
200 |
201 | # Warn on the last attempt before the account is locked.
202 | # config.last_attempt_warning = true
203 |
204 | # ==> Configuration for :recoverable
205 | #
206 | # Defines which key will be used when recovering the password for an account
207 | # config.reset_password_keys = [:email]
208 |
209 | # Time interval you can reset your password with a reset password key.
210 | # Don't put a too small interval or your users won't have the time to
211 | # change their passwords.
212 | config.reset_password_within = 6.hours
213 |
214 | # When set to false, does not sign a user in automatically after their password is
215 | # reset. Defaults to true, so a user is signed in automatically after a reset.
216 | # config.sign_in_after_reset_password = true
217 |
218 | # ==> Configuration for :encryptable
219 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
220 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
221 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
222 | # for default behavior) and :restful_authentication_sha1 (then you should set
223 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
224 | #
225 | # Require the `devise-encryptable` gem when using anything other than bcrypt
226 | # config.encryptor = :sha512
227 |
228 | # ==> Scopes configuration
229 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
230 | # "users/sessions/new". It's turned off by default because it's slower if you
231 | # are using only default views.
232 | # config.scoped_views = false
233 |
234 | # Configure the default scope given to Warden. By default it's the first
235 | # devise role declared in your routes (usually :user).
236 | # config.default_scope = :user
237 |
238 | # Set this configuration to false if you want /users/sign_out to sign out
239 | # only the current scope. By default, Devise signs out all scopes.
240 | # config.sign_out_all_scopes = true
241 |
242 | # ==> Navigation configuration
243 | # Lists the formats that should be treated as navigational. Formats like
244 | # :html, should redirect to the sign in page when the user does not have
245 | # access, but formats like :xml or :json, should return 401.
246 | #
247 | # If you have any extra navigational formats, like :iphone or :mobile, you
248 | # should add them to the navigational formats lists.
249 | #
250 | # The "*/*" below is required to match Internet Explorer requests.
251 | # config.navigational_formats = ['*/*', :html]
252 |
253 | # The default HTTP method used to sign out a resource. Default is :delete.
254 | config.sign_out_via = :delete
255 |
256 | # ==> OmniAuth
257 | # Add a new OmniAuth provider. Check the wiki for more information on setting
258 | # up on your models and hooks.
259 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
260 |
261 | # ==> Warden configuration
262 | # If you want to use other strategies, that are not supported by Devise, or
263 | # change the failure app, you can configure them inside the config.warden block.
264 | #
265 | # config.warden do |manager|
266 | # manager.intercept_401 = false
267 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
268 | # end
269 |
270 | # ==> Mountable engine configurations
271 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
272 | # is mountable, there are some extra configurations to be taken into account.
273 | # The following options are available, assuming the engine is mounted as:
274 | #
275 | # mount MyEngine, at: '/my_engine'
276 | #
277 | # The router that invoked `devise_for`, in the example above, would be:
278 | # config.router_name = :my_engine
279 | #
280 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
281 | # so you need to do it manually. For the users scope, it would be:
282 | # config.omniauth_path_prefix = '/my_engine/users/auth'
283 |
284 | # ==> Turbolinks configuration
285 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
286 | #
287 | # ActiveSupport.on_load(:devise_failure_app) do
288 | # include Turbolinks::Controller
289 | # end
290 | end
291 |
--------------------------------------------------------------------------------
/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 += [:password]
5 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/config/initializers/new_framework_defaults_6_0.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 | #
3 | # This file contains migration options to ease your Rails 6.0 upgrade.
4 | #
5 | # Once upgraded flip defaults one by one to migrate to the new default.
6 | #
7 | # Read the Guide for Upgrading Ruby on Rails for more info on each option.
8 |
9 | # Don't force requests from old versions of IE to be UTF-8 encoded.
10 | # Rails.application.config.action_view.default_enforce_utf8 = false
11 |
12 | # Embed purpose and expiry metadata inside signed and encrypted
13 | # cookies for increased security.
14 | #
15 | # This option is not backwards compatible with earlier Rails versions.
16 | # It's best enabled when your entire app is migrated and stable on 6.0.
17 | # Rails.application.config.action_dispatch.use_cookies_with_metadata = true
18 |
19 | # Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
20 | # Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
21 |
22 | # Return false instead of self when enqueuing is aborted from a callback.
23 | # Rails.application.config.active_job.return_false_on_aborted_enqueue = true
24 |
25 | # Send Active Storage analysis and purge jobs to dedicated queues.
26 | # Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
27 | # Rails.application.config.active_storage.queues.purge = :active_storage_purge
28 |
29 | # When assigning to a collection of attachments declared via `has_many_attached`, replace existing
30 | # attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
31 | # Rails.application.config.active_storage.replace_on_assign_to_many = true
32 |
33 | # Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
34 | #
35 | # The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
36 | # will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
37 | # If you send mail in the background, job workers need to have a copy of
38 | # MailDeliveryJob to ensure all delivery jobs are processed properly.
39 | # Make sure your entire app is migrated and stable on 6.0 before using this setting.
40 | # Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
41 |
42 | # Enable the same cache key to be reused when the object being cached of type
43 | # `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
44 | # of the relation's cache key into the cache version to support recycling cache key.
45 | # Rails.application.config.active_record.collection_cache_versioning = true
46 |
--------------------------------------------------------------------------------
/config/initializers/sentry.rb:
--------------------------------------------------------------------------------
1 | if defined?(Raven) && (dsn = ENV['GETSENTRY_DSN']).present?
2 | Raven.configure do |config|
3 | config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
4 | config.dsn = dsn
5 | config.environments = ['production']
6 | end
7 | end
--------------------------------------------------------------------------------
/config/initializers/sidekiq.rb:
--------------------------------------------------------------------------------
1 | opts = { url: ENV['REDISCLOUD_URL'], namespace: 'myapp-sidekiq' }
2 |
3 | Sidekiq.configure_client do |config|
4 | config.redis = opts
5 |
6 | config.client_middleware do |chain|
7 | # accepts :expiration (optional)
8 | chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes # default
9 | end
10 | end
11 |
12 | Sidekiq.configure_server do |config|
13 | config.redis = opts
14 |
15 | config.server_middleware do |chain|
16 | # accepts :expiration (optional)
17 | chain.add Sidekiq::Status::ServerMiddleware, expiration: 30.minutes # default
18 | end
19 |
20 | config.client_middleware do |chain|
21 | # accepts :expiration (optional)
22 | chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes # default
23 | end
24 | end
25 |
26 | Sidekiq::Extensions.enable_delay!
27 |
28 | def redis_client
29 | Sidekiq.redis { |conn| conn }
30 | end
31 | Redis::Objects.redis = redis_client
--------------------------------------------------------------------------------
/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) do
8 | wrap_parameters format: [:json]
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | 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."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | email_changed:
27 | subject: "Email Changed"
28 | password_change:
29 | subject: "Password Changed"
30 | omniauth_callbacks:
31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32 | success: "Successfully authenticated from %{kind} account."
33 | passwords:
34 | 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."
35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36 | 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."
37 | updated: "Your password has been changed successfully. You are now signed in."
38 | updated_not_active: "Your password has been changed successfully."
39 | registrations:
40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41 | signed_up: "Welcome! You have signed up successfully."
42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44 | 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."
45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | sessions:
48 | signed_in: "Signed in successfully."
49 | signed_out: "Signed out successfully."
50 | already_signed_out: "Signed out successfully."
51 | unlocks:
52 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
53 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
54 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
55 | errors:
56 | messages:
57 | already_confirmed: "was already confirmed, please try signing in"
58 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
59 | expired: "has expired, please request a new one"
60 | not_found: "not found"
61 | not_locked: "was not locked"
62 | not_saved:
63 | one: "1 error prohibited this %{resource} from being saved:"
64 | other: "%{count} errors prohibited this %{resource} from being saved:"
65 |
--------------------------------------------------------------------------------
/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 http://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/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 | # threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | # threads threads_count, threads_count
9 |
10 | # # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11 | # #
12 | # port ENV.fetch("PORT") { 3000 }
13 |
14 | # # Specifies the `environment` that Puma will run in.
15 | # #
16 | # environment ENV.fetch("RAILS_ENV") { "development" }
17 |
18 | # # Specifies the number of `workers` to boot in clustered mode.
19 | # # Workers are forked webserver processes. If using threads and workers together
20 | # # the concurrency of the application would be max `threads` * `workers`.
21 | # # Workers do not work on JRuby or Windows (both of which do not support
22 | # # processes).
23 | # #
24 | # # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 |
26 | # # Use the `preload_app!` method when specifying a `workers` number.
27 | # # This directive tells Puma to first boot the application and load code
28 | # # before forking the application. This takes advantage of Copy On Write
29 | # # process behavior so workers use less memory.
30 | # #
31 | # # preload_app!
32 |
33 | workers Integer(ENV['WEB_CONCURRENCY'] || 2)
34 | threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
35 | threads threads_count, threads_count
36 |
37 | preload_app!
38 |
39 | rackup DefaultRackup
40 | port ENV['PORT'] || 3000
41 | environment ENV['RACK_ENV'] || 'development'
42 |
43 | on_worker_boot do
44 | # Worker specific setup for Rails 4.1+
45 | # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
46 | ActiveRecord::Base.establish_connection
47 | end
48 |
49 | # Allow puma to be restarted by `rails restart` command.
50 | plugin :tmp_restart
51 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | require 'sidekiq/web'
2 |
3 | Rails.application.routes.draw do
4 |
5 | root to: 'pages#home'
6 |
7 | devise_for :users,
8 | :path => '',
9 | :path_names => {
10 | sign_in: 'login',
11 | sign_out: 'logout',
12 | sign_up: 'signup'
13 | },
14 | :controllers => {
15 | sessions: "users/sessions",
16 | registrations: "users/registrations",
17 | confirmations: "users/confirmations",
18 | passwords: "users/passwords",
19 | }
20 |
21 |
22 | get "admin" => redirect("/admin/users"), as: :admin
23 | namespace :admin do
24 | resources :users, only: [:index, :show] do
25 | get :become, on: :member
26 | end
27 | mount Sidekiq::Web, at: "/sidekiq"
28 | end
29 |
30 | end
31 |
--------------------------------------------------------------------------------
/config/sidekiq.yml:
--------------------------------------------------------------------------------
1 | ---
2 | :concurrency: 5
3 | :queues:
4 | - default
5 | - high_priority
6 | - mailers
--------------------------------------------------------------------------------
/config/spring.rb:
--------------------------------------------------------------------------------
1 | %w[
2 | .ruby-version
3 | .rbenv-vars
4 | tmp/restart.txt
5 | tmp/caching-dev.txt
6 | ].each { |path| Spring.watch(path) }
7 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/config/webpack/environment.js:
--------------------------------------------------------------------------------
1 | const { environment } = require('@rails/webpacker')
2 |
3 | module.exports = environment
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/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/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_output_path: packs
7 | cache_path: tmp/cache/webpacker
8 |
9 | # Additional paths webpack should lookup modules
10 | # ['app/assets', 'engine/foo/app/assets']
11 | resolved_paths: []
12 |
13 | # Reload manifest.json on all requests so we reload latest compiled packs
14 | cache_manifest: false
15 |
16 | extensions:
17 | - .js
18 | - .sass
19 | - .scss
20 | - .css
21 | - .module.sass
22 | - .module.scss
23 | - .module.css
24 | - .png
25 | - .svg
26 | - .gif
27 | - .jpeg
28 | - .jpg
29 |
30 | development:
31 | <<: *default
32 | compile: true
33 |
34 | # Reference: https://webpack.js.org/configuration/dev-server/
35 | dev_server:
36 | https: false
37 | host: localhost
38 | port: 3035
39 | public: localhost:3035
40 | hmr: false
41 | # Inline should be set to true if using HMR
42 | inline: true
43 | overlay: true
44 | compress: true
45 | disable_host_check: true
46 | use_local_ip: false
47 | quiet: false
48 | headers:
49 | 'Access-Control-Allow-Origin': '*'
50 | watch_options:
51 | ignored: /node_modules/
52 |
53 |
54 | test:
55 | <<: *default
56 | compile: true
57 |
58 | # Compile test packs to a separate directory
59 | public_output_path: packs-test
60 |
61 | production:
62 | <<: *default
63 |
64 | # Production depends on precompilation of packs prior to booting for performance.
65 | compile: false
66 |
67 | # Cache manifest.json for performance
68 | cache_manifest: true
69 |
--------------------------------------------------------------------------------
/db/migrate/20181025175341_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class DeviseCreateUsers < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :users do |t|
6 | ## Database authenticatable
7 | t.string :first_name
8 | t.string :last_name
9 | t.string :email, null: false, default: ""
10 | t.string :encrypted_password, null: false, default: ""
11 |
12 | ## Recoverable
13 | t.string :reset_password_token
14 | t.datetime :reset_password_sent_at
15 |
16 | ## Rememberable
17 | t.datetime :remember_created_at
18 |
19 | ## Trackable
20 | # t.integer :sign_in_count, default: 0, null: false
21 | # t.datetime :current_sign_in_at
22 | # t.datetime :last_sign_in_at
23 | # t.inet :current_sign_in_ip
24 | # t.inet :last_sign_in_ip
25 |
26 | # Confirmable
27 | t.string :confirmation_token
28 | t.datetime :confirmed_at
29 | t.datetime :confirmation_sent_at
30 | # t.string :unconfirmed_email # Only if using reconfirmable
31 |
32 | ## Lockable
33 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
34 | # t.string :unlock_token # Only if unlock strategy is :email or :both
35 | # t.datetime :locked_at
36 |
37 |
38 | t.timestamps null: false
39 | end
40 |
41 | add_index :users, :email, unique: true
42 | add_index :users, :reset_password_token, unique: true
43 | add_index :users, :confirmation_token, unique: true
44 | # add_index :users, :unlock_token, unique: true
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/db/migrate/20200403102831_create_active_storage_tables.active_storage.rb:
--------------------------------------------------------------------------------
1 | # This migration comes from active_storage (originally 20170806125915)
2 | class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
3 | def change
4 | create_table :active_storage_blobs do |t|
5 | t.string :key, null: false
6 | t.string :filename, null: false
7 | t.string :content_type
8 | t.text :metadata
9 | t.bigint :byte_size, null: false
10 | t.string :checksum, null: false
11 | t.datetime :created_at, null: false
12 |
13 | t.index [ :key ], unique: true
14 | end
15 |
16 | create_table :active_storage_attachments do |t|
17 | t.string :name, null: false
18 | t.references :record, null: false, polymorphic: true, index: false
19 | t.references :blob, null: false
20 |
21 | t.datetime :created_at, null: false
22 |
23 | t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
24 | t.foreign_key :active_storage_blobs, column: :blob_id
25 | end
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/db/migrate/20200403103127_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb:
--------------------------------------------------------------------------------
1 | # This migration comes from active_storage (originally 20180723000244)
2 | class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
3 | def up
4 | return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
5 |
6 | if table_exists?(:active_storage_blobs)
7 | add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # This file is the source Rails uses to define your schema when running `rails
6 | # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7 | # be faster and is potentially less error prone than running all of your
8 | # migrations from scratch. Old migrations may fail to apply correctly if those
9 | # migrations use external dependencies or application code.
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 2020_04_03_103127) do
14 |
15 | # These are extensions that must be enabled in order to support this database
16 | enable_extension "plpgsql"
17 |
18 | create_table "active_storage_attachments", force: :cascade do |t|
19 | t.string "name", null: false
20 | t.string "record_type", null: false
21 | t.bigint "record_id", null: false
22 | t.bigint "blob_id", null: false
23 | t.datetime "created_at", null: false
24 | t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
25 | t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
26 | end
27 |
28 | create_table "active_storage_blobs", force: :cascade do |t|
29 | t.string "key", null: false
30 | t.string "filename", null: false
31 | t.string "content_type"
32 | t.text "metadata"
33 | t.bigint "byte_size", null: false
34 | t.string "checksum", null: false
35 | t.datetime "created_at", null: false
36 | t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
37 | end
38 |
39 | create_table "users", force: :cascade do |t|
40 | t.string "first_name"
41 | t.string "last_name"
42 | t.string "email", default: "", null: false
43 | t.string "encrypted_password", default: "", null: false
44 | t.string "reset_password_token"
45 | t.datetime "reset_password_sent_at"
46 | t.datetime "remember_created_at"
47 | t.string "confirmation_token"
48 | t.datetime "confirmed_at"
49 | t.datetime "confirmation_sent_at"
50 | t.datetime "created_at", null: false
51 | t.datetime "updated_at", null: false
52 | t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
53 | t.index ["email"], name: "index_users_on_email", unique: true
54 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
55 | end
56 |
57 | add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
58 | end
59 |
--------------------------------------------------------------------------------
/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 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 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/lib/tasks/.keep
--------------------------------------------------------------------------------
/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/log/.keep
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "@rails/actioncable": "^6.0.2-2",
4 | "@rails/activestorage": "^6.0.2-2",
5 | "@rails/ujs": "^6.0.2-2",
6 | "@rails/webpacker": "^5.0.1",
7 | "tailwindcss": "^1.9.6",
8 | "turbolinks": "^5.2.0"
9 | },
10 | "devDependencies": {
11 | "@fullhuman/postcss-purgecss": "^2.1.0",
12 | "webpack-dev-server": "^3.10.3"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | let environment = {
2 | plugins: [
3 | require('tailwindcss'),
4 | require('autoprefixer'),
5 | require('postcss-import'),
6 | require('postcss-flexbugs-fixes'),
7 | require('postcss-preset-env')({
8 | autoprefixer: {
9 | flexbox: 'no-2009'
10 | },
11 | stage: 3
12 | }),
13 | ]
14 | }
15 |
16 | // Only run PurgeCSS in production (you can also add staging here)
17 | if (process.env.RAILS_ENV === "production") {
18 | environment.plugins.push(
19 | require('@fullhuman/postcss-purgecss')({
20 | content: [
21 | './app/**/*.html.erb',
22 | './app/helpers/**/*.rb',
23 | './app/javascript/**/*.js',
24 | './app/javascript/**/*.vue',
25 | './app/javascript/**/*.jsx',
26 | ],
27 | defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || []
28 | })
29 | )
30 | }
31 |
32 | module.exports = environment
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 404
5 |
6 |
7 |
8 |
9 |
10 |
14 |
125 |
166 |
167 |
168 |
169 |
170 | 404
171 |
172 |
173 | Oops, the page you're
174 | looking for does not exist.
175 |
176 |
177 |
178 |
179 |
180 |
181 | You may want to head back to the homepage.
182 | If you think something is broken, report a problem.
183 |
190 |
191 |
192 |
--------------------------------------------------------------------------------
/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/public/apple-touch-icon-precomposed.png
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/public/favicon.ico
--------------------------------------------------------------------------------
/public/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/public/logo.png
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 |
--------------------------------------------------------------------------------
/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # This file is copied to spec/ when you run 'rails generate rspec:install'
2 | require 'spec_helper'
3 | ENV['RAILS_ENV'] ||= 'test'
4 | require File.expand_path('../../config/environment', __FILE__)
5 | # Prevent database truncation if the environment is production
6 | abort("The Rails environment is running in production mode!") if Rails.env.production?
7 | require 'rspec/rails'
8 | # Add additional requires below this line. Rails is not loaded until this point!
9 |
10 | # Requires supporting ruby files with custom matchers and macros, etc, in
11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12 | # run as spec files by default. This means that files in spec/support that end
13 | # in _spec.rb will both be required and run as specs, causing the specs to be
14 | # run twice. It is recommended that you do not name files matching this glob to
15 | # end with _spec.rb. You can configure this pattern with the --pattern
16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17 | #
18 | # The following line is provided for convenience purposes. It has the downside
19 | # of increasing the boot-up time by auto-requiring all files in the support
20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
21 | # require only the support files necessary.
22 | #
23 | # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
24 |
25 | # Checks for pending migration and applies them before tests are run.
26 | # If you are not using ActiveRecord, you can remove this line.
27 | ActiveRecord::Migration.maintain_test_schema!
28 |
29 | RSpec.configure do |config|
30 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
31 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
32 |
33 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
34 | # examples within a transaction, remove the following line or assign false
35 | # instead of true.
36 | config.use_transactional_fixtures = true
37 |
38 | # RSpec Rails can automatically mix in different behaviours to your tests
39 | # based on their file location, for example enabling you to call `get` and
40 | # `post` in specs under `spec/controllers`.
41 | #
42 | # You can disable this behaviour by removing the line below, and instead
43 | # explicitly tag your specs with their type, e.g.:
44 | #
45 | # RSpec.describe UsersController, :type => :controller do
46 | # # ...
47 | # end
48 | #
49 | # The different available types are documented in the features, such as in
50 | # https://relishapp.com/rspec/rspec-rails/docs
51 | config.infer_spec_type_from_file_location!
52 |
53 | # Filter lines from Rails gems in backtraces.
54 | config.filter_rails_from_backtrace!
55 | # arbitrary gems may also be filtered via:
56 | # config.filter_gems_from_backtrace("gem name")
57 | end
58 |
59 | Shoulda::Matchers.configure do |config|
60 | config.integrate do |with|
61 | with.test_framework :rspec
62 | with.library :rails
63 | end
64 | end
65 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3 | # The generated `.rspec` file contains `--require spec_helper` which will cause
4 | # this file to always be loaded, without a need to explicitly require it in any
5 | # files.
6 | #
7 | # Given that it is always loaded, you are encouraged to keep this file as
8 | # light-weight as possible. Requiring heavyweight dependencies from this file
9 | # will add to the boot time of your test suite on EVERY test run, even for an
10 | # individual file that may not need all of that loaded. Instead, consider making
11 | # a separate helper file that requires the additional dependencies and performs
12 | # the additional setup, and require it from the spec files that actually need
13 | # it.
14 | #
15 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16 | RSpec.configure do |config|
17 | # rspec-expectations config goes here. You can use an alternate
18 | # assertion/expectation library such as wrong or the stdlib/minitest
19 | # assertions if you prefer.
20 | config.expect_with :rspec do |expectations|
21 | # This option will default to `true` in RSpec 4. It makes the `description`
22 | # and `failure_message` of custom matchers include text for helper methods
23 | # defined using `chain`, e.g.:
24 | # be_bigger_than(2).and_smaller_than(4).description
25 | # # => "be bigger than 2 and smaller than 4"
26 | # ...rather than:
27 | # # => "be bigger than 2"
28 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29 | end
30 |
31 | # rspec-mocks config goes here. You can use an alternate test double
32 | # library (such as bogus or mocha) by changing the `mock_with` option here.
33 | config.mock_with :rspec do |mocks|
34 | # Prevents you from mocking or stubbing a method that does not exist on
35 | # a real object. This is generally recommended, and will default to
36 | # `true` in RSpec 4.
37 | mocks.verify_partial_doubles = true
38 | end
39 |
40 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41 | # have no way to turn it off -- the option exists only for backwards
42 | # compatibility in RSpec 3). It causes shared context metadata to be
43 | # inherited by the metadata hash of host groups and examples, rather than
44 | # triggering implicit auto-inclusion in groups with matching metadata.
45 | config.shared_context_metadata_behavior = :apply_to_host_groups
46 |
47 | config.before(:suite) do
48 | DatabaseCleaner.strategy = :transaction
49 | DatabaseCleaner.clean_with(:truncation)
50 | end
51 |
52 | config.around(:each) do |example|
53 | DatabaseCleaner.cleaning do
54 | example.run
55 | end
56 | end
57 |
58 | # The settings below are suggested to provide a good initial experience
59 | # with RSpec, but feel free to customize to your heart's content.
60 | =begin
61 | # This allows you to limit a spec run to individual examples or groups
62 | # you care about by tagging them with `:focus` metadata. When nothing
63 | # is tagged with `:focus`, all examples get run. RSpec also provides
64 | # aliases for `it`, `describe`, and `context` that include `:focus`
65 | # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
66 | config.filter_run_when_matching :focus
67 |
68 | # Allows RSpec to persist some state between runs in order to support
69 | # the `--only-failures` and `--next-failure` CLI options. We recommend
70 | # you configure your source control system to ignore this file.
71 | config.example_status_persistence_file_path = "spec/examples.txt"
72 |
73 | # Limits the available syntax to the non-monkey patched syntax that is
74 | # recommended. For more details, see:
75 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
76 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
77 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
78 | config.disable_monkey_patching!
79 |
80 | # Many RSpec users commonly either run the entire suite or an individual
81 | # file, and it's useful to allow more verbose output when running an
82 | # individual spec file.
83 | if config.files_to_run.one?
84 | # Use the documentation formatter for detailed output,
85 | # unless a formatter has already been configured
86 | # (e.g. via a command-line flag).
87 | config.default_formatter = "doc"
88 | end
89 |
90 | # Print the 10 slowest examples and example groups at the
91 | # end of the spec run, to help surface which specs are running
92 | # particularly slow.
93 | config.profile_examples = 10
94 |
95 | # Run specs in random order to surface order dependencies. If you find an
96 | # order dependency and want to debug it, you can fix the order by providing
97 | # the seed, which is printed after each run.
98 | # --seed 1234
99 | config.order = :random
100 |
101 | # Seed global randomization in this process using the `--seed` CLI option.
102 | # Setting this allows you to use `--seed` to deterministically reproduce
103 | # test failures related to randomization by passing the same `--seed` value
104 | # as the one that triggered the failure.
105 | Kernel.srand config.seed
106 | =end
107 | end
108 |
--------------------------------------------------------------------------------
/storage/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/storage/.keep
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | theme: {
3 | extend: {},
4 | },
5 | variants: {},
6 | plugins: [],
7 | }
8 |
--------------------------------------------------------------------------------
/test/application_system_test_case.rb:
--------------------------------------------------------------------------------
1 | require "test_helper"
2 |
3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5 | end
6 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/test/controllers/.keep
--------------------------------------------------------------------------------
/test/controllers/pages_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class PagesControllerTest < ActionDispatch::IntegrationTest
4 | test "should get home" do
5 | get pages_home_url
6 | assert_response :success
7 | end
8 |
9 | end
10 |
--------------------------------------------------------------------------------
/test/fixtures/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/test/fixtures/.keep
--------------------------------------------------------------------------------
/test/fixtures/files/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/test/fixtures/files/.keep
--------------------------------------------------------------------------------
/test/fixtures/users.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/test/helpers/.keep
--------------------------------------------------------------------------------
/test/integration/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/test/integration/.keep
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/test/mailers/.keep
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/test/models/.keep
--------------------------------------------------------------------------------
/test/models/user_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class UserTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/system/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/test/system/.keep
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV['RAILS_ENV'] ||= 'test'
2 | require_relative '../config/environment'
3 | require 'rails/test_help'
4 |
5 | class ActiveSupport::TestCase
6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7 | fixtures :all
8 |
9 | # Add more helper methods to be used by all tests here...
10 | end
11 |
--------------------------------------------------------------------------------
/tmp/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/tmp/.keep
--------------------------------------------------------------------------------
/vendor/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelFrigerio/rails-blueprint/6dd03bd0567c4f34c3a3f2f0293a773ccba22983/vendor/.keep
--------------------------------------------------------------------------------