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 |
|---|---|---|---|---|---|---|---|---|
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/app/models/application_record.rb | spec/internal/rails_7_2/app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/app/models/model.rb | spec/internal/rails_7_2/app/models/model.rb | # frozen_string_literal: true
class Model < ApplicationRecord
end
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/db/seeds.rb | spec/internal/rails_7_2/db/seeds.rb | # This file should ensure the existence of records required to run the application in every environment (production,
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
# The data can then be loaded with the bin/rails db:seed command (or created alongsi... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/db/schema.rb | spec/internal/rails_7_2/db/schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_table :models
end
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/application.rb | spec/internal/rails_7_2/config/application.rb | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/environment.rb | spec/internal/rails_7_2/config/environment.rb | # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/puma.rb | spec/internal/rails_7_2/config/puma.rb | # This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
# Puma can serve each request in a thread from an internal thread pool.
# The `threa... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/routes.rb | spec/internal/rails_7_2/config/routes.rb | Rails.application.routes.draw do
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/boot.rb | spec/internal/rails_7_2/config/boot.rb | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require 'safer_rails_console/patches/boot'
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/initializers/content_security_policy.rb | spec/internal/rails_7_2/config/initializers/content_security_policy.rb | # 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 do
# config.content_security... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/initializers/filter_parameter_logging.rb | spec/internal/rails_7_2/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behav... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/initializers/inflections.rb | spec/internal/rails_7_2/config/initializers/inflections.rb | # 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::Inflector.inflections(:en) do |inflec... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/initializers/permissions_policy.rb | spec/internal/rails_7_2/config/initializers/permissions_policy.rb | # Be sure to restart your server when you modify this file.
# 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 |policy|
# policy.camera :none
# policy.gyroscope ... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/environments/test.rb | spec/internal/rails_7_2/config/environments/test.rb | require "active_support/core_ext/integer/time"
# 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 "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data the... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/environments/development.rb | spec/internal/rails_7_2/config/environments/development.rb | require "active_support/core_ext/integer/time"
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 any time
# it changes. This slows down response time but is perfect for developme... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/internal/rails_7_2/config/environments/production.rb | spec/internal/rails_7_2/config/environments/production.rb | require "active_support/core_ext/integer/time"
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 app... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/safer_rails_console/console_spec.rb | spec/safer_rails_console/console_spec.rb | # frozen_string_literal: true
describe SaferRailsConsole::Console do
describe ".initialize_sandbox" do
it "loads sandbox patches" do
expect(defined?(SaferRailsConsole::Patches::Sandbox)).to be_nil
suppress(Exception) { described_class.initialize_sandbox }
expect(defined?(SaferRailsConsole::Pa... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/safer_rails_console/colors_spec.rb | spec/safer_rails_console/colors_spec.rb | # frozen_string_literal: true
describe SaferRailsConsole::Colors do
let(:class_with_colors) do
Class.new.include(SaferRailsConsole::Colors)
end
let(:sample_text) { 'some input' }
let(:expected_output) { "\e[#{described_class::RED}m#{sample_text}\e[0m" }
specify "color constants are defined" do
expe... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/safer_rails_console/rails_version_spec.rb | spec/safer_rails_console/rails_version_spec.rb | # frozen_string_literal: true
describe SaferRailsConsole::RailsVersion do
before do
stub_const("#{described_class.name}::RAILS_VERSION", Gem::Version.new(rails_version))
# Reset memoized class instance variables - in practicality these should never change
described_class.instance_variables.each do |var|... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/spec/contexts/db_sandbox.rb | spec/contexts/db_sandbox.rb | # frozen_string_literal: true
shared_context "db sandbox context" do
let(:adapter) {}
shared_examples_for "auto_rollback" do
it "automatically executes rollback and begins a new transaction after executing a invalid SQL statement" do
run_console_commands('Model.create!', 'Model.where(invalid: :statement... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console.rb | lib/safer_rails_console.rb | # frozen_string_literal: true
require 'safer_rails_console/version'
require 'safer_rails_console/railtie'
require 'safer_rails_console/colors'
require 'safer_rails_console/rails_version'
require 'safer_rails_console/console'
require 'active_model/type'
module SaferRailsConsole
class << self
def environment_name... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/rails_version.rb | lib/safer_rails_console/rails_version.rb | # frozen_string_literal: true
require 'rails'
module SaferRailsConsole
module RailsVersion
RAILS_VERSION = Gem::Version.new(::Rails.version)
class << self
def supported?
six_or_above?
end
def six_or_above?
return @six_or_above if defined?(@six_or_above)
@six_or_a... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/version.rb | lib/safer_rails_console/version.rb | # frozen_string_literal: true
module SaferRailsConsole
VERSION = '0.13.0'
end
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/console.rb | lib/safer_rails_console/console.rb | # frozen_string_literal: true
module SaferRailsConsole
module Console
class << self
include SaferRailsConsole::Colors
def initialize_sandbox
require 'safer_rails_console/patches/sandbox'
end
def print_warning
puts color_text(SaferRailsConsole.warn_text, SaferRailsConsole... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/railtie.rb | lib/safer_rails_console/railtie.rb | # frozen_string_literal: true
require 'rails'
require 'safer_rails_console'
module SaferRailsConsole
class Railtie < ::Rails::Railtie
railtie_name :safer_rails_console
config.safer_rails_console = ActiveSupport::OrderedOptions.new
initializer 'safer_rails_console.configure' do |app|
SaferRailsCo... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/colors.rb | lib/safer_rails_console/colors.rb | # frozen_string_literal: true
module SaferRailsConsole
module Colors
extend self
NONE = 0
BLACK = 30
RED = 31
GREEN = 32
YELLOW = 33
BLUE = 34
PINK = 35
CYAN = 36
WHITE = 37
def color_text(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end
end
end
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/consoles/irb.rb | lib/safer_rails_console/consoles/irb.rb | # frozen_string_literal: true
app_name = ::Rails.application.class.module_parent.to_s.underscore.dasherize
env_name = SaferRailsConsole.environment_name
status = ::Rails.application.sandbox ? 'read-only' : 'writable'
color = SaferRailsConsole.prompt_color
prompt = "#{app_name}(#{env_name})(#{status}):%03n:%i"
IRB.co... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/patches/sandbox.rb | lib/safer_rails_console/patches/sandbox.rb | # frozen_string_literal: true
Dir[File.join(__dir__, 'sandbox', '*.rb')].sort.each { |file| require file }
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/patches/railtie.rb | lib/safer_rails_console/patches/railtie.rb | # frozen_string_literal: true
Dir[File.join(__dir__, 'railtie', '*.rb')].sort.each { |file| require file }
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/patches/boot.rb | lib/safer_rails_console/patches/boot.rb | # frozen_string_literal: true
Dir[File.join(__dir__, 'boot', '*.rb')].sort.each { |file| require file }
| ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/patches/railtie/sandbox.rb | lib/safer_rails_console/patches/railtie/sandbox.rb | # frozen_string_literal: true
module SaferRailsConsole
module Patches
module Sandbox
module Rails
module Console
def start(*args)
options = args.last
if options[:sandbox].nil?
options[:sandbox] = if options[:'read-only']
... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/patches/boot/sandbox_flag.rb | lib/safer_rails_console/patches/boot/sandbox_flag.rb | # frozen_string_literal: true
require 'safer_rails_console/rails_version'
if SaferRailsConsole::RailsVersion.supported?
require 'rails/command'
require 'rails/commands/console/console_command'
# Rails defaults `sandbox` to `false`, but we need it to NOT have a default value and
# be `nil` when it is not user-... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/patches/sandbox/auto_rollback.rb | lib/safer_rails_console/patches/sandbox/auto_rollback.rb | # frozen_string_literal: true
module SaferRailsConsole
module Patches
module Sandbox
module AutoRollback
def self.rollback_and_begin_new_transaction
connection = ::ActiveRecord::Base.connection
connection.rollback_db_transaction
connection.begin_db_transaction
... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
salsify/safer_rails_console | https://github.com/salsify/safer_rails_console/blob/31d88c2ea836114bf6244e923b74aa4098a12136/lib/safer_rails_console/patches/sandbox/transaction_read_only.rb | lib/safer_rails_console/patches/sandbox/transaction_read_only.rb | # frozen_string_literal: true
module SaferRailsConsole
module Patches
module Sandbox
module TransactionReadOnly
module PostgreSQLAdapterPatch
def begin_db_transaction
super
execute 'SET TRANSACTION READ ONLY'
end
end
module MySQLPatch
... | ruby | MIT | 31d88c2ea836114bf6244e923b74aa4098a12136 | 2026-01-04T17:34:59.569870Z | false |
Shopify/gvltools | https://github.com/Shopify/gvltools/blob/2064ad8993f06e892bf2fbfe6a07944657d9d42c/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
module StrictWarnings
def warn(message)
return if message.include?("redefining 'object_id' may cause serious problems") # From minitest
raise message
end
end
Warning.singleton_class.prepend(StrictWarnings)
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "gvlto... | ruby | MIT | 2064ad8993f06e892bf2fbfe6a07944657d9d42c | 2026-01-04T17:35:04.857145Z | false |
Shopify/gvltools | https://github.com/Shopify/gvltools/blob/2064ad8993f06e892bf2fbfe6a07944657d9d42c/test/gvl_tools/test_timer.rb | test/gvl_tools/test_timer.rb | # frozen_string_literal: true
require "test_helper"
module GVLTools
class TestTimer < Minitest::Test
include GVLToolsTestHelper
def teardown
GlobalTimer.disable
LocalTimer.disable
GlobalTimer.reset
LocalTimer.reset
end
def test_global_timer
assert_equal 0, GlobalTimer... | ruby | MIT | 2064ad8993f06e892bf2fbfe6a07944657d9d42c | 2026-01-04T17:35:04.857145Z | false |
Shopify/gvltools | https://github.com/Shopify/gvltools/blob/2064ad8993f06e892bf2fbfe6a07944657d9d42c/test/gvl_tools/test_waiting_threads.rb | test/gvl_tools/test_waiting_threads.rb | # frozen_string_literal: true
require "test_helper"
module GVLTools
class TestWaitingThreads < Minitest::Test
include GVLToolsTestHelper
def teardown
WaitingThreads.disable
WaitingThreads.reset
end
def test_waiting_threads
WaitingThreads.enable
assert_equal 0, WaitingThread... | ruby | MIT | 2064ad8993f06e892bf2fbfe6a07944657d9d42c | 2026-01-04T17:35:04.857145Z | false |
Shopify/gvltools | https://github.com/Shopify/gvltools/blob/2064ad8993f06e892bf2fbfe6a07944657d9d42c/test/fallback/test_metrics.rb | test/fallback/test_metrics.rb | # frozen_string_literal: true
require "test_helper"
module GVLTools
class TestMetrics < Minitest::Test
def global_timer_has_working_interface
assert_basic_interface(GlobalTimer)
assert_equal 0, GlobalTimer.monotonic_time
end
def local_timer_has_working_interface
assert_basic_interface... | ruby | MIT | 2064ad8993f06e892bf2fbfe6a07944657d9d42c | 2026-01-04T17:35:04.857145Z | false |
Shopify/gvltools | https://github.com/Shopify/gvltools/blob/2064ad8993f06e892bf2fbfe6a07944657d9d42c/test/fallback/test_gvl_tools.rb | test/fallback/test_gvl_tools.rb | # frozen_string_literal: true
require "test_helper"
class TestGVLTools < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::GVLTools::VERSION
end
end
| ruby | MIT | 2064ad8993f06e892bf2fbfe6a07944657d9d42c | 2026-01-04T17:35:04.857145Z | false |
Shopify/gvltools | https://github.com/Shopify/gvltools/blob/2064ad8993f06e892bf2fbfe6a07944657d9d42c/ext/gvltools/extconf.rb | ext/gvltools/extconf.rb | # frozen_string_literal: true
require "mkmf"
if RUBY_ENGINE == "ruby" &&
have_header("stdatomic.h") &&
have_func("rb_internal_thread_add_event_hook", ["ruby/thread.h"]) # 3.1+
$CFLAGS << " -O3 -Wall "
have_func("rb_internal_thread_specific_get", "ruby/thread.h") # 3.3+
create_makefile("gvltools/instrument... | ruby | MIT | 2064ad8993f06e892bf2fbfe6a07944657d9d42c | 2026-01-04T17:35:04.857145Z | false |
Shopify/gvltools | https://github.com/Shopify/gvltools/blob/2064ad8993f06e892bf2fbfe6a07944657d9d42c/lib/gvltools.rb | lib/gvltools.rb | # frozen_string_literal: true
require_relative "gvltools/version"
module GVLTools
class Error < StandardError; end
module Native
class << self
def enable_metric(_metric)
false
end
alias_method :enable_metric, :enable_metric
def disable_metric(_metric)
false
end
... | ruby | MIT | 2064ad8993f06e892bf2fbfe6a07944657d9d42c | 2026-01-04T17:35:04.857145Z | false |
Shopify/gvltools | https://github.com/Shopify/gvltools/blob/2064ad8993f06e892bf2fbfe6a07944657d9d42c/lib/gvltools/version.rb | lib/gvltools/version.rb | # frozen_string_literal: true
module GVLTools
VERSION = "0.4.0"
end
| ruby | MIT | 2064ad8993f06e892bf2fbfe6a07944657d9d42c | 2026-01-04T17:35:04.857145Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/benchmark/bench_parse.rb | benchmark/bench_parse.rb | # -*- coding: utf-8 -*-
$: << "lib"
require "benchmark"
require "natto"
require "MeCab"
@mecab_tagger = MeCab::Tagger.new
@natto_mecab = Natto::MeCab.new
def run(n)
GC.disable
n.times do
yield
end
GC.enable
end
def benchmark(text)
n = 10
puts("text: #{text}")
Benchmark.bmbm(10) do |job|
job.r... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/test/test_natto.rb | test/test_natto.rb | # coding: utf-8
$: << 'lib'
require 'minitest/autorun'
require 'natto'
[
'/test/natto/tc_binding.rb',
'/test/natto/tc_dictionaryinfo.rb',
'/test/natto/tc_mecab.rb',
'/test/natto/tc_mecabnode.rb',
'/test/natto/tc_option_parse.rb'
].each do |tc|
require File.join(File.expand_path('.'), tc)
end
# Copyright ... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/test/natto/tc_binding.rb | test/natto/tc_binding.rb | # coding: utf-8
class TestNattoBinding < Minitest::Test
def setup
@ver = `mecab -v`.strip.split.last
@klass = Class.new do
include Natto::Binding
end
end
def teardown
@ver, @klass = nil, nil
end
def test_mecab_version
assert_equal(@ver, @klass.mecab_version)
end
def test_func... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/test/natto/tc_mecabnode.rb | test/natto/tc_mecabnode.rb | # coding: utf-8
require 'rbconfig'
class TestMeCabNode < Minitest::Test
def setup
@host_os = RbConfig::CONFIG['host_os']
@arch = RbConfig::CONFIG['arch']
if @host_os =~ /mswin|mingw/i
@test_cmd = 'type "test\\natto\\test_sjis"'
else
@test_cmd = 'cat "test/natto/test_utf8"'
end
... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/test/natto/tc_option_parse.rb | test/natto/tc_option_parse.rb | # coding: utf-8
class TestOptionParse < Minitest::Test
def setup
@klass = Class.new do
include Natto::OptionParse
end
end
def teardown
@klass = nil
end
def test_functions_included
[ :parse_mecab_options, :build_options_str ].each do |f|
assert(@klass.respond_to? f)
end
e... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/test/natto/tc_mecab.rb | test/natto/tc_mecab.rb | # coding: utf-8
require 'rbconfig'
class TestMeCab < Minitest::Test
def setup
@ver = `mecab -v`.strip.split.last
@host_os = RbConfig::CONFIG['host_os']
@arch = RbConfig::CONFIG['arch']
if @host_os =~ /mswin|mingw/i
@test_cmd = 'type "test\\natto\\test_sjis"'
@br = '\\n... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/test/natto/tc_dictionaryinfo.rb | test/natto/tc_dictionaryinfo.rb | # coding: utf-8
require 'open3'
require 'rbconfig'
class TestDictionaryInfo < Minitest::Test
def setup
@testdic = File.join(Dir.pwd, 'test', 'natto', 'test.dic')
begin
File.delete(@testdic) if File.exist?(@testdic)
rescue SystemCallError
$stderr.puts "[INFO] setup: could not delete test.dic, ... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/lib/natto.rb | lib/natto.rb | # coding: utf-8
require 'natto/natto'
# Copyright (c) 2020, Brooke M. Fujita.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above
# co... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/lib/natto/version.rb | lib/natto/version.rb | # coding: utf-8
# `Natto` is the namespace for objects that provide
# a binding to MeCab and an API for the `Tagger`,
# `Node` and `Lattice` objects.
#
# `Natto::MeCab` is a wrapper class for the MeCab Tagger.
#
# `Natto::MeCabStruct` is a base class for a MeCab struct.
#
# `Natto::MeCabNode` is a wrapper for the stru... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/lib/natto/natto.rb | lib/natto/natto.rb | # coding: utf-8
require 'natto/binding'
require 'natto/option_parse'
require 'natto/struct'
module Natto
# `MeCab` is a class providing an interface to the MeCab library.
# Options to the MeCab Model, Tagger and Lattice are passed in
# as a string (MeCab command-line style) or as a Ruby-style hash at
# initia... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/lib/natto/struct.rb | lib/natto/struct.rb | # coding: utf-8
require 'natto/binding'
require 'natto/option_parse'
module Natto
require 'ffi'
# `MeCabStruct` is a general base class for `FFI::Struct` objects in
# the `Natto` module. Please refer to `mecab.h` in the source code
# distribution.
class MeCabStruct < FFI::Struct
# Provides accessor met... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/lib/natto/option_parse.rb | lib/natto/option_parse.rb | # coding: utf-8
module Natto
# Module `OptionParse` encapsulates methods and behavior
# for parsing the various MeCab options supported by
# `Natto`.
module OptionParse
require 'optparse'
WARNING_LATTICE_LEVEL =
":lattice-level is DEPRECATED, please use :marginal or :nbest\n".freeze
# M... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
buruzaemon/natto | https://github.com/buruzaemon/natto/blob/3238b01b9fe708a0c6f0d18cf6c018691038120c/lib/natto/binding.rb | lib/natto/binding.rb | # coding: utf-8
module Natto
# Module `Binding` encapsulates methods and behavior
# which are made available via `FFI` bindings to MeCab.
module Binding
require 'ffi'
require 'rbconfig'
extend FFI::Library
MECAB_PATH = 'MECAB_PATH'.freeze
# @private
def self.included(base)
ba... | ruby | BSD-2-Clause | 3238b01b9fe708a0c6f0d18cf6c018691038120c | 2026-01-04T17:34:02.142262Z | false |
dcadenas/rubydeps | https://github.com/dcadenas/rubydeps/blob/5669c42ccae82f82cc2fefffb885c2369a08bf29/ext/call_site_analyzer/extconf.rb | ext/call_site_analyzer/extconf.rb | require 'mkmf'
require "debugger/ruby_core_source"
#comment this line if not debugging
#$CFLAGS='-ggdb -Wall -O0 -pipe'
hdrs = proc {
have_type("rb_iseq_location_t", "vm_core.h")
have_header("vm_core.h") and have_header("iseq.h")
}
if !Debugger::RubyCoreSource::create_makefile_with_core(hdrs, "call_site_analyz... | ruby | MIT | 5669c42ccae82f82cc2fefffb885c2369a08bf29 | 2026-01-04T17:35:19.523784Z | false |
dcadenas/rubydeps | https://github.com/dcadenas/rubydeps/blob/5669c42ccae82f82cc2fefffb885c2369a08bf29/spec/rubydeps_spec.rb | spec/rubydeps_spec.rb | require 'file_test_helper'
module GrandparentModule
def class_method
end
end
class Grandparent
extend GrandparentModule
def instance_method
end
end
class Parent
def self.class_method
Grandparent.class_method
end
def instance_method
end
end
class Son
def self.class_method
parent = Paren... | ruby | MIT | 5669c42ccae82f82cc2fefffb885c2369a08bf29 | 2026-01-04T17:35:19.523784Z | false |
dcadenas/rubydeps | https://github.com/dcadenas/rubydeps/blob/5669c42ccae82f82cc2fefffb885c2369a08bf29/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubydeps'
require 'rspec'
require 'rspec/autorun'
RSpec.configure do |config|
end
| ruby | MIT | 5669c42ccae82f82cc2fefffb885c2369a08bf29 | 2026-01-04T17:35:19.523784Z | false |
dcadenas/rubydeps | https://github.com/dcadenas/rubydeps/blob/5669c42ccae82f82cc2fefffb885c2369a08bf29/lib/rubydeps.rb | lib/rubydeps.rb | require 'graphviz'
require 'call_site_analyzer'
module Rubydeps
def self.start(install_at_exit = true)
CallSiteAnalyzer.start
at_exit { self.do_at_exit } if install_at_exit
end
def self.analyze(options = {}, &block_to_analyze)
dependency_hash, class_location_hash = dependency_hash_for(options, &bloc... | ruby | MIT | 5669c42ccae82f82cc2fefffb885c2369a08bf29 | 2026-01-04T17:35:19.523784Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/services/project_matcher.rb | app/services/project_matcher.rb | class ProjectMatcher
def self.match(github_url)
Project.where(github_url: github_url)
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/services/pull_request_reposter.rb | app/services/pull_request_reposter.rb | class PullRequestReposter
def initialize(pull_requests)
@pull_requests = pull_requests
end
def self.run(pull_requests)
self.new(pull_requests).run
end
def run
pull_requests.each do |pull_request|
post_to_slack(pull_request)
mark_as_reposted(pull_request)
end
end
private
a... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/services/tag_parser.rb | app/services/tag_parser.rb | class TagParser
def parse(string)
string.scan(/(\s|^)#([\w]*)/).map(&:last).uniq
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/services/payload_parser.rb | app/services/payload_parser.rb | class PayloadParser
def initialize(payload, headers)
Rails.logger.ap(payload, :info)
@payload = payload
@headers = headers
end
def action
payload["action"]
end
def event_type
headers["HTTP_X_GITHUB_EVENT"]
end
def body
pull_request_or_issue_params["body"] || ""
end
def comm... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/services/webhook_notifier.rb | app/services/webhook_notifier.rb | class WebhookNotifier
BOT_NAME = "Pester"
ICON_URL = "http://tbot-pester.herokuapp.com/pester-slack-icon.png"
def initialize(pull_request)
@pull_request = pull_request
end
def send_notification
channels.each do |channel|
send_webook_post(channel)
end
end
def body(channel)
{
... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/helpers/tags_helper.rb | app/helpers/tags_helper.rb | module TagsHelper
def toggle_tag_on_path(tag)
if active_tag?(tag)
remove_tag_from_path(tag)
else
add_tag_to_path(tag)
end
end
def tag_classes(tag)
classes = ["tag-toggle", tag]
if active_tag?(tag)
classes << "is-active"
end
classes
end
def add_tag_to_path(tag)... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/helpers/application_helper.rb | app/helpers/application_helper.rb | module ApplicationHelper
def embedded_svg(filename, options = {})
assets = Rails.application.assets
file = assets.find_asset(filename)
render file: file.pathname
end
def all_tags_channels
Tag.joins(:channel).order(:name).pluck("tags.name", "channels.name")
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/controllers/github_payloads_controller.rb | app/controllers/github_payloads_controller.rb | class GithubPayloadsController < ApplicationController
before_action VerifyGithubSignature.new(ENV["GITHUB_SECRET_KEY"])
skip_before_action :ensure_team_member
def create
action_matching(parser, pull_request).call
head :ok
end
private
def action_matching(*args)
actions
.find { |action|... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/controllers/pull_requests_controller.rb | app/controllers/pull_requests_controller.rb | class PullRequestsController < ApplicationController
helper_method :grouped_pull_requests, :tags, :tags_to_filter_by
skip_before_action :ensure_team_member, only: :index
def index
respond_to do |format|
format.html { ensure_team_member }
format.json { render json: pull_requests }
end
end
... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/controllers/sessions_controller.rb | app/controllers/sessions_controller.rb | class SessionsController < ApplicationController
skip_before_action :ensure_team_member
def new
end
def create
if auth_hash.credentials.team_member?
session[:github_username] = github_username
redirect_to root_path
else
flash[:error] = "You cannot access this site" \
... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/controllers/application_controller.rb | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
before_action :ensure_team_member
force_ssl if: :ssl_configured?
private
def ensure_team_member
unless... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/admin/tag.rb | app/admin/tag.rb | ActiveAdmin.register Tag do
permit_params :name, :channel_id
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/admin/project.rb | app/admin/project.rb | ActiveAdmin.register Project do
permit_params :name, :default_channel_id, :github_url
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/admin/channel.rb | app/admin/channel.rb | ActiveAdmin.register Channel do
permit_params :name, :webhook_url
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/admin/dashboard.rb | app/admin/dashboard.rb | ActiveAdmin.register_page "Dashboard" do
menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
content title: proc{ I18n.t("active_admin.dashboard") } do
div class: "blank_slate_container", id: "dashboard_default_message" do
span class: "blank_slate" do
span I18n.t("active_admin.dash... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/actions/no_matching_action.rb | app/actions/no_matching_action.rb | class NoMatchingAction
def initialize(*)
end
def self.matches(*)
true
end
def call
# noop
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/actions/complete_pr.rb | app/actions/complete_pr.rb | class CompletePr
def initialize(parser, pull_request)
@parser = parser
@pull_request = pull_request
end
def self.matches(parser, _pull_request)
parser.event_type == "issue_comment" &&
parser.comment["body"] =~ /LGTM/
end
def call
pull_request.update(status: "completed")
end
protec... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/actions/complete_closed_pr.rb | app/actions/complete_closed_pr.rb | class CompleteClosedPr
def initialize(parser, pull_request)
@parser = parser
@pull_request = pull_request
end
def self.matches(parser, _pull_request)
parser.action == "closed"
end
def call
pull_request.update(status: "completed")
end
protected
attr_reader :parser, :pull_request
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/actions/mark_pr_needs_review.rb | app/actions/mark_pr_needs_review.rb | class MarkPrNeedsReview
def initialize(parser, pull_request)
@parser = parser
@pull_request = pull_request
end
def self.matches(parser, _pull_request)
parser.event_type == "issue_comment" &&
parser.comment["body"] =~ /NRR/
end
def call
pull_request.update(status: "needs review")
end
... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/actions/mark_pr_in_progress.rb | app/actions/mark_pr_in_progress.rb | class MarkPrInProgress
EXCLUDED_USERS = ['houndci']
def initialize(parser, pull_request)
@parser = parser
@pull_request = pull_request
end
def self.matches(parser, _pull_request)
parser.event_type =~ /.*_comment$/ &&
EXCLUDED_USERS.exclude?(parser.comment_user_login)
end
def call
pu... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/actions/create_new_pr.rb | app/actions/create_new_pr.rb | class CreateNewPr
def initialize(payload_parser, *)
@payload_parser = payload_parser
end
def self.matches(payload_parser, *)
payload_parser.action == "opened" &&
(
tags_matched(payload_parser.body) ||
project_matched(payload_parser.repo_github_url)
)
end
def call
pull... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/models/tag.rb | app/models/tag.rb | class Tag < ActiveRecord::Base
validates :channel, presence: true
validates :channel_id, presence: true
validates :name, presence: true
validates :name, uniqueness: true
before_validation :normalize_name
belongs_to :channel
has_and_belongs_to_many :pull_requests
def self.with_active_pull_requests
... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/models/project.rb | app/models/project.rb | class Project < ActiveRecord::Base
validates :default_channel, presence: true
validates :github_url, presence: true, uniqueness: true
validates :name, presence: true, uniqueness: true
belongs_to :default_channel, class_name: "Channel"
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/models/channel.rb | app/models/channel.rb | class Channel < ActiveRecord::Base
validates :name, presence: true
validates :name, uniqueness: { scope: :webhook_url }
validates :webhook_url, presence: true
has_many :projects, as: :default_channel, dependent: :destroy
has_many :tags, dependent: :destroy
has_many :active_pull_requests,
-> { active },... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/models/pull_request.rb | app/models/pull_request.rb | class PullRequest < ActiveRecord::Base
REPOST_THRESHOLD = ENV.fetch("REPOST_THRESHOLD").to_i
validates :github_url, presence: true, uniqueness: true
validates :repo_name, presence: true
validates :repo_github_url, presence: true
validates :status, presence: true, inclusion: { in: ["needs review", "in progres... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/models/null_pull_request.rb | app/models/null_pull_request.rb | class NullPullRequest
def update(*args)
# noop
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/app/filters/verify_github_signature.rb | app/filters/verify_github_signature.rb | class VerifyGithubSignature
def initialize(github_secret)
@github_secret = github_secret
end
def before(controller)
unless github_signature_matches?(controller.request)
controller.head :unauthorized
end
end
protected
attr_reader :github_secret
private
def github_signature_matches?... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/seeds.rb | db/seeds.rb | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/schema.rb | db/schema.rb | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20141212221130_add_webhook_url_to_tags.rb | db/migrate/20141212221130_add_webhook_url_to_tags.rb | class AddWebhookUrlToTags < ActiveRecord::Migration
def change
change_table :tags do |t|
t.string :webhook_url
end
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20141212215447_drop_github_issue_column.rb | db/migrate/20141212215447_drop_github_issue_column.rb | class DropGithubIssueColumn < ActiveRecord::Migration
def change
remove_column :pull_requests, :github_issue_id
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20150313144216_create_project.rb | db/migrate/20150313144216_create_project.rb | class CreateProject < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :name, null: false, unique: true
t.string :github_url, null: false, unique: true
t.integer :default_channel_id, null: false
end
add_foreign_key(
:projects,
:channels,
column... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20141211215619_add_columns_to_pull_requests.rb | db/migrate/20141211215619_add_columns_to_pull_requests.rb | class AddColumnsToPullRequests < ActiveRecord::Migration
def change
change_table :pull_requests do |t|
t.string :title, null: false
t.string :repo_github_url, null: false
t.string :user_name, null: false
t.string :user_github_url, null: false
end
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20150714160637_create_tags_habtm.rb | db/migrate/20150714160637_create_tags_habtm.rb | class CreateTagsHabtm < ActiveRecord::Migration
def change
create_table :pull_requests_tags do |t|
t.belongs_to :pull_request
t.belongs_to :tag
end
add_index :pull_requests_tags, [:pull_request_id, :tag_id], unique: true
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20141212171203_create_tags.rb | db/migrate/20141212171203_create_tags.rb | class CreateTags < ActiveRecord::Migration
def change
create_table :tags do |t|
t.string :name, null: false, index: true, unique: true
end
create_table :pull_requests_tags do |t|
t.belongs_to :pull_request
t.belongs_to :tag
end
add_foreign_key :pull_requests_tags, :pull_request... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20141211190456_create_pull_requests.rb | db/migrate/20141211190456_create_pull_requests.rb | class CreatePullRequests < ActiveRecord::Migration
def change
create_table :pull_requests do |t|
t.timestamps null: false
t.integer :github_issue_id, null: false
t.string :github_url, null: false
t.string :repo_name, null: false
t.string :status, null: false, default: 'needs review'... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20141213171104_add_avatar_url_to_user.rb | db/migrate/20141213171104_add_avatar_url_to_user.rb | class AddAvatarUrlToUser < ActiveRecord::Migration
def change
change_table :pull_requests do |t|
t.string :avatar_url, null: false, default: "https://avatars1.githubusercontent.com/u/6183?v=3&s=200"
end
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20151002193350_drop_channels_pull_requests.rb | db/migrate/20151002193350_drop_channels_pull_requests.rb | class DropChannelsPullRequests < ActiveRecord::Migration
def up
drop_table :channels_pull_requests
end
def down
create_table :channels_pull_requests do |t|
t.belongs_to :channel
t.belongs_to :pull_request
end
add_index :channels_pull_requests,
[:channel_id, :pull_request_id],
... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20150108191114_add_reposted_at_to_pull_requests.rb | db/migrate/20150108191114_add_reposted_at_to_pull_requests.rb | class AddRepostedAtToPullRequests < ActiveRecord::Migration
def change
add_column :pull_requests, :reposted_at, :timestamp
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20141211175300_create_delayed_jobs.rb | db/migrate/20141211175300_create_delayed_jobs.rb | class CreateDelayedJobs < ActiveRecord::Migration
def self.up
create_table :delayed_jobs, :force => true do |table|
table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
table.integer :attempts, :default => 0, :null => false # Provides for retries,... | ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
thoughtbot/pester | https://github.com/thoughtbot/pester/blob/3986e373e5a79be115ccb02807568e77a3d9fc41/db/migrate/20150925165001_add_comment_count_to_pull_requests.rb | db/migrate/20150925165001_add_comment_count_to_pull_requests.rb | class AddCommentCountToPullRequests < ActiveRecord::Migration
def change
add_column :pull_requests, :comment_count, :integer, null: false, default: 0
end
end
| ruby | MIT | 3986e373e5a79be115ccb02807568e77a3d9fc41 | 2026-01-04T17:34:56.998205Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.