repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/tracking_middleware.rb | lib/tracking_middleware.rb | # frozen_string_literal: true
class TrackingMiddleware
TRACKING_PIXEL = File.read(Rails.root.join("app", "assets", "images", "tracking_pixel.png"))
def initialize(app = nil)
@app = app
end
def call(env)
unless env["HTTP_X_POSTAL_TRACK_HOST"].to_i == 1
return @app.call(env)
end
request... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal.rb | lib/postal.rb | # frozen_string_literal: true
module Postal
end
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/config_schema.rb | lib/postal/config_schema.rb | # frozen_string_literal: true
require "uri"
module Postal
# REMEMBER: If you change the schema, remember to regenerate the configuration docs
# using the rake command below:
#
# rake postal:generate_config_docs
ConfigSchema = Konfig::Schema.draw do
group :postal do
string :web_hostname do
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_parser.rb | lib/postal/message_parser.rb | # frozen_string_literal: true
module Postal
class MessageParser
URL_REGEX = /(?<url>(?<protocol>https?):\/\/(?<domain>[A-Za-z0-9\-.:]+)(?<path>\/[A-Za-z0-9.\/+?&\-_%=~:;()\[\]#]*)?+)/
def initialize(message)
@message = message
@actioned = false
@tracked_links = 0
@tracked_images = 0... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/signer.rb | lib/postal/signer.rb | # frozen_string_literal: true
require "base64"
module Postal
class Signer
# Create a new Signer
#
# @param [OpenSSL::PKey::RSA] private_key The private key to use for signing
# @return [Signer]
def initialize(private_key)
@private_key = private_key
end
# Return the private key
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_inspection.rb | lib/postal/message_inspection.rb | # frozen_string_literal: true
module Postal
class MessageInspection
attr_reader :message
attr_reader :scope
attr_reader :spam_checks
attr_accessor :threat
attr_accessor :threat_message
def initialize(message, scope)
@message = message
@scope = scope
@spam_checks = []
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_inspector.rb | lib/postal/message_inspector.rb | # frozen_string_literal: true
module Postal
class MessageInspector
def initialize(config)
@config = config
end
# Inspect a message and update the inspection with the results
# as appropriate.
def inspect_message(message, scope, inspection)
end
private
def logger
Postal... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/helpers.rb | lib/postal/helpers.rb | # frozen_string_literal: true
module Postal
module Helpers
def self.strip_name_from_address(address)
return nil if address.nil?
address.gsub(/.*</, "").gsub(/>.*/, "").gsub(/\(.+?\)/, "").strip
end
end
end
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/http.rb | lib/postal/http.rb | # frozen_string_literal: true
require "net/https"
require "uri"
module Postal
module HTTP
def self.get(url, options = {})
request(Net::HTTP::Get, url, options)
end
def self.post(url, options = {})
request(Net::HTTP::Post, url, options)
end
def self.request(method, url, options = {... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/spam_check.rb | lib/postal/spam_check.rb | # frozen_string_literal: true
module Postal
class SpamCheck
attr_reader :code, :score, :description
def initialize(code, score, description = nil)
@code = code
@score = score
@description = description
end
def to_hash
{
code: code,
score: score,
desc... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/yaml_config_exporter.rb | lib/postal/yaml_config_exporter.rb | # frozen_string_literal: true
require "konfig/exporters/abstract"
module Postal
class YamlConfigExporter < Konfig::Exporters::Abstract
def export
contents = []
contents << "version: 2"
contents << ""
@schema.groups.each do |group_name, group|
contents << "#{group_name}:"
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/config.rb | lib/postal/config.rb | # frozen_string_literal: true
require "erb"
require "yaml"
require "pathname"
require "cgi"
require "openssl"
require "fileutils"
require "konfig"
require "konfig/sources/environment"
require "konfig/sources/yaml"
require "dotenv"
require "klogger"
require_relative "error"
require_relative "config_schema"
require_rel... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/helm_config_exporter.rb | lib/postal/helm_config_exporter.rb | # frozen_string_literal: true
require "konfig/exporters/abstract"
module Postal
class HelmConfigExporter < Konfig::Exporters::Abstract
def export
contents = []
path = []
@schema.groups.each do |group_name, group|
path << group_name
group.attributes.each do |name, _|
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/legacy_config_source.rb | lib/postal/legacy_config_source.rb | # frozen_string_literal: true
require "konfig/sources/abstract"
require "konfig/error"
module Postal
class LegacyConfigSource < Konfig::Sources::Abstract
# This maps all the new configuration values to where they
# exist in the old YAML file. The source will load any YAML
# file that has been provided ... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/error.rb | lib/postal/error.rb | # frozen_string_literal: true
module Postal
class Error < StandardError
end
module Errors
class AuthenticationError < Error
attr_reader :error
def initialize(error)
super()
@error = error
end
def to_s
"Authentication Failed: #{@error}"
end
end
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/webhooks.rb | lib/postal/message_db/webhooks.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Webhooks
def initialize(database)
@database = database
end
def record(attributes = {})
@database.insert(:webhook_requests, attributes)
end
def list(page = 1)
result = @database.select_with_... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/load.rb | lib/postal/message_db/load.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Load
def initialize(attributes)
@ip_address = attributes["ip_address"]
@user_agent = attributes["user_agent"]
@timestamp = Time.zone.at(attributes["timestamp"])
end
attr_reader :ip_address
attr_re... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/statistics.rb | lib/postal/message_db/statistics.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Statistics
def initialize(database)
@database = database
end
STATS_GAPS = { hourly: :hour, daily: :day, monthly: :month, yearly: :year }.freeze
COUNTERS = [:incoming, :outgoing, :spam, :bounces, :held].freeze
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/connection_pool.rb | lib/postal/message_db/connection_pool.rb | # frozen_string_literal: true
module Postal
module MessageDB
class ConnectionPool
attr_reader :connections
def initialize
@connections = []
@lock = Mutex.new
end
def use
retried = false
do_not_checkin = false
begin
connection = checkout... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/suppression_list.rb | lib/postal/message_db/suppression_list.rb | # frozen_string_literal: true
module Postal
module MessageDB
class SuppressionList
def initialize(database)
@database = database
end
def add(type, address, options = {})
keep_until = (options[:days] || Postal::Config.postal.default_suppression_list_automatic_removal_days).days... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/message.rb | lib/postal/message_db/message.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Message
class NotFound < Postal::Error
end
def self.find_one(database, query)
query = { id: query.to_i } if query.is_a?(Integer)
raise NotFound, "No message found matching provided query #{query}" unless messag... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/provisioner.rb | lib/postal/message_db/provisioner.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Provisioner
def initialize(database)
@database = database
end
#
# Provisions a new database
#
def provision
drop
create
migrate(silent: true)
end
#
# Migrate... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/delivery.rb | lib/postal/message_db/delivery.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Delivery
def self.create(message, attributes = {})
attributes = message.database.stringify_keys(attributes)
attributes = attributes.merge("message_id" => message.id, "timestamp" => Time.now.to_f)
# Ensure that outp... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/live_stats.rb | lib/postal/message_db/live_stats.rb | # frozen_string_literal: true
module Postal
module MessageDB
class LiveStats
def initialize(database)
@database = database
end
#
# Increment the live stats by one for the current minute
#
def increment(type)
time = Time.now.utc
type = @database.escape... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migration.rb | lib/postal/message_db/migration.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Migration
def initialize(database)
@database = database
end
def up
end
def self.run(database, start_from: database.schema_version, silent: false)
files = Dir[Rails.root.join("lib", "postal", "messa... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/click.rb | lib/postal/message_db/click.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Click
def initialize(attributes, link)
@url = link["url"]
@ip_address = attributes["ip_address"]
@user_agent = attributes["user_agent"]
@timestamp = Time.zone.at(attributes["timestamp"])
end
att... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/database.rb | lib/postal/message_db/database.rb | # frozen_string_literal: true
module Postal
module MessageDB
class Database
class << self
def connection_pool
@connection_pool ||= ConnectionPool.new
end
end
def initialize(organization_id, server_id, database_name: nil)
@organization_id = organization_id
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/11_add_time_to_deliveries.rb | lib/postal/message_db/migrations/11_add_time_to_deliveries.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class AddTimeToDeliveries < Postal::MessageDB::Migration
def up
@database.query("ALTER TABLE `#{@database.database_name}`.`deliveries` ADD COLUMN `time` decimal(8,2)")
end
end
end
end
end
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/08_create_stats.rb | lib/postal/message_db/migrations/08_create_stats.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateStats < Postal::MessageDB::Migration
def up
[:hourly, :daily, :monthly, :yearly].each do |table_name|
@database.provisioner.create_table("stats_#{table_name}",
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/09_create_links.rb | lib/postal/message_db/migrations/09_create_links.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateLinks < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:links,
columns: {
id: "in... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/16_add_url_and_hook_to_webhooks.rb | lib/postal/message_db/migrations/16_add_url_and_hook_to_webhooks.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class AddUrlAndHookToWebhooks < Postal::MessageDB::Migration
def up
@database.query("ALTER TABLE `#{@database.database_name}`.`webhook_requests` ADD COLUMN `url` varchar(255)")
@database.query("ALTER... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/01_create_migrations.rb | lib/postal/message_db/migrations/01_create_migrations.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateMigrations < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:migrations,
columns: {
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/14_create_suppressions.rb | lib/postal/message_db/migrations/14_create_suppressions.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateSuppressions < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:suppressions,
columns: {
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/06_create_clicks.rb | lib/postal/message_db/migrations/06_create_clicks.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateClicks < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:clicks,
columns: {
id: "... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/04_create_live_stats.rb | lib/postal/message_db/migrations/04_create_live_stats.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateLiveStats < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:live_stats,
columns: {
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/15_create_webhook_requests.rb | lib/postal/message_db/migrations/15_create_webhook_requests.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateWebhookRequests < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:webhook_requests,
columns: {
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/12_add_hold_expiry.rb | lib/postal/message_db/migrations/12_add_hold_expiry.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class AddHoldExpiry < Postal::MessageDB::Migration
def up
@database.query("ALTER TABLE `#{@database.database_name}`.`messages` ADD COLUMN `hold_expiry` decimal(18,6)")
end
end
end
end
end
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/02_create_messages.rb | lib/postal/message_db/migrations/02_create_messages.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateMessages < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:messages,
columns: {
i... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/19_convert_database_to_utf8mb4.rb | lib/postal/message_db/migrations/19_convert_database_to_utf8mb4.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class ConvertDatabaseToUtf8mb4 < Postal::MessageDB::Migration
def up
@database.query("ALTER DATABASE `#{@database.database_name}` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci")
@database.query("A... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/13_add_index_to_message_status.rb | lib/postal/message_db/migrations/13_add_index_to_message_status.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class AddIndexToMessageStatus < Postal::MessageDB::Migration
def up
@database.query("ALTER TABLE `#{@database.database_name}`.`messages` ADD INDEX `on_status` (`status`(8)) USING BTREE")
end
end... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/03_create_deliveries.rb | lib/postal/message_db/migrations/03_create_deliveries.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateDeliveries < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:deliveries,
columns: {
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/17_add_replaced_link_count_to_messages.rb | lib/postal/message_db/migrations/17_add_replaced_link_count_to_messages.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class AddReplacedLinkCountToMessages < Postal::MessageDB::Migration
def up
@database.query("ALTER TABLE `#{@database.database_name}`.`messages` ADD COLUMN `tracked_links` int(11) DEFAULT 0")
@databas... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/10_create_spam_checks.rb | lib/postal/message_db/migrations/10_create_spam_checks.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateSpamChecks < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:spam_checks,
columns: {
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/20_increase_links_url_size.rb | lib/postal/message_db/migrations/20_increase_links_url_size.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class IncreaseLinksUrlSize < Postal::MessageDB::Migration
def up
@database.query("ALTER TABLE `#{@database.database_name}`.`links` MODIFY `url` TEXT")
end
end
end
end
end
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/18_add_endpoints_to_messages.rb | lib/postal/message_db/migrations/18_add_endpoints_to_messages.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class AddEndpointsToMessages < Postal::MessageDB::Migration
def up
@database.query("ALTER TABLE `#{@database.database_name}`.`messages` ADD COLUMN `endpoint_id` int(11), ADD COLUMN `endpoint_type` varchar(255)... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/05_create_raw_message_sizes.rb | lib/postal/message_db/migrations/05_create_raw_message_sizes.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateRawMessageSizes < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:raw_message_sizes,
columns: {
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_db/migrations/07_create_loads.rb | lib/postal/message_db/migrations/07_create_loads.rb | # frozen_string_literal: true
module Postal
module MessageDB
module Migrations
class CreateLoads < Postal::MessageDB::Migration
def up
@database.provisioner.create_table(:loads,
columns: {
id: "in... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_inspectors/clamav.rb | lib/postal/message_inspectors/clamav.rb | # frozen_string_literal: true
module Postal
module MessageInspectors
class Clamav < MessageInspector
def inspect_message(inspection)
raw_message = inspection.message.raw_message
data = nil
Timeout.timeout(10) do
tcp_socket = TCPSocket.new(@config.host, @config.port)
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_inspectors/spam_assassin.rb | lib/postal/message_inspectors/spam_assassin.rb | # frozen_string_literal: true
module Postal
module MessageInspectors
class SpamAssassin < MessageInspector
EXCLUSIONS = {
outgoing: ["NO_RECEIVED", "NO_RELAYS", "ALL_TRUSTED", "FREEMAIL_FORGED_REPLYTO", "RDNS_DYNAMIC", "CK_HELO_GENERIC", /^SPF_/, /^HELO_/, /DKIM_/, /^RCVD_IN_/],
incoming: ... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/lib/postal/message_inspectors/rspamd.rb | lib/postal/message_inspectors/rspamd.rb | # frozen_string_literal: true
require "net/http"
module Postal
module MessageInspectors
class Rspamd < MessageInspector
class Error < StandardError
end
def inspect_message(inspection)
response = request(inspection.message, inspection.scope)
response = JSON.parse(response.body... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/application.rb | config/application.rb | # frozen_string_literal: true
require_relative "boot"
require "rails"
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# Require the gems listed in Gemfile, including any gems
#... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/environment.rb | config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/puma.rb | config/puma.rb | # frozen_string_literal: true
require_relative "../lib/postal/config"
threads_count = Postal::Config.web_server.max_threads
threads threads_count, threads_count
bind_address = ENV.fetch("BIND_ADDRESS", Postal::Config.web_server.default_bind_address)
bind_port = ENV.fetch("PORT", Postal::Config.web_server... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
# Legacy API Routes
match "/api/v1/send/message" => "legacy_api/send#message", via: [:get, :post, :patch, :put]
match "/api/v1/send/raw" => "legacy_api/send#raw", via: [:get, :post, :patch, :put]
match "/api/v1/messages/message" => "legacy_api/mess... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/boot.rb | config/boot.rb | # frozen_string_literal: true
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require_relative "../lib/postal/config"
ENV["RAILS_ENV"] = Postal::Config.rails.environment || "development"
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure ... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/application_controller_renderer.rb | config/initializers/application_controller_renderer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/new_framework_defaults_7_0.rb | config/initializers/new_framework_defaults_7_0.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/secure_headers.rb | config/initializers/secure_headers.rb | # frozen_string_literal: true
SecureHeaders::Configuration.default do |config|
config.hsts = SecureHeaders::OPT_OUT
config.csp[:default_src] = []
config.csp[:script_src] = ["'self'"]
config.csp[:child_src] = ["'self'"]
config.csp[:connect_src] = ["'self'"]
end
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/session_store.rb | config/initializers/session_store.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: "_postal_session"
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/_wait_for_migrations.rb | config/initializers/_wait_for_migrations.rb | # frozen_string_literal: true
require "migration_waiter"
MigrationWaiter.wait_if_appropriate
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/logging.rb | config/initializers/logging.rb | # frozen_string_literal: true
begin
def add_exception_to_payload(payload, event)
return unless exception = event.payload[:exception_object]
payload[:exception_class] = exception.class.name
payload[:exception_message] = exception.message
payload[:exception_backtrace] = exception.backtrace[0, 4].join(... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/trusted_proxies.rb | config/initializers/trusted_proxies.rb | # frozen_string_literal: true
Rack::Request.ip_filter = lambda { |ip|
if Postal::Config.postal.trusted_proxies&.any? { |net| net.include?(ip) } ||
ip.match(/\A127\.0\.0\.1\Z|\A::1\Z|\Afd[0-9a-f]{2}:.+|\Alocalhost\Z|\Aunix\Z|\Aunix:/i)
true
else
false
end
}
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/record_key_for_dom.rb | config/initializers/record_key_for_dom.rb | # frozen_string_literal: true
module ActionView
module RecordIdentifier
def dom_id(record, prefix = nil)
if record.new_record?
dom_class(record, prefix || NEW)
else
id = record.respond_to?(:uuid) ? record.uuid : record.id
"#{dom_class(record, prefix)}#{JOIN}#{id}"
end
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/wrap_parameters.rb | config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_con... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/omniauth.rb | config/initializers/omniauth.rb | # frozen_string_literal: true
config = Postal::Config.oidc
if config.enabled?
client_options = { identifier: config.identifier, secret: config.secret }
client_options[:redirect_uri] = "#{Postal::Config.postal.web_protocol}://#{Postal::Config.postal.web_hostname}/auth/oidc/callback"
unless config.discovery?
... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/inflections.rb | config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflec... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/smtp.rb | config/initializers/smtp.rb | # frozen_string_literal: true
require "postal/config"
config = Postal::Config.smtp
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: config.host,
user_name: config.username,
password: config.password,
port: config.port,
authentication: config.authentication_type&.to_s... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/cookies_serializer.rb | config/initializers/cookies_serializer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/permissions_policy.rb | config/initializers/permissions_policy.rb | # frozen_string_literal: true
# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb ... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/assets.rb | config/initializers/assets.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/smtp_extensions.rb | config/initializers/smtp_extensions.rb | # frozen_string_literal: true
module Net
class SMTP
attr_accessor :source_address
def secure_socket?
return false unless @socket
@socket.io.is_a?(OpenSSL::SSL::SSLSocket)
end
#
# We had an issue where a message was sent to a server and was greylisted. It returned
# a Net::SMTP... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/zeitwerk.rb | config/initializers/zeitwerk.rb | # frozen_string_literal: true
Rails.autoloaders.each do |autoloader|
# Ignore the message DB migrations directory as it doesn't follow
# Zeitwerk's conventions and is always loaded and executed in order.
autoloader.ignore(Rails.root.join("lib/postal/message_db/migrations"))
end
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/sentry.rb | config/initializers/sentry.rb | # frozen_string_literal: true
require "postal/config"
if Postal::Config.logging.sentry_dsn
Sentry.init do |config|
config.dsn = Postal::Config.logging.sentry_dsn
end
end
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if ... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/mail_extensions.rb | config/initializers/mail_extensions.rb | # frozen_string_literal: true
require "mail"
module Mail
module Encodings
# Handle windows-1258 as windows-1252 when decoding
def self.q_value_decode(str)
str = str.sub(/=\?windows-?1258\?/i, '\=?windows-1252?')
Utilities.q_value_decode(str)
end
def self.b_value_decode(str)
str =... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/secret_key.rb | config/initializers/secret_key.rb | # frozen_string_literal: true
if Postal::Config.rails.secret_key
Rails.application.credentials.secret_key_base = Postal::Config.rails.secret_key
else
warn "No secret key was specified in the Postal config file. Using one for just this session"
Rails.application.credentials.secret_key_base = SecureRandom.hex(128)... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/initializers/postal.rb | config/initializers/postal.rb | # frozen_string_literal: true
require "postal"
| ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/environments/test.rb | config/environments/test.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "s... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/environments/development.rb | config/environments/development.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
postalserver/postal | https://github.com/postalserver/postal/blob/b7e5232e077b3c9b7a999dcb6676fba0ec61458e/config/environments/production.rb | config/environments/production.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot. This eager loads most of Rails and
# your application in memor... | ruby | MIT | b7e5232e077b3c9b7a999dcb6676fba0ec61458e | 2026-01-04T15:37:27.414740Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require "pry"
require "simplecov"
SimpleCov.start do
if ENV["CI"]
formatter SimpleCov::Formatter::SimpleFormatter
else
formatter SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::SimpleFormatter,
... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/factories/projects.rb | spec/factories/projects.rb | # frozen_string_literal: true
def yaml_load(file)
YAML.safe_load(File.read(File.expand_path(file)))
end
FactoryBot.define do
factory :project, class: Tmuxinator::Project do
transient do
file { yaml_load("spec/fixtures/sample.yml") }
end
initialize_with { Tmuxinator::Project.new(file) }
end
... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/matchers/pane_matcher.rb | spec/matchers/pane_matcher.rb | # frozen_string_literal: true
RSpec::Matchers.alias_matcher :be_a_pane, :a_pane
RSpec::Matchers.define :a_pane do
attr_reader :commands
match do
result = is_pane
result && attributes_match if @expected_attrs
result &&= commands_match if commands
result
end
failure_message do |actual|
re... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/hooks_spec.rb | spec/lib/tmuxinator/hooks_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::Hooks do
describe "#commands_from" do
let(:project) { FactoryBot.build(:project) }
let(:hook_name) { "generic_hook" }
context "config value is string" do
before { project.yaml[hook_name] = "echo 'on hook'" }
it "retur... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/doctor_spec.rb | spec/lib/tmuxinator/doctor_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::Doctor do
describe ".installed?" do
context "tmux is installed" do
before do
allow(Kernel).to receive(:system) { true }
end
it "returns true" do
expect(described_class.installed?).to be_truthy
end
... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/project_spec.rb | spec/lib/tmuxinator/project_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::Project do
let(:project) { FactoryBot.build(:project) }
let(:project_with_custom_name) do
FactoryBot.build(:project_with_custom_name)
end
let(:project_with_number_as_name) do
FactoryBot.build(:project_with_number_as_name)
end
... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/pane_spec.rb | spec/lib/tmuxinator/pane_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::Pane do
let(:klass) { described_class }
let(:instance) { klass.new(index, project, window, *commands) }
let(:instance_with_title) do
klass.new(index, project, window, *commands, title: title)
end
let(:index) { 0 }
let(:project) {... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/cli_spec.rb | spec/lib/tmuxinator/cli_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::Cli do
shared_context :local_project_setup do
let(:local_project_config) { ".tmuxinator.yml" }
let(:content_fixture) { "../../fixtures/sample.yml" }
let(:content_relpath) { File.join(File.dirname(__FILE__), content_fixture) }
l... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | true |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/util_spec.rb | spec/lib/tmuxinator/util_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::Util do
let(:util) { Object.new.extend(Tmuxinator::Util) }
end
| ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/wemux_support_spec.rb | spec/lib/tmuxinator/wemux_support_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::WemuxSupport do
let(:klass) { Class.new }
let(:instance) { klass.new }
before { instance.extend Tmuxinator::WemuxSupport }
describe "#render" do
it "renders the template" do
expect(File).to receive(:read).at_least(:once) { "w... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/config_spec.rb | spec/lib/tmuxinator/config_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::Config do
let(:fixtures_dir) { File.expand_path("../../fixtures", __dir__) }
let(:xdg_config_dir) { "#{fixtures_dir}/xdg-tmuxinator" }
let(:home_config_dir) { "#{fixtures_dir}/dot-tmuxinator" }
describe "#directory" do
context "envi... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/window_spec.rb | spec/lib/tmuxinator/window_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Tmuxinator::Window do
let(:project) { double }
let(:panes) { ["vim", nil, "top"] }
let(:window_name) { "editor" }
let(:synchronize) { false }
let(:root) {}
let(:root?) { root }
let(:yaml) do
{
window_name => {
"pre" => [
... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/spec/lib/tmuxinator/hooks/project_spec.rb | spec/lib/tmuxinator/hooks/project_spec.rb | # frozen_string_literal: true
require "spec_helper"
shared_examples_for "a project hook" do
let(:project) { FactoryBot.build(:project) }
it "calls Hooks.commands_from" do
expect(Tmuxinator::Hooks).to receive(:commands_from).
with(kind_of(Tmuxinator::Project), hook_name).once
project.send("hook_#{ho... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator.rb | lib/tmuxinator.rb | # frozen_string_literal: true
require "erubi"
require "fileutils"
require "shellwords"
require "thor"
require "thor/version"
require "yaml"
module Tmuxinator
end
require "tmuxinator/tmux_version"
require "tmuxinator/util"
require "tmuxinator/deprecations"
require "tmuxinator/wemux_support"
require "tmuxinator/cli"
r... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/version.rb | lib/tmuxinator/version.rb | # frozen_string_literal: true
module Tmuxinator
VERSION = "3.3.7"
end
| ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/project.rb | lib/tmuxinator/project.rb | # frozen_string_literal: true
module Tmuxinator
class Project
include Tmuxinator::Util
include Tmuxinator::Deprecations
include Tmuxinator::Hooks::Project
RBENVRVM_DEP_MSG = <<-M
DEPRECATION: rbenv/rvm-specific options have been replaced by the
`pre_tab` option and will not be supported in 0... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/doctor.rb | lib/tmuxinator/doctor.rb | # frozen_string_literal: true
module Tmuxinator
class Doctor
class << self
def editor?
!ENV["EDITOR"].nil? && !ENV["EDITOR"].empty?
end
def installed?
Kernel.system("type tmux > /dev/null")
end
def shell?
!ENV["SHELL"].nil? && !ENV["SHELL"].empty?
end... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.