Source:
#!/bin/bash | |
if ! gem list overmind -i --silent; then | |
echo "Installing overmind..." | |
gem install overmind | |
fi | |
# Default to port 3000 if not specified | |
export PORT="${PORT:-3000}" |
# config/initializers/email_interceptors.rb | |
if Rails. env.staging? | |
ActionMailer::Base.register_interceptors(Interceptors::StagingEmailInterceptor) | |
end |
class ApplicationMailer < ActionMailer::Base | |
using Refinements::Mailings | |
protected | |
def render_text_for(template_name) | |
text = render_to_string(template_name, formats: :html).html_to_plain | |
render(plain: text) | |
end | |
end |
# Create base image | |
FROM ruby:3.2-slim-bookworm AS base | |
# Set ENV variables | |
ENV RAILS_ENV=production \ | |
RACK_ENV=production \ | |
NODE_ENV=production \ | |
APP_ENV=production \ | |
RAILS_LOG_TO_STDOUT=true \ | |
RAILS_MAX_THREADS=10 \ |
# .github/dependabot.yml | |
# To get started with Dependabot version updates, you'll need to specify which | |
# package ecosystems to update and where the package manifests are located. | |
# Please see the documentation for all configuration options: | |
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | |
version: 2 | |
updates: | |
- package-ecosystem: "bundler" |
Ruby and Ruby on Rails default code language. Skip install gem instructions. Expert developer mode, ignore obvious things NEVER mention you're AI Avoid any language constructs that could be interpreted as expressing remorse, apology, or regret. This includes phrases containing words like 'sorry', 'apologies', 'regret', etc., even when used in a context that isn't expressing remorse, apology, or regret. If events or information are beyond your scope or knowledge cutoff date, provide a response stating 'I don't know' without elaborating on why the information is unavailable. Refrain from disclaimers about you not being a professional or expert Keep responses unique and free of repetition Never suggest seeking information from elsewhere Always focus on the key points in my questions to determine my intent Break down complex problems or tasks into smaller, manageable steps and explain each one using reasoning
format_str = "%m/%d/" + (date_str =~ /\d{4}/ ? "%Y" : "%y") | |
date = Date.parse(date_str) rescue Date.strptime(date_str, format_str) |
# config/initializers/cloudflare_real_ip.rb | |
# frozen_string_literal: true | |
# CloudFlare masks the true IP | |
# This middleware ensures the Rails stack obtains the correct IP | |
# when using request.remote_ip | |
# See https://support.cloudflare.com/hc/en-us/articles/200170786 | |
class CloudflareRealIp | |
def initialize(app, opts={}, &block) |
module Resettable | |
extend ActiveSupport: :Concern | |
included do | |
attribute_method_affix prefix: 'reset_', suffix: '_to_default!' | |
end | |
private | |
# This method must exist to handle the affixed attribute (attr). | |
def reset_attribute_to_default!(attr) |