source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | Shopify/rotoscope | https://github.com/Shopify/rotoscope | lib/rotoscope/call_logger.rb | Ruby | mit | 213 | main | 4,022 | # frozen_string_literal: true
require "csv"
class Rotoscope
class CallLogger
UNSPECIFIED = Object.new
private_constant :UNSPECIFIED
class << self
def trace(dest, blacklist: UNSPECIFIED, excludelist: [])
if blacklist != UNSPECIFIED
excludelist = blacklist
warn("Rotoscop... |
github | Shopify/rotoscope | https://github.com/Shopify/rotoscope | test/monadify.rb | Ruby | mit | 213 | main | 276 | # frozen_string_literal: true
module Monadify
class << self
def extended(base)
base.define_singleton_method("contents=") { |val| val }
end
end
define_method("contents") do
42
end
def monad(value)
contents
self.contents = value
end
end |
github | Shopify/rotoscope | https://github.com/Shopify/rotoscope | test/rotoscope_test.rb | Ruby | mit | 213 | main | 28,153 | # frozen_string_literal: true
at_exit { GC.start } # to reduce false positives in the test:valgrind rake task
$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
$LOAD_PATH.unshift(File.expand_path("../", __FILE__))
require "rotoscope"
require "minitest"
require "zlib"
require "fileutils"
require "csv"
requi... |
github | matadon/mizuno | https://github.com/matadon/mizuno | Rakefile | Ruby | apache-2.0 | 213 | master | 3,813 | require 'rspec/core/rake_task'
require 'open-uri'
require 'nokogiri'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
# http://rubydoc.info/gems/pompompom/1.1.3/frames
namespace :jetty do
desc "Grab the latest Jetty from its Maven repository."
task :update do
# Manipulate files under the gem ... |
github | matadon/mizuno | https://github.com/matadon/mizuno | mizuno.gemspec | Ruby | apache-2.0 | 213 | master | 1,591 | $:.push File.expand_path("../lib/mizuno", __FILE__)
require 'version'
Gem::Specification.new do |spec|
spec.name = "mizuno"
spec.version = Mizuno::VERSION
spec.required_rubygems_version = Gem::Requirement.new(">= 1.2") \
if spec.respond_to?(:required_rubygems_version=)
spec.authors = [ "Don Wer... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/daemonization_spec.rb | Ruby | apache-2.0 | 213 | master | 6,058 | require "spec_helper"
require "net/http"
require "fileutils"
class MizunoDaemon
MIN_TIMEOUT = 1
MAX_TIMEOUT = 30
WAIT_INTERVAL = 0.5
PIDFILE = "tmp/mizuno.pid"
def start(*args)
run(args.flatten + [ "--start" ])
self
end
def stop
return unless running?
ru... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/rewindable_input_stream_spec.rb | Ruby | apache-2.0 | 213 | master | 4,564 | require 'spec_helper'
require 'java'
require 'lib/java/servlet-api-3.0.jar'
require 'lib/java/rewindable-input-stream.jar'
require 'support/test_app'
java_import org.jruby.rack.servlet.RewindableInputStream
describe RewindableInputStream do
include HttpRequests
before(:all) do
start_server(TestApp.ne... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/server_spec.rb | Ruby | apache-2.0 | 213 | master | 6,830 | require "spec_helper"
require "support/test_app"
require "net/http"
describe Mizuno::Server do
include HttpRequests
describe "http" do
before(:all) do
start_server(TestApp.new, { host: "127.0.0.1", port: 9201,
embedded: true, threads: 10 })
end
after(:all) ... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/logger_spec.rb | Ruby | apache-2.0 | 213 | master | 1,072 | require 'spec_helper'
require 'mizuno/logger'
java_import 'java.util.Properties'
describe Mizuno::Logger do
it "writes logs to a file" do
logfile = File.join(File.dirname(__FILE__), '../tmp/logger.log')
FileUtils.rm(logfile) if File.exists?(logfile)
Mizuno::Logger.configure(:log => logfile... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/client_spec.rb | Ruby | apache-2.0 | 213 | master | 2,086 | require 'thread'
require 'spec_helper'
require 'mizuno/client'
describe Mizuno::Client do
pending "times out when the server doesn't respond" do
called = false
client = Mizuno::Client.new(:timeout => 1)
client.request('http://127.0.0.1:9293/') do |response|
response.should be_ti... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/mizuno_rails_spec.rb | Ruby | apache-2.0 | 213 | master | 281 | require 'spec_helper'
describe 'rails support' do
pending "sets the environment for rails" do
end
pending "runs in development mode" do
end
pending "runs in production mode" do
end
pending "serves up static assets in production mode" do
end
end |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/spec_helper.rb | Ruby | apache-2.0 | 213 | master | 1,403 | # Load our local copy of Mizuno before anything else.
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
# All dependencies for testing.
require 'yaml'
require 'net/http'
require 'thread'
require 'digest/md5'
require 'base64'
require 'json/pure'
require 'rack/urlmap'
require 'rack/lint'
require 'mizuno... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/command_line_spec.rb | Ruby | apache-2.0 | 213 | master | 2,345 | require 'spec_helper'
require 'net/http'
require 'childprocess'
require 'fileutils'
class MizunoRunner
MIN_TIMEOUT = 1
MAX_TIMEOUT = 30
WAIT_INTERVAL = 0.5
PIDFILE = "tmp/mizuno.pid"
attr_reader :process, :args
def start(*args)
@args = args.flatten
jruby_command = %w(jruby ... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/support/test_app.rb | Ruby | apache-2.0 | 213 | master | 4,156 | require 'rack'
require 'rack/request'
require 'rack/response'
require 'json/pure'
#
# A tiny Rack application for testing the Mizuno webserver. Each of the
# following paths can be used to test webserver behavior:
#
# /ping:: Always returns 200 OK.
#
# /error/:number:: Returns the HTTP status code specified in the pa... |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/support/redirect_app.rb | Ruby | apache-2.0 | 213 | master | 302 | #
# A test app that always returns a server error.
#
class RedirectApp
def call(env)
message = "REDIRECT"
[ 301, { "Content-Type" => "text/plain",
"Location" => "http://jkjdshfkadh.fds/",
"Content-Length" => message.length.to_s }, [ message ] ]
end
end |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/support/notfound_app.rb | Ruby | apache-2.0 | 213 | master | 250 | #
# A test app that always returns a server error.
#
class NotfoundApp
def call(env)
message = "NOT FOUND"
[ 404, { "Content-Type" => "text/plain",
"Content-Length" => message.length.to_s }, [ message ] ]
end
end |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/support/error_app.rb | Ruby | apache-2.0 | 213 | master | 243 | #
# A test app that always returns a server error.
#
class ErrorApp
def call(env)
message = "ERROR"
[ 500, { "Content-Type" => "text/plain",
"Content-Length" => message.length.to_s }, [ message ] ]
end
end |
github | matadon/mizuno | https://github.com/matadon/mizuno | spec/support/success_app.rb | Ruby | apache-2.0 | 213 | master | 237 | #
# A test app that always returns a HTTP OK.
#
class SuccessApp
def call(env)
message = "OK"
[ 200, { "Content-Type" => "text/plain",
"Content-Length" => message.length.to_s }, [ message ] ]
end
end |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno.rb | Ruby | apache-2.0 | 213 | master | 1,112 | #
# A Rack handler for Jetty 8.
#
# Written by Don Werve <don@madwombat.com>
#
require 'java'
# Save our launch environment for spawning children later.
module Mizuno
LAUNCH_ENV = $LOAD_PATH.map { |i| "-I#{i}" }.push($0)
HOME = File.expand_path(File.dirname(__FILE__))
#
# Tell log4j not to complain ... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/client_exchange.rb | Ruby | apache-2.0 | 213 | master | 1,869 | require 'stringio'
require 'mizuno/client_response'
module Mizuno
java_import 'org.eclipse.jetty.client.ContentExchange'
# what do I want to happen on a timeout or error?
class ClientExchange < ContentExchange
def initialize(client)
super(false)
@client = client
en... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/rack_handler.rb | Ruby | apache-2.0 | 213 | master | 10,324 | require 'stringio'
require 'rack/response'
#
# Wraps a Rack application in a Jetty handler.
#
module Mizuno
java_import 'org.eclipse.jetty.server.handler.AbstractHandler'
class RackHandler < AbstractHandler
java_import 'java.io.FileInputStream'
java_import 'org.eclipse.jetty.continuation.Conti... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/choices.rb | Ruby | apache-2.0 | 213 | master | 3,880 | Choice.options do
separator ''
separator 'Ruby options: '
option :eval do
short '-e'
long '--eval'
desc 'evaluate a line of code'
default nil
end
option :debug do
short '-d'
long '--debug'
desc 'set debugging flags (set $DEBUG to true)'
... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/client_response.rb | Ruby | apache-2.0 | 213 | master | 654 | require 'rack/response'
module Mizuno
class ClientResponse
include Rack::Response::Helpers
attr_accessor :url, :status, :headers, :body, :ssl, :timeout
def initialize(url)
@url = url
@headers = Rack::Utils::HeaderHash.new
end
def [](key)
... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/logger.rb | Ruby | apache-2.0 | 213 | master | 2,894 | require 'logger'
module Mizuno
class Logger < ::Logger
java_import 'java.io.ByteArrayInputStream'
java_import 'java.util.Properties'
java_import 'org.apache.log4j.PropertyConfigurator'
LEVELS = {
::Logger::DEBUG => Java.org.apache.log4j.Level::DEBUG,
::Logge... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/server.rb | Ruby | apache-2.0 | 213 | master | 5,536 | # FIXME: mizuno/http_server needs to still work, but we will throw out a
# deprecation notice and remove it in later versions.
require 'rack'
require 'rack/rewindable_input'
require 'mizuno'
Mizuno.require_jars(%w(jetty-continuation jetty-http jetty-io jetty-jmx
jetty-security jetty-server jetty-util servlet-api
... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/reloader.rb | Ruby | apache-2.0 | 213 | master | 4,826 | require 'pathname'
require 'thread'
#:nodoc:
module Mizuno
#
# Middleware for reloading production applications; works exactly
# like Rack::Reloader, but rather than checking for any changed
# file, only looks at one specific file.
#
# Also allows for explicit reloading via a class method, as ... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/client.rb | Ruby | apache-2.0 | 213 | master | 1,798 | require "thread"
require "mizuno"
Mizuno.require_jars(%w(jetty-client jetty-http jetty-io jetty-util))
require "mizuno/client_exchange"
module Mizuno
class Client
java_import "org.eclipse.jetty.client.HttpClient"
java_import "org.eclipse.jetty.util.thread.QueuedThreadPool"
@lock = Mutex.ne... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/runner.rb | Ruby | apache-2.0 | 213 | master | 10,067 | require 'ffi'
require 'net/http'
require 'choice'
require 'childprocess'
require 'fileutils'
require 'etc'
require 'rack'
require 'mizuno'
require 'mizuno/choices'
require 'mizuno/server'
require 'rack/handler/mizuno'
module Mizuno
require 'rbconfig'
module Daemonizer
def self.included?(base)
... |
github | matadon/mizuno | https://github.com/matadon/mizuno | lib/mizuno/rack/chunked.rb | Ruby | apache-2.0 | 213 | master | 655 | require 'rack/utils'
#
# We replace the default Rack::Chunked implementation with a non-op
# version, as Jetty handles chunking for us.
#
module Rack
class Chunked
include Rack::Utils
class Body
include Rack::Utils
def initialize(body)
@body = body
... |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | Gemfile | Ruby | mit | 213 | master | 2,400 | source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby RUBY_VERSION
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.3', '>= 6.1.3.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 1.1'
# Use Puma as the ... |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | test/test_helper.rb | Ruby | mit | 213 | master | 448 | require 'simplecov' if ENV['COVERAGE']
ENV['RAILS_ENV'] ||= 'test'
require_relative "../config/environment"
require "rails/test_help"
class ActiveSupport::TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors) unless ENV['COVERAGE']
# Setup all fixtures in test/fixtu... |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | test/system/app_component_integrations_test.rb | Ruby | mit | 213 | master | 268 | require 'application_system_test_case'
class AppComponentIntegrationsTest < ApplicationSystemTestCase
driven_by :selenium, using: :headless_chrome
test 'vue component on landing page' do
visit root_path
assert_selector 'p', text: 'Hello Vue!'
end
end |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | config/application.rb | Ruby | mit | 213 | master | 1,126 | 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_text/... |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | config/initializers/content_security_policy.rb | Ruby | mit | 213 | master | 1,661 | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
... |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | config/initializers/serviceworker.rb | Ruby | mit | 213 | master | 969 | Rails.application.configure do
config.serviceworker.routes.draw do
# map to assets implicitly
match '/serviceworker.js', pack: 'serviceworker.js'
# Examples
#
# map to a named asset explicitly
# match "/proxied-serviceworker.js" => "nested/asset/serviceworker.js"
# match "/nested/servicew... |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | config/environments/staging.rb | Ruby | mit | 213 | master | 5,156 | require "active_support/core_ext/integer/time"
require 'r7_insight.rb'
Rails.application.configure do
if ENV["MEMCACHIER_SERVERS"]
config.cache_store = :mem_cache_store,
ENV["MEMCACHIER_SERVERS"].split(","), {
username: ENV["MEMCACHIER_USERNAME"], password: ENV["MEMCACHIER_PASSWORD"],
fail... |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | config/environments/test.rb | Ruby | mit | 213 | master | 2,082 | 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... |
github | jetthoughts/vuejs-rails-starterkit | https://github.com/jetthoughts/vuejs-rails-starterkit | config/environments/development.rb | Ruby | mit | 213 | master | 2,350 | 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... |
github | railsbump/app | https://github.com/railsbump/app | stuff.rb | Ruby | mit | 213 | main | 10,509 | # remove columns
ActiveRecord::Migration.remove_column :gemmies, :versions
ActiveRecord::Migration.rename_column :gemmies, :versions_and_dependencies, :dependencies_and_versions
# rename gemfiles to lockfiles
ActiveRecord::Migration.rename_table :gemfiles, :lockfiles
ActiveRecord::Migration.rename_table :gemfile_dep... |
github | railsbump/app | https://github.com/railsbump/app | Gemfile | Ruby | mit | 213 | main | 2,645 | def next?
File.basename(__FILE__) == "Gemfile.next"
end
source "https://rubygems.org"
ruby file: ".ruby-version"
gem "next_rails"
# gem "activerecord-enhancedsqlite3-adapter", "~> 0.5"
gem "amazing_print", "~> 1.5"
gem "aws-sdk-s3", "~> 1.8", require: f... |
github | railsbump/app | https://github.com/railsbump/app | config/importmap.rb | Ruby | mit | 213 | main | 465 | pin "application"
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
pin "@hotwired/stimulus", to: "stimulus.min.js"
pin "@hotwired/turbo-rails", to: "turbo.min.js"
pin "autosize", to: "https://cdn.jsdelivr.net/npm/autosize@6.0.1/dist/autosize.min.js"
pin "bootstrap", ... |
github | railsbump/app | https://github.com/railsbump/app | config/sitemap.rb | Ruby | mit | 213 | main | 1,337 | if ENV["AWS_ACCESS_KEY_ID"].present?
require "fog-aws"
SitemapGenerator::Sitemap.default_host = "https://www.railsbump.org"
SitemapGenerator::Sitemap.public_path = "tmp/sitemaps/" # Temporary storage before uploading to S3
SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new(
fog_provider: ... |
github | railsbump/app | https://github.com/railsbump/app | config/application.rb | Ruby | mit | 213 | main | 1,349 | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_cable/engine"
# require "active_storage/e... |
github | railsbump/app | https://github.com/railsbump/app | config/routes.rb | Ruby | mit | 213 | main | 1,046 | require "sidekiq/web"
require "sidekiq-scheduler/web"
if Rails.env.production?
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
{
username => "SIDEKIQ_USERNAME",
password => "SIDEKIQ_PASSWORD"
}.map { ActiveSupport::SecurityUtils.secure_compare _1, ENV.fetch(_2) }
.all?
end
end
R... |
github | railsbump/app | https://github.com/railsbump/app | config/puma.rb | Ruby | mit | 213 | main | 1,318 | require "sidekiq"
max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
min_threads_count = ENV.fetch("RAILS_MIN_THREADS", max_threads_count)
threads min_threads_count, max_threads_count
if ENV["RAILS_ENV"] == "production"
require "concurrent-ruby"
worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.... |
github | railsbump/app | https://github.com/railsbump/app | config/environments/test.rb | Ruby | mit | 213 | main | 2,281 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# While tests run files are not watched, reloading is not necessary.
config.enable_reloading = false
# Eager loading loads your entire application. When running a single test locally,
# this is usually not necessary, and can slow do... |
github | railsbump/app | https://github.com/railsbump/app | config/environments/production.rb | Ruby | mit | 213 | main | 5,221 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# 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 memory, allowing both threaded web servers
# and those relying on copy on... |
github | railsbump/app | https://github.com/railsbump/app | config/environments/development.rb | Ruby | mit | 213 | main | 2,562 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
con... |
github | railsbump/app | https://github.com/railsbump/app | config/initializers/content_security_policy.rb | Ruby | mit | 213 | main | 1,010 | # 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_policy do |policy|
# policy.default_src :self, :https
# ... |
github | railsbump/app | https://github.com/railsbump/app | config/initializers/inflections.rb | Ruby | mit | 213 | main | 510 | # 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 |inflect|
# inflect.plural /^(ox)$/i, "\\1en"
# inflect.singular... |
github | railsbump/app | https://github.com/railsbump/app | config/initializers/filter_parameter_logging.rb | Ruby | mit | 213 | main | 387 | # 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 behaviors.
Rails.application.config.filter_parameters += [
:passw,... |
github | railsbump/app | https://github.com/railsbump/app | config/initializers/assets.rb | Ruby | mit | 213 | main | 235 | # 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_path |
github | railsbump/app | https://github.com/railsbump/app | config/initializers/sentry.rb | Ruby | mit | 213 | main | 245 | Sentry.init do |config|
config.breadcrumbs_logger = %i(active_support_logger http_logger)
config.include_local_variables = true
config.release = Rails.configuration.revision
config.send_default_pii = true
end |
github | railsbump/app | https://github.com/railsbump/app | config/initializers/permissions_policy.rb | Ruby | mit | 213 | main | 419 | # 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 :none
# policy.microphone :none
# policy.usb :... |
github | railsbump/app | https://github.com/railsbump/app | config/initializers/redis.rb | Ruby | mit | 213 | main | 403 | Sidekiq.configure_server do |config|
config.redis = { ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }, url: ENV["REDIS_URL"] }
end
Sidekiq.configure_client do |config|
config.redis = { ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }, url: ENV["REDIS_URL"] }
end
$redis = Redis.new(url: ENV["REDIS_URL... |
github | railsbump/app | https://github.com/railsbump/app | app/services/check_git_branches.rb | Ruby | mit | 213 | main | 1,332 | class CheckGitBranches < Baseline::Service
def call
check_uniqueness
page = 1
begin
branches = External::Github.list_branches(page)
break if branches.empty?
branches
.map { _1.fetch(:name) }
.grep(/\A\d+\z/)
.each do |compat_id|
unless compat = Compat... |
github | railsbump/app | https://github.com/railsbump/app | app/services/maintenance/hourly.rb | Ruby | mit | 213 | main | 904 | module Maintenance
class Hourly < Baseline::Service
def call
check_uniqueness
call_all_private_methods_without_args \
raise_errors: true
[
CheckGitBranches,
EmailNotifications::SendAll
].each_with_index do |service, index|
service.call_in (index + 1).minut... |
github | railsbump/app | https://github.com/railsbump/app | app/services/compats/check.rb | Ruby | mit | 213 | main | 5,131 | require "fileutils"
# The purpose of this service is to check a compat, i.e. determine whether its set of dependencies is compatible with its Rails release or not. To do so, several approaches are taken, from least to most complex.
module Compats
class Check < Baseline::Service
CHECK_STRATEGIES = [
Compats... |
github | railsbump/app | https://github.com/railsbump/app | app/services/compats/check_unchecked.rb | Ruby | mit | 213 | main | 1,237 | module Compats
class CheckUnchecked < Baseline::Service
LIMIT = 10
def call
do_check
end
private
def do_check
count = 0
RailsRelease
.latest_major
.reverse
.each do |rails_release|
rails_release
.compats
.... |
github | railsbump/app | https://github.com/railsbump/app | app/services/compats/checks/base.rb | Ruby | mit | 213 | main | 213 | module Compats::Checks
class Base
def initialize(compat)
@compat = compat
end
def call
raise NotImplementedError
end
def check!
raise NotImplementedError
end
end
end |
github | railsbump/app | https://github.com/railsbump/app | app/services/compats/checks/rails_gems_check.rb | Ruby | mit | 213 | main | 1,109 | module Compats::Checks
# This method checks if the dependencies include any Rail gems, and if so,
# if any of them have a different version than the compat's Rails version.
#
# If that's the case, the compat is marked as incompatible.
class RailsGemsCheck < Base
RAILS_GEMS = %w(
actioncable
a... |
github | railsbump/app | https://github.com/railsbump/app | app/services/compats/checks/dependency_subsets_check.rb | Ruby | mit | 213 | main | 936 | module Compats::Checks
# This method checks if any other compats exist, that are marked as incompatible
# and have a subset of the compat's dependencies.
#
# If so, the compat must be incompatible and is marked as such.
class DependencySubsetsCheck < Base
def call
return unless @compat.pending? && ... |
github | railsbump/app | https://github.com/railsbump/app | app/services/compats/checks/bundler_github_check.rb | Ruby | mit | 213 | main | 1,087 | module Compats::Checks
# This method checks a compat by dispatching the check_bundler workflow.
class BundlerGithubCheck < Base
# Define the repository, workflow file, and branch
GITHUB_REPO = 'railsbump/checker'
GITHUB_WORKFLOW = 'check_bundler.yml'
GITHUB_REF = 'main'
def call
return u... |
github | railsbump/app | https://github.com/railsbump/app | app/services/compats/checks/empty_dependencies_check.rb | Ruby | mit | 213 | main | 462 | module Compats::Checks
# This method checks for the simplest case: if the compat has no dependencies,
# it's marked as compatible.
class EmptyDependenciesCheck < Base
def call
return unless @compat.pending?
check!
end
def check!
if @compat.dependencies.blank?
@compat.statu... |
github | railsbump/app | https://github.com/railsbump/app | app/services/email_notifications/send_all.rb | Ruby | mit | 213 | main | 392 | module EmailNotifications
class SendAll < Baseline::Service
def call
check_uniqueness on_error: :return
EmailNotification.all.each do |email_notification|
if email_notification.notifiable.compats.pending.none?
ApplicationMailer.email_notification(email_notification).deliver_now
... |
github | railsbump/app | https://github.com/railsbump/app | app/services/lockfiles/create.rb | Ruby | mit | 213 | main | 576 | require "bundler/lockfile_parser"
module Lockfiles
class Create < Baseline::Service
class AlreadyExists < Error
attr_reader :lockfile
def initialize(lockfile)
super nil
@lockfile = lockfile
end
end
def call(content)
lockfile = build(content)
lockfile.tap(... |
github | railsbump/app | https://github.com/railsbump/app | app/services/github_notifications/process.rb | Ruby | mit | 213 | main | 1,394 | module GithubNotifications
class Process < Baseline::Service
def call(github_notification_id)
github_notification = GithubNotification.find(github_notification_id)
if github_notification.processed?
raise Error, "GitHub Notification #{github_notification.id} has already been processed."
e... |
github | railsbump/app | https://github.com/railsbump/app | app/services/checks/resolve_gem.rb | Ruby | mit | 213 | main | 1,145 | # frozen_string_literal: true
require "sidekiq"
module Checks
class ResolveGem
include Sidekiq::Job
def perform(gem_check_id)
gem_check = GemCheck.find(gem_check_id)
gem_check.perform!
broadcast_gem_check(gem_check)
mark_lockfile_check_complete(gem_check.lockfile_check)
end
... |
github | railsbump/app | https://github.com/railsbump/app | app/services/rails_releases/process.rb | Ruby | mit | 213 | main | 246 | module RailsReleases
class Process < Baseline::Service
def call(rails_release)
Gemmy.find_each do |gemmy|
Gemmies::UpdateCompats.perform_async(gemmy.id)
end
Compats::CheckUnchecked.perform_async
end
end
end |
github | railsbump/app | https://github.com/railsbump/app | app/services/rails_releases/create.rb | Ruby | mit | 213 | main | 558 | module RailsReleases
class Create < Baseline::Service
def call(version)
parsed_version = Gem::Version.new(version)
return if parsed_version.prerelease? || parsed_version < Gem::Version.new("2.3")
major, minor = parsed_version.canonical_segments
major_minor_version = "#{major}.#{mi... |
github | railsbump/app | https://github.com/railsbump/app | app/services/gemmies/create.rb | Ruby | mit | 213 | main | 873 | require "gems"
module Gemmies
class Create < Baseline::Service
class AlreadyExists < Error
attr_reader :gemmy
def initialize(gemmy)
super nil
@gemmy = gemmy
end
end
class NotFound < Error
attr_reader :gemmy_name
def initialize(gemmy_name)
super ni... |
github | railsbump/app | https://github.com/railsbump/app | app/services/gemmies/process.rb | Ruby | mit | 213 | main | 255 | module Gemmies
class Process < Baseline::Service
def call(gemmy_id)
gemmy = Gemmy.find(gemmy_id)
UpdateDependenciesAndVersions.call(gemmy)
UpdateCompats.call(gemmy.id)
Compats::CheckUnchecked.perform_async
end
end
end |
github | railsbump/app | https://github.com/railsbump/app | app/services/gemmies/update_compats.rb | Ruby | mit | 213 | main | 705 | require "gems"
module Gemmies
class UpdateCompats < Baseline::Service
def call(gemmy_id)
check_uniqueness gemmy_id
gemmy = Gemmy.find gemmy_id
RailsRelease.latest_major.find_each do |rails_release|
gemmy.dependencies.each do |dependencies|
unless rails_release.compats.where(... |
github | railsbump/app | https://github.com/railsbump/app | app/services/gemmies/update_dependencies_and_versions.rb | Ruby | mit | 213 | main | 924 | require "gems"
module Gemmies
class UpdateDependenciesAndVersions < Baseline::Service
def call(gemmy)
versions = Octopoller.poll retries: 5 do
Gems
.versions(gemmy.name)
.select { _1.fetch("platform") == "ruby" }
.map { _1.fetch "number" }
rescue Gems::GemError
... |
github | railsbump/app | https://github.com/railsbump/app | app/services/external/github.rb | Ruby | mit | 213 | main | 518 | require "octokit"
module External
class Github < Baseline::ExternalService
REPO = "railsbump/checker"
def list_branches(page = 1)
client.branches \
REPO,
per_page: 100,
page: page
end
def delete_branch(name)
client.delete_branch \
REPO,
name
... |
github | railsbump/app | https://github.com/railsbump/app | app/mailers/application_mailer.rb | Ruby | mit | 213 | main | 466 | class ApplicationMailer < ActionMailer::Base
default \
from: "RailsBump <#{ENV["SMTP_FROM"]}>",
template_path: "mailers",
message_stream: :outbound
layout "mailer"
def email_notification(email_notification)
@notifiable = email_notification.notifiable
mail to: email_notification.email,... |
github | railsbump/app | https://github.com/railsbump/app | app/models/lockfile.rb | Ruby | mit | 213 | main | 2,862 | class Lockfile < ApplicationRecord
has_many :dependencies, class_name: "LockfileDependency", dependent: :destroy
has_many :gemmies, through: :dependencies
has_many :inaccessible_gemmies, dependent: :destroy
has_many :lockfile_checks, dependent: :destroy
validates :content, presence: true
validates :slug, ... |
github | railsbump/app | https://github.com/railsbump/app | app/models/github_notification.rb | Ruby | mit | 213 | main | 1,009 | class GithubNotification < ApplicationRecord
include HasTimestamps[:processed_at]
CONCLUSIONS = %w(success failure skipped cancelled)
belongs_to :compat, optional: true
validates :action, presence: true
validates :branch, presence: true
validates :conclusion, inclusion: { in: CONCLUSIONS, if: -> { action... |
github | railsbump/app | https://github.com/railsbump/app | app/models/gem_check.rb | Ruby | mit | 213 | main | 1,547 | class GemCheck < ApplicationRecord
belongs_to :lockfile_check
validates :gem_name, presence: true
validates :status, inclusion: { in: %w[pending complete] }
validates :result, inclusion: { in: %w[compatible upgrade_needed incompatible skipped] }, allow_nil: true
def self.create_for!(lockfile_check:, gem:)
... |
github | railsbump/app | https://github.com/railsbump/app | app/models/gemmy.rb | Ruby | mit | 213 | main | 1,895 | class Gemmy < ApplicationRecord
FORBIDDEN_NAMES = %w(
new
edit
rails
)
validates :name, presence: true, uniqueness: { allow_blank: true }, exclusion: FORBIDDEN_NAMES
delegate :to_param, :to_s, to: :name
def accessible_gem?
true
end
def inaccessible_gem?
!accessible_gem?
end
de... |
github | railsbump/app | https://github.com/railsbump/app | app/models/lockfile_check.rb | Ruby | mit | 213 | main | 927 | class LockfileCheck < ApplicationRecord
belongs_to :lockfile
belongs_to :rails_release
has_many :gem_checks, dependent: :destroy
validates :status, inclusion: { in: %w[pending complete failed] }
def self.create_for!(lockfile:, rails_release:)
runtime = TargetRuntime.new(lockfile: lockfile, rails_release... |
github | railsbump/app | https://github.com/railsbump/app | app/models/target_runtime.rb | Ruby | mit | 213 | main | 1,691 | # frozen_string_literal: true
class TargetRuntime
# Mapping of Ruby version → bundled RubyGems version.
# Source: https://github.com/ruby/ruby/blob/vX_Y_Z/lib/rubygems.rb
RUBYGEMS_VERSIONS = {
"1.9.3" => "1.8.23",
"2.0.0" => "2.0.0",
"2.1.0" => "2.2.0",
"2.2.0" => "2.4.5",
"2.3.0" => "2.... |
github | railsbump/app | https://github.com/railsbump/app | app/models/inaccessible_gemmy.rb | Ruby | mit | 213 | main | 683 | class InaccessibleGemmy < ApplicationRecord
belongs_to :lockfile
FORBIDDEN_NAMES = %w(
new
edit
rails
)
validates :name, presence: true, uniqueness: { allow_blank: true }
validates :name, uniqueness: { scope: :lockfile_id }
delegate :to_param, :to_s, to: :name
def accessible_gem?
false... |
github | railsbump/app | https://github.com/railsbump/app | app/models/lockfile_dependency.rb | Ruby | mit | 213 | main | 207 | class LockfileDependency < ApplicationRecord
belongs_to :lockfile
belongs_to :gemmy
end
# == Schema Information
#
# Table name: lockfile_dependencies
#
# gemmy_id :integer
# lockfile_id :integer
# |
github | railsbump/app | https://github.com/railsbump/app | app/models/rails_release.rb | Ruby | mit | 213 | main | 2,633 | class RailsRelease < ApplicationRecord
# Define the repository, workflow file, and branch
GITHUB_REPO = 'railsbump/checker'
GITHUB_WORKFLOW = 'rails_release_sanity_check.yml'
GITHUB_REF = 'main'
composed_of :version,
class_name: "Gem::Version",
mapping: %w(version to_s),
converter: Gem::Versi... |
github | railsbump/app | https://github.com/railsbump/app | app/models/email_notification.rb | Ruby | mit | 213 | main | 1,040 | class EmailNotification
include ActiveModel::Model
NAMESPACE = "email_notifications"
NAMESPACE_REGEX = /\A#{Regexp.escape NAMESPACE}:(.+)/
attr_accessor :email, :notifiable
validates :email,
presence: true,
format: {
with: URI::MailTo::EMAIL_REGEXP,
allow_blank: true
}
... |
github | railsbump/app | https://github.com/railsbump/app | app/models/compat.rb | Ruby | mit | 213 | main | 3,005 | class Compat < ApplicationRecord
include HasTimestamps[:checked_at]
enum :status, [
:pending,
:compatible,
:incompatible,
:inconclusive
]
belongs_to :rails_release
has_many :github_notifications
validates :status, presence: true, inclusion: { in: %w(pending), if: :unchecked?, message: "m... |
github | railsbump/app | https://github.com/railsbump/app | app/models/lockfile/parsed.rb | Ruby | mit | 213 | main | 1,357 | # frozen_string_literal: true
require "bundler/lockfile_parser"
class Lockfile
class Parsed
RUBYGEMS_SOURCES = ["http://rubygems.org/", "https://rubygems.org/"]
LockedGem = Data.define(:name, :version, :source) do
def resolvable?
source.in?(RUBYGEMS_SOURCES) && version.present?
end
... |
github | railsbump/app | https://github.com/railsbump/app | app/helpers/rails_releases_helper.rb | Ruby | mit | 213 | main | 1,048 | module RailsReleasesHelper
def head_title
if @gemmy
if @rails_release
"#{@gemmy} gem: Compatibility with #{@rails_release}"
else
rails_releases = RailsRelease.order(:version)
first_version = rails_releases.first.version
last_version = rails_releases.last.version
... |
github | railsbump/app | https://github.com/railsbump/app | app/helpers/application_helper.rb | Ruby | mit | 213 | main | 3,934 | module ApplicationHelper
include Baseline::Helper
def compats_status(gemmy, compats)
case
when gemmy.inaccessible_gem? then :inconclusive
when compats.compatible.any? then :compatible
when compats.none? || compats.pending.any? then :checking
else ... |
github | railsbump/app | https://github.com/railsbump/app | app/helpers/gem_checks_helper.rb | Ruby | mit | 213 | main | 776 | module GemChecksHelper
def gem_check_result_badge_class(result)
case result
when "compatible" then "bg-success"
when "upgrade_needed" then "bg-warning text-dark"
when "incompatible" then "bg-danger"
when "skipped" then "bg-light text-muted border"
else "bg-secondary"
end
end
def gem_c... |
github | railsbump/app | https://github.com/railsbump/app | app/controllers/lockfiles_controller.rb | Ruby | mit | 213 | main | 1,328 | class LockfilesController < ApplicationController
def new
@lockfile = Lockfile.new
end
def create
if FeatureFlags.new_check_flow?
create_new_flow
else
create_legacy_flow
end
end
def show
if FeatureFlags.new_check_flow?
@lockfile = Lockfile.includes(lockfile_checks: [:ra... |
github | railsbump/app | https://github.com/railsbump/app | app/controllers/gemmies_controller.rb | Ruby | mit | 213 | main | 2,232 | class GemmiesController < ApplicationController
def new
@gemmy = Gemmy.new
end
def create
@gemmy = Gemmies::Create.call(gemmy_params.fetch(:name))
rescue Gemmies::Create::AlreadyExists => error
redirect_to error.gemmy,
status: :see_other
rescue Gemmies::Create::Error => error
@gemmy = G... |
github | railsbump/app | https://github.com/railsbump/app | app/controllers/email_notifications_controller.rb | Ruby | mit | 213 | main | 490 | class EmailNotificationsController < ApplicationController
def create
email_notification = EmailNotification.new(email_notification_params)
unless email_notification.save
render partial: "email_notifications/form",
locals: { email_notification: email_notification },
status: :unprocessab... |
github | railsbump/app | https://github.com/railsbump/app | app/controllers/sitemaps_controller.rb | Ruby | mit | 213 | main | 380 | # app/controllers/sitemaps_controller.rb
class SitemapsController < ApplicationController
require "open-uri"
def show
sitemap_url = ENV["FOG_URL"]
if sitemap_url.present?
sitemap_content = URI.open("#{sitemap_url}/sitemap.xml").read
send_data sitemap_content, type: "application/xml", dispositio... |
github | railsbump/app | https://github.com/railsbump/app | app/controllers/rails_releases_controller.rb | Ruby | mit | 213 | main | 226 | class RailsReleasesController < ApplicationController
def show
@gemmy = Gemmy.find_by_name!(params[:gemmy_id])
@rails_release = RailsRelease.find_by!(version: params[:id].gsub("rails-", "").gsub("-", "."))
end
end |
github | railsbump/app | https://github.com/railsbump/app | app/controllers/api/github_notifications_controller.rb | Ruby | mit | 213 | main | 484 | module API
class GithubNotificationsController < BaseController
def create
data = request.request_parameters
github_notification = GithubNotification.create!(
data: data,
action: data["action"],
conclusion: data.dig("check_run", "conclusion"),
branch: dat... |
github | railsbump/app | https://github.com/railsbump/app | app/controllers/api/results_controller.rb | Ruby | mit | 213 | main | 1,675 | module API
class ResultsController < BaseController
before_action :authenticate_api_key!
before_action :sanitize_result_params!, only: :create
def create
@rails_release = RailsRelease.find_by(version: params[:rails_version])
@compat = @rails_release.compats.find_by_id!(params[:compat_id])
... |
github | railsbump/app | https://github.com/railsbump/app | app/controllers/api/releases_controller.rb | Ruby | mit | 213 | main | 349 | module API
class ReleasesController < BaseController
def create
name = params.fetch(:name)
if name == "rails"
RailsReleases::Create.perform_async params.fetch(:version)
else
Gemmy.find_by_name(name)&.then {
Gemmies::Process.perform_async _1.id
}
end
... |
github | railsbump/app | https://github.com/railsbump/app | db/schema.rb | Ruby | mit | 213 | main | 4,643 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.