Skip to content

Instantly share code, notes, and snippets.

@mpvosseller
mpvosseller / create_heroku_app.rb
Last active January 2, 2023 19:34
Ruby function to create a new Heroku app with the Heroku Platform API
# Function to create a new Heroku app instance using the ruby Heroku Platform API
#
# Documentation:
# https://devcenter.heroku.com/articles/setting-up-apps-using-the-heroku-platform-api
# https://devcenter.heroku.com/articles/platform-api-reference#app-setup
# https://github.com/heroku/platform-api
# https://heroku.github.io/platform-api
#
# Add the gem 'platform-api'
require "platform-api"
@mpvosseller
mpvosseller / loadAppEnv.js
Last active April 26, 2023 21:06
Add support to Next.js for multiple "app environments" .env files (development, preview, staging, production)
// loadAppEnv.js
const fs = require('fs')
const dotenvFlow = require('dotenv-flow')
// This module loads .env files from the config/ directory based the "app
// environment" that it is being built for or is running in (e.g. development,
// preview, staging, beta, canary, production, etc..). The "app environment"
// is determined by APP_ENV (if defined) or NODE_ENV. It exports a set of
// environment variables which should be passed to Next.js as the env config.
//
require "rails_helper"
# https://mvaragnat.medium.com/rails-6-and-rspec-how-to-test-zeitwerk-mode-81782b6d3388
describe "Zeitwerk" do
it "eager loads all files" do
# like running `bin/rails zeitwerk:check`
expect { Zeitwerk::Loader.eager_load_all }.not_to raise_error
end
end