name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# $ npm install -g @aivenio/tsc-output-parser | |
# $ ruby ts-expect-error.rb | |
require 'json' | |
def fix_errors | |
puts "Running the TypeScript compiler to find errors..." | |
errors = JSON.parse(`$(yarn bin tsc) --noEmit | tsc-output-parser`) | |
changes = Hash.new { |h, k| h[k] = Set.new } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/setup' | |
require 'rspec' | |
$LOAD_PATH.unshift(File.join(Dir.pwd, 'spec')) | |
ids = `grep '| failed' spec/examples.txt | sed 's/|.*//'`.lines(chomp: true).map(&:rstrip) | |
# Require each file | |
ids.each { |failure| require_relative failure.split('[')[0] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Usage: bin/rails runner unused_routes.rb | |
def action_exists?(controller, action) | |
controller_class = "#{controller.camelize}Controller".constantize | |
controller_class.public_instance_methods.include?(action.to_sym) | |
rescue NameError | |
false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
source "https://rubygems.org" | |
gem "cuprite", "~> 0.15.1" | |
gem "sinatra", "~> 4.0" | |
gem "puma", "~> 6.4" | |
gem "minitest", "~> 5.24" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
require 'minitest/autorun' | |
gemfile true do | |
source 'https://rubygems.org' | |
gem 'activerecord', require: 'active_record' | |
gem 'sqlite3' | |
end | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deprecator = ActiveSupport::Deprecation.new('in the future', 'B4B') | |
deprecator.behavior = ActiveSupport::Deprecation.behavior | |
ActiveSupport::Deprecation.deprecate_methods( | |
Rails.application.routes.named_routes.path_helpers_module, | |
:foo_path, | |
:bar_path, | |
deprecator: deprecator | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'rails' | |
require 'action_view' | |
require 'action_controller' | |
require 'rspec/rails' | |
class TestApplication < Rails::Application | |
end | |
RSpec.describe 'example', type: :controller do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "set" | |
require "graphql" | |
require "json" | |
SCHEMA_PATH = ENV.fetch("SCHEMA") do | |
abort "Run with SCHEMA=<path-to-schema.json> and try again." | |
end | |
SCHEMA = JSON.parse(File.read(SCHEMA_PATH)) | |
REFERENCES = Hash.new do |h, t| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert your codebase to use TypedDocumentNode. It's not perfect, but | |
# it does a pretty decent job. You'll want to review the changes manually. | |
# Usage: ruby convert.rb [...GLOBS] | |
# Example: ruby convert.rb "src/**/*.{ts,tsx}" | |
require "set" | |
def convert_import(line) | |
parts = line.scan(/use(\w+)(Query|Mutation)/) | |
return [line] if parts.empty? |
NewerOlder