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
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/lib/inch_ci/worker/project/update_info.rb
lib/inch_ci/worker/project/update_info.rb
require 'inch_ci/git_hub_info' module InchCI module Worker module Project # The UpdateInfo worker is responsible for updating a project's # meta information, like homepage and documentation URLs. class UpdateInfo include Sidekiq::Worker # @param uid [String] # @return [void] def self.enqueue(uid) perform_async(uid) end # @api private # @param github_repo_object [] used to directly update a project def perform(uid, github_repo_object = nil) project = Store::FindProject.call(uid) arr = uid.split(':') service_name = arr[0] user_repo_name = arr[1] if service_name == "github" update_via_github(project, user_repo_name, github_repo_object) end end private def update_via_github(project, user_repo_name, github_repo_object = nil) github = github_repo_object || GitHubInfo.repo(user_repo_name) project.name = github.name project.description = github.description project.fork = github.fork? project.homepage_url = github.homepage_url project.source_code_url = github.source_code_url project.documentation_url = github.documentation_url unless project.documentation_url project.language = github.language unless project.language project.languages = github.languages Store::SaveProject.call(project) default_branch = ensure_branch(project, github.default_branch) Store::UpdateDefaultBranch.call(project, default_branch) github.branches.each do |branch_name| ensure_branch(project, branch_name) end rescue Octokit::NotFound end def ensure_branch(project, branch_name) Store::FindBranch.call(project, branch_name) || Store::CreateBranch.call(project, branch_name) end end end end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/lib/inch_ci/worker/project/build_json.rb
lib/inch_ci/worker/project/build_json.rb
require 'inch_ci/worker/project/build/handle_worker_output' require 'inch_ci/gossip' require 'open3' require 'json' module InchCI module Worker module Project # The Build worker is responsible for "building" projects, # i.e. cloning and analysing repos, by utilizing a gem called # "inch_ci-worker". module BuildJSON # @return [Build] def self.enqueue(filename, trigger = nil) # this is invoked from the inch_ci-worker gem json = InchCI::Worker::BuildJSON.json(filename) if trigger.nil? trigger = 'ci' trigger = 'shell' if json.shell? trigger = 'travis' if json.travis? trigger = 'circleci' if json.circleci? end if json.url branch = Store::EnsureProjectAndBranch.call(json.url, json.branch_name) scheduled_builds = Store::FindScheduledBuildsInBranch.call(branch) scheduled_builds.each do |build| Store::UpdateBuildStatus.call(build, STATUS_CANCELLED) end build = Store::CreateBuild.call(branch, trigger) Gossip.new_build(build, build.project, build.branch) ShellInvocation.perform_async(filename, json.url, json.branch_name, trigger, build.id) build end end # The ShellInvocation class spawns another shell in which the given # repo is analysed. The executed script then returns a YAML formatted # string which contains the "build data". # # Note: A new shell is spawned so that the resulting process has its # own cwd and Dir.chdir has not to be synchronized across worker # threads. # class ShellInvocation include Sidekiq::Worker BIN = "bundle exec inch_ci-worker build-from-json" # @api private def perform(filename, url, branch_name = 'master', trigger = 'ci', build_id = nil) build = ensure_running_build(url, branch_name, trigger, build_id) if build.status == STATUS_RUNNING stdout_str, stderr_str, status = Open3.capture3("#{BIN} #{filename}") Project::Build::HandleWorkerOutput.new(stdout_str, stderr_str, build) end Gossip.update_build(build, build.project, build.branch) end private def create_preliminary_build(url, branch_name, trigger) branch = Store::EnsureProjectAndBranch.call(url, branch_name) Store::CreateBuild.call(branch, trigger) end def ensure_running_build(url, branch_name, trigger, build_id) if build_id build = Store::FindBuild.call(build_id) if build.status == STATUS_SCHEDULED Store::UpdateBuildStatus.call(build, 'running', Time.now) end Gossip.update_build(build, build.project, build.branch) build else build = create_preliminary_build(url, branch_name, trigger) Gossip.new_build(build, build.project, build.branch) build end end end end end end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/lib/inch_ci/worker/project/build_tags.rb
lib/inch_ci/worker/project/build_tags.rb
module InchCI module Worker module Project # The BuildTags worker is responsible for "building" projects, # i.e. cloning the repo, getting all tag names and then # analysing each revision. module BuildTags # @param url [String] # @param branch_name [String] # @return [void] def self.enqueue(url, branch_name = "master") branch = Store::EnsureProjectAndBranch.call(url, branch_name) ShellInvocation.perform_async(url, branch_name) end # The ShellInvocation class spawns another shell in which the given # repo is analysed. The executed script then returns a YAML formatted # string which contains the list of tags. # # Note: A new shell is spawned so that the resulting process has its # own cwd and Dir.chdir has not to be synchronized across worker # threads. # class ShellInvocation include Sidekiq::Worker BIN = "bundle exec inch_ci-worker list-tags" # @api private def perform(url, branch_name = "master") output = `#{BIN} #{url.inspect} #{branch_name}` HandleWorkerOutput.new(url, branch_name, output) end end class HandleWorkerOutput def initialize(url, branch_name, output) data = YAML.load(output) if data && tags = data['tags'] tags.each do |tag| Build.enqueue(url, branch_name, tag, 'tag_build') end else raise "Running worker ".color(:red) + url.color(:cyan) + " failed:".color(:red) + " #{output.inspect}" end end end end end end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/lib/inch_ci/worker/project/update_hook.rb
lib/inch_ci/worker/project/update_hook.rb
require 'inch_ci/git_hub_info' module InchCI module Worker module Project # The UpdateInfo worker is responsible for updating a project's # meta information, like homepage and documentation URLs. class UpdateHook include Sidekiq::Worker REBUILD_URL_PATTERN = /https*\:\/\/inch-ci\.org\/rebuild/ # @param uid [String] # @return [void] def self.enqueue(uid, user_access_token) perform_async(uid, user_access_token) end # @api private # @param github_repo_object [] used to directly update a project def perform(uid, user_access_token) project = Store::FindProject.call(uid) arr = uid.split(':') service_name = arr[0] user_repo_name = arr[1] if service_name == "github" update_via_github(project, user_access_token) end end private def update_via_github(project, user_access_token) client = Octokit::Client.new(access_token: user_access_token) hooks = client.hooks(project.name) hooks.each do |hash| if hash['config'] && hash['config']['url'] =~ REBUILD_URL_PATTERN project.github_hook_id = hash['id'] project.github_hook_active = hash['active'] end end Store::SaveProject.call(project) end end end end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/lib/inch_ci/worker/project/build/save_build_data.rb
lib/inch_ci/worker/project/build/save_build_data.rb
require 'inch_ci/repo_url' require 'inch_ci/worker/project/build/calculate_diff' require 'inch_ci/worker/project/build/generate_badge' module InchCI module Worker module Project module Build class SaveBuildData DUPLICATE_STATUS = 'duplicate' def self.call(*args) new(*args) end # @param build_data [Hash] a Hash built from the 'build:' section # of the worker output def initialize(build, build_data, stderr = "") @build = build @build_data = BuildData.new(build_data) @build_data.stderr = stderr Store.transaction do branch = ensure_project_and_branch_exist if @build_data.success? handle_successful_build(branch) else handle_failed_build(branch) end end end private def add_revision(branch, build_data, objects) revision = Store::CreateRevision.call(branch, build_data.revision_uid, build_data.tag_uid, build_data.revision_message, build_data.revision_author_name, build_data.revision_author_email, build_data.badge_in_readme?, build_data.revision_authored_at) create_objects_in_revision(revision, objects) revision end def allow_revision_rewrite? false #@build.trigger == 'travis' end def create_objects_in_revision(revision, objects) objects.each do |attributes| Store::CreateCodeObject.call(revision, attributes) end end def ensure_project_and_branch_exist info = RepoURL.new(@build_data.repo_url) project_uid = info.project_uid branch_name = @build_data.branch_name project = Store::FindProject.call(project_uid) || Store::CreateProject.call(project_uid, @build_data.repo_url) Store::FindBranch.call(project, branch_name) || Store::CreateBranch.call(project, branch_name) end def generate_badge(project, branch, revision) code_objects = Store::FindCodeObjects.call(revision) GenerateBadge.call(project, branch, code_objects) end def update_badge_information(project, branch, revision) return unless branch == project.default_branch relevant_code_objects = InchCI::Store::FindRelevantCodeObjects.call(revision) undocumented_code_objects = relevant_code_objects.select { |code_object| code_object.grade == 'U' } project.badge_generated = true project.badge_in_readme = revision.badge_in_readme if relevant_code_objects.size > 0 project.badge_filled_in_percent = 100 - (undocumented_code_objects.size / relevant_code_objects.size.to_f * 100).to_i end if project.badge_in_readme_added_at.nil? && revision.badge_in_readme project.badge_in_readme_added_at = revision.authored_at end if project.badge_in_readme_added_at && !revision.badge_in_readme && project.badge_in_readme_removed_at.nil? project.badge_in_readme_removed_at = revision.authored_at end Store::SaveProject.call(project) end def handle_failed_build(branch) Store::UpdateFinishedBuild.call(@build, nil, @build_data) end def handle_successful_build(branch) revision = Store::FindRevision.call(branch, @build_data.revision_uid) if revision if allow_revision_rewrite? rewrite_revision(revision, @build_data.objects) else @build_data.status = DUPLICATE_STATUS end else revision = add_revision(branch, @build_data, @build_data.objects) if @build_data.latest_revision? before_revision = Store::FindLatestRevision.call(branch) Store::UpdateLatestRevision.call(branch, revision) diff = CalculateDiff.call(before_revision, revision) Store::CreateRevisionDiff.call(branch, before_revision, revision, diff) end end generate_badge(branch.project, branch, revision) update_badge_information(branch.project, branch, revision) Store::UpdateFinishedBuild.call(@build, revision, @build_data) end def rewrite_revision(revision, objects) create_objects_in_revision(revision, objects) end class BuildData attr_reader :repo_url, :branch_name attr_reader :revision_uid, :tag_uid, :revision_message attr_reader :started_at, :finished_at, :trigger, :objects attr_reader :revision_author_name, :revision_author_email, :revision_authored_at attr_reader :inch_version attr_accessor :status, :stderr def initialize(data) @data = data @status = @data['status'] @trigger = @data['trigger'] @repo_url = @data['repo_url'] @branch_name = @data['branch_name'] @revision_uid = @data['revision_uid'] @revision_message = @data['revision_message'] @revision_author_name = @data['revision_author_name'] @revision_author_email = @data['revision_author_email'] @revision_authored_at = @data['revision_authored_at'] @tag_uid = @data['tag'] @started_at = @data['started_at'] @finished_at = @data['finished_at'] @objects = @data['objects'] @inch_version = data['inch_version'] end def badge_in_readme? @data['badge_in_readme'] end # Returns true if the currently built revision should be treated as # the latest revision in the branch. def latest_revision? @data['latest_revision'] end def project_uid "#{@data['service_name']}:#{@data['user_name']}/#{@data['repo_name']}" end def success? status == 'success' end end end end end end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/lib/inch_ci/worker/project/build/generate_badge.rb
lib/inch_ci/worker/project/build/generate_badge.rb
require 'fileutils' require 'inch_ci/badge' require 'inch_ci/grade_list_collection' module InchCI module Worker module Project module Build class GenerateBadge def self.call(*args) new(*args) end def initialize(project, branch, code_objects) Badge.create(project, branch, grade_counts(code_objects)) end private def grade_counts(code_objects) GradeListCollection.new(filter(code_objects)).map(&:count) end def filter(code_objects) code_objects.select do |object| object.priority >= Config::MIN_RELEVANT_PRIORITY end end end end end end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/lib/inch_ci/worker/project/build/handle_worker_output.rb
lib/inch_ci/worker/project/build/handle_worker_output.rb
require 'yaml' require 'inch_ci/worker/project/build/save_build_data' module InchCI module Worker module Project module Build class HandleWorkerOutput def initialize(stdout, stderr, build = nil, save_service = SaveBuildData) data = handle_stdout(stdout) if data && result = data['build'] save_service.call(build, result, stderr) else debug = {:stdout => stdout, :stderr => stderr} raise "Running worker ".color(:red) + build.inspect.color(:cyan) + " failed:".color(:red) + " #{debug.inspect}" end end private # Returns the last part of the given +output+, where YAML # is defined. # @param output [String,nil] # @return [String,nil] def handle_stdout(output) yaml = output =~ /^(---\n\S+\:\n.+)/m && $1 yaml && YAML.load(yaml) end end end end end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/lib/inch_ci/worker/project/build/calculate_diff.rb
lib/inch_ci/worker/project/build/calculate_diff.rb
require 'inch_ci/diff' module InchCI module Worker module Project module Build class CalculateDiff attr_reader :diff def self.call(*args) new(*args).diff end def initialize(revision1, revision2) objects1 = if revision1 Store::FindCodeObjects.call(revision1) else [] end objects2 = Store::FindCodeObjects.call(revision2) @diff = Diff.new(objects1, objects2) end end end end end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/application.rb
config/application.rb
require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module InchCI class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de config.autoload_paths += Dir["#{config.root}/app/presenters", "#{config.root}/app/services"] end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/environment.rb
config/environment.rb
# Load the Rails application. require File.expand_path('../application', __FILE__) # Initialize the Rails application. InchCI::Application.initialize!
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/routes.rb
config/routes.rb
require 'sidekiq/web' InchCI::Application.routes.draw do mount Sidekiq::Web => '/sidekiq' get "/auth/:provider/callback" => "sessions#create" get "/signout" => "sessions#destroy", :as => :signout namespace :api do get 'v1/cli' => 'cli#hint' post 'v1/cli' => 'cli#run' get 'v1/builds' => 'builds#hint' post 'v1/builds' => 'builds#run' get 'v2/builds' => 'builds#hint' post 'v2/builds' => 'builds#run' end # Help section get 'learn_more' => 'help#about', :as => :about get 'help' => 'help#index', :as => :help get 'lets_do_javascript' => 'help#javascript_beta', :as => :lets_do_javascript get 'help/webhook' => 'help#webhook', :as => :help_webhook get 'help/badge' => 'help#badge', :as => :help_badge get 'help/grades' => 'help#grades', :as => :help_grades get 'help/config_file_yaml' => 'help#config_file_yaml', :as => :help_configuration_yaml get 'help/config_file_json' => 'help#config_file_json', :as => :help_configuration_json # legacy URLs get 'howto/webhook' => 'help#webhook' get 'howto/config_file_yaml' => 'help#config_file_yaml' get 'howto/config_file_json' => 'help#config_file_json' root 'page#welcome' namespace :admin do get 'overview' => 'overview#index' get 'cli' => 'cli#index' get 'badges/added' => 'badges#added' get 'badges/in_readme' => 'badges#in_readme' resources :builds resources :projects resources :statistics do collection do get 'added_badges', :as => :added_badges get 'days', :as => :daily get 'weeks', :as => :weekly get 'months', :as => :monthly end end resources :users end duo = ':service/:user' triple = ':service/:user/:repo' triple_constraints = {:service => /(github)/, :repo => /[^\/]+/} badge_constraints = {:format => /(png|svg)/}.merge(triple_constraints) json_constraints = {:format => /json/}.merge(triple_constraints) get "#{duo}" => 'users#show', :format => false post "init_projects" => 'users#init_projects', :as => :init_projects post "sync_projects" => 'users#sync_projects', :as => :sync_projects get "welcome" => 'users#welcome', :as => :welcome get "#{triple}/revision/:revision/code_object/:code_object" => 'code_objects#show', :constraints => triple_constraints get "#{triple}.:format" => 'projects#badge', :constraints => badge_constraints get "#{triple}.:format" => 'projects#show', :constraints => json_constraints get "(#{triple})/builds" => 'builds#index', :as => :builds, :constraints => triple_constraints #get "#{triple}(/revision/:revision)/list" => 'projects#show', :constraints => triple_constraints get "#{triple}(/revision/:revision)/suggestions" => 'projects#suggestions', :constraints => triple_constraints get "#{triple}(/revision/:revision)/history" => 'projects#history', :constraints => triple_constraints get "#{triple}(/revision/:revision)" => 'projects#show', :constraints => triple_constraints, :format => false post "#{triple}/rebuild" => 'projects#rebuild', :constraints => triple_constraints post "#{triple}/update_info" => 'projects#update_info', :constraints => triple_constraints post "#{triple}/create_hook" => 'projects#create_hook', :constraints => triple_constraints post "#{triple}/remove_hook" => 'projects#remove_hook', :constraints => triple_constraints get "#{triple}/edit" => 'projects#edit', :constraints => triple_constraints put "#{triple}" => 'projects#update', :constraints => triple_constraints post 'rebuild' => 'projects#rebuild_via_hook' resources :builds do member do get :history_show end end resources :projects end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/boot.rb
config/boot.rb
# Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/filter_parameter_logging.rb
config/initializers/filter_parameter_logging.rb
# Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password]
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/session_store.rb
config/initializers/session_store.rb
# Be sure to restart your server when you modify this file. InchCI::Application.config.session_store :cookie_store, key: '_inch_ci-web_session'
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/requires.rb
config/initializers/requires.rb
require 'inch_ci/config' require 'inch_ci/store' require 'inch_ci/worker/project' require 'inch_ci/worker/user'
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/wrap_parameters.rb
config/initializers/wrap_parameters.rb
# Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters format: [:json] if respond_to?(:wrap_parameters) end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do # self.include_root_in_json = true # end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/omniauth.rb
config/initializers/omniauth.rb
require 'inch_ci/access_token' if InchCI::AccessToken[:github_client_id] Rails.application.config.middleware.use OmniAuth::Builder do provider :github, InchCI::AccessToken[:github_client_id], InchCI::AccessToken[:github_secret], :scope => 'user:email,write:repo_hook,read:org' end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/inflections.rb
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 |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym 'RESTful' # end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/featured_projects.rb
config/initializers/featured_projects.rb
FEATURED_PROJECT_UIDS = { ruby: %w( github:bbatsov/rubocop github:bundler/bundler github:guard/guard github:haml/haml github:justinfrench/formtastic github:mbj/mutant github:peek/peek github:pry/pry github:redis/redis-rb github:rkh/mustermann github:rom-rb/rom github:sferik/twitter github:solnic/virtus github:troessner/reek github:visionmedia/commander ), elixir: %w( github:elixir-lang/ecto github:elixir-lang/plug github:phoenixframework/phoenix github:edgurgel/poxa github:pma/amqp ), javascript: %w( github:cujojs/when github:foreverjs/forever github:Unitech/PM2 github:sass/node-sass ) }
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/sentry.rb
config/initializers/sentry.rb
require 'raven'
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/backtrace_silencers.rb
config/initializers/backtrace_silencers.rb
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers!
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/mime_types.rb
config/initializers/mime_types.rb
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/initializers/secret_token.rb
config/initializers/secret_token.rb
# Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. # You can use `rake secret` to generate a secure secret key. # Make sure your secret_key_base is kept private # if you're sharing your code publicly. InchCI::Application.config.secret_key_base = 'ce52fc381184828debb9e35f064f78bd3bf82b5939052f30051d64d356785e547fd95313b7107a6444ddca64a088b0376c29269c2b84f186cdb58e48c3615577'
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/environments/test.rb
config/environments/test.rb
InchCI::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. config.serve_static_assets = true config.static_cache_control = "public, max-age=3600" # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/environments/development.rb
config/environments/development.rb
InchCI::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true BetterErrors::Middleware.allow_ip! '10.0.2.2' config.after_initialize do Bullet.enable = true #Bullet.alert = true Bullet.bullet_logger = true Bullet.console = true #Bullet.growl = true Bullet.rails_logger = true Bullet.add_footer = true end end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
inch-ci/inch_ci-web
https://github.com/inch-ci/inch_ci-web/blob/db1437218f544e4f21bdfd3690a952bf26a84028/config/environments/production.rb
config/environments/production.rb
InchCI::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both thread web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Enable Rack::Cache to put a simple HTTP cache in front of your application # Add `rack-cache` to your Gemfile before enabling this. # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). config.serve_static_assets = false # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # Generate digests for assets URLs. config.assets.digest = true # Version of your assets, change this if you want to expire all your assets. config.assets.version = '1.0' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Set to :debug to see everything in the log. config.log_level = :info # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Use a different cache store in production. # config.cache_store = :mem_cache_store # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = "http://assets.example.com" # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # config.assets.precompile += %w( search.js ) config.assets.precompile += %w( admin/admin.js admin/admin.css ) # Adding Webfonts to the Asset Pipeline config.assets.precompile << Proc.new { |path| if path =~ /\.(eot|svg|ttf|woff|woff2)\z/ true end } # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Disable automatic flushing of the log to improve performance. # config.autoflush_log = false # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new end
ruby
MIT
db1437218f544e4f21bdfd3690a952bf26a84028
2026-01-04T17:44:13.103953Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/rails/init.rb
rails/init.rb
require 'acts_as_revisable'
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/generators/revisable_migration/revisable_migration_generator.rb
generators/revisable_migration/revisable_migration_generator.rb
class RevisableMigrationGenerator < Rails::Generator::NamedBase def manifest record do |m| revisable_columns = [ ["revisable_original_id", "integer"], ["revisable_branched_from_id", "integer"], ["revisable_number", "integer", 0], ["revisable_name", "string"], ["revisable_type", "string"], ["revisable_current_at", "datetime"], ["revisable_revised_at", "datetime"], ["revisable_deleted_at", "datetime"], ["revisable_is_current", "boolean", 1] ] m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "make_#{class_name.underscore.pluralize}_revisable", :assigns => { :cols => revisable_columns } end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/generators/revisable_migration/templates/migration.rb
generators/revisable_migration/templates/migration.rb
<% table_name = class_name.underscore.pluralize -%> class Make<%= class_name.underscore.pluralize.camelize %>Revisable < ActiveRecord::Migration def self.up <% cols.each do |column_name,column_type,default| -%> add_column :<%= table_name %>, :<%= column_name %>, :<%= column_type %><%= ", :default => #{default}" unless default.blank? %> <% end -%> end def self.down <% cols.each do |column_name,_| -%> remove_column :<%= table_name %>, :<%= column_name %> <% end -%> end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/deletable_spec.rb
spec/deletable_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' describe WithoutScope::ActsAsRevisable::Deletable do after(:each) do cleanup_db end before(:each) do @person = Person.create(:name => "Rich", :notes => "a note") @person.update_attribute(:name, "Sam") end it "should store a revision on destroy" do lambda{ @person.destroy }.should change(OldPerson, :count).from(1).to(2) end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/revert_spec.rb
spec/revert_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' describe WithoutScope::ActsAsRevisable, "with reverting" do after(:each) do cleanup_db end before(:each) do @project = Project.create(:name => "Rich", :notes => "a note") @project.update_attribute(:name, "Sam") end it "should let you revert to previous versions" do @project.revert_to!(:first) @project.name.should == "Rich" end it "should accept the :without_revision hash option" do lambda { @project.revert_to!(:first, :without_revision => true) }.should_not raise_error @project.name.should == "Rich" end it "should support the revert_to_without_revision method" do lambda { @project.revert_to_without_revision(:first).save }.should_not raise_error @project.name.should == "Rich" end it "should support the revert_to_without_revision! method" do lambda { @project.revert_to_without_revision!(:first) }.should_not raise_error @project.name.should == "Rich" end it "should let you revert to previous versions without a new revision" do @project.revert_to!(:first, :without_revision => true) @project.revisions.size.should == 1 end it "should support the revert_to method" do lambda{ @project.revert_to(:first) }.should_not raise_error @project.should be_changed end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/general_spec.rb
spec/general_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' describe WithoutScope::ActsAsRevisable do after(:each) do cleanup_db end before(:each) do @project = Project.create(:name => "Rich", :notes => "this plugin's author") @post = Post.create(:name => 'a name') end describe "with auto-detected revision class" do it "should find the revision class" do Post.revision_class.should == PostRevision end it "should find the revisable class" do PostRevision.revisable_class.should == Post end it "should use the revision class" do @post.update_attribute(:name, 'another name') @post.revisions(true).first.class.should == PostRevision end end describe "with auto-generated revision class" do it "should have a revision class" do Foo.revision_class.should == FooRevision end end describe "without revisions" do it "should have a revision_number of zero" do @project.revision_number.should be_zero end it "should be the current revision" do @project.revisable_is_current.should be_true end it "should respond to current_revision? positively" do @project.current_revision?.should be_true end it "should not have any revisions in the generic association" do @project.revisions.should be_empty end it "should not have any revisions in the pretty named association" do @project.sessions.should be_empty end end describe "with revisions" do before(:each) do @project.update_attribute(:name, "Stephen") end it "should have a revision_number of one" do @project.revision_number.should == 1 end it "should have a single revision in the generic association" do @project.revisions.size.should == 1 end it "should have a single revision in the pretty named association" do @project.sessions.size.should == 1 end it "should have a single revision with a revision_number of zero" do @project.revisions.collect{ |rev| rev.revision_number }.should == [0] end it "should return an instance of the revision class" do @project.revisions.first.should be_an_instance_of(Session) end it "should have the original revision's data" do @project.revisions.first.name.should == "Rich" end end describe "with multiple revisions" do before(:each) do @project.update_attribute(:name, "Stephen") @project.update_attribute(:name, "Michael") end it "should have a revision_number of two" do @project.revision_number.should == 2 end it "should have revisions with revision_number values of zero and one" do @project.revisions.collect{ |rev| rev.revision_number }.should == [1,0] end end describe "with excluded columns modified" do before(:each) do @project.update_attribute(:unimportant, "a new value") end it "should maintain the revision_number at zero" do @project.revision_number.should be_zero end it "should not have any revisions" do @project.revisions.should be_empty end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/quoted_columns_spec.rb
spec/quoted_columns_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' describe "the quoted_columns extension" do after(:each) do cleanup_db end it "should quote symbols matching column names as columns" do Project.send(:quote_bound_value, :name).should == %q{"projects"."name"} end it "should not quote symbols that don't match column names" do Project.send(:quote_bound_value, :whatever).should == "'#{:whatever.to_yaml}'" end it "should not quote strings any differently" do Project.send(:quote_bound_value, "what").should == ActiveRecord::Base.send(:quote_bound_value, "what") end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/validations_spec.rb
spec/validations_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' describe WithoutScope::ActsAsRevisable, "with validations" do after(:each) do cleanup_db end before(:each) do @post = Post.create(:name => 'a post') @foo = Foo.create(:name => 'a foo') end describe "unique fields" do it "should allow revisions" do lambda {@post.revise!; @post.revise!}.should_not raise_error end end describe "unique fields with validation scoping off" do it "should not allow revisions" do lambda {@foo.revise!; @foo.revise!}.should raise_error end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/sti_spec.rb
spec/sti_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' describe WithoutScope::ActsAsRevisable, "with single table inheritance" do after(:each) do cleanup_db end before(:each) do @article = Article.create(:name => 'an article') @post = Post.create(:name => 'a post') end describe "after a revision" do it "an article has revisions of the right type" do @article.revise! @article.revisions(true).first.class.should == ArticleRevision end it "a post has revisions of the right type" do @post.revise! @post.revisions(true).first.class.should == PostRevision end it "revisable_type column is nil for the root type" do @post.revise! @post.revisions(true).first.revisable_type.should == 'Post' end it "revisable_type column is set properly" do @article.revise! @article.revisions(true).first.revisable_type.should == 'Article' end it "can find an article by name" do Article.find_by_name('an article').should_not be_nil end it "can find a post by name" do Post.find_by_name('a post').should_not be_nil end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/find_spec.rb
spec/find_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' describe WithoutScope::ActsAsRevisable do after(:each) do cleanup_db end describe "with a single revision" do before(:each) do @project1 = Project.create(:name => "Rich", :notes => "a note") @project1.update_attribute(:name, "Sam") end it "should just find the current revision by default" do Project.find(:first).name.should == "Sam" end it "should accept the :with_revisions options" do lambda { Project.find(:all, :with_revisions => true) }.should_not raise_error end it "should find current and revisions with the :with_revisions option" do Project.find(:all, :with_revisions => true).size.should == 2 end it "should find revisions with conditions" do Project.find(:all, :conditions => {:name => "Rich"}, :with_revisions => true).should == [@project1.find_revision(:previous)] end it "should find last revision" do @project1.find_revision(:last).should == @project1.find_revision(:previous) end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/associations_spec.rb
spec/associations_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' describe WithoutScope::ActsAsRevisable do after(:each) do cleanup_db end before(:each) do @project = Project.create(:name => "Rich", :notes => "this plugin's author") @project.update_attribute(:name, "one") @project.update_attribute(:name, "two") @project.update_attribute(:name, "three") end it "should have a pretty named association" do lambda { @project.sessions }.should_not raise_error end it "should return all the revisions" do @project.revisions.size.should == 3 end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/spec_helper.rb
spec/spec_helper.rb
begin require 'spec' rescue LoadError require 'rubygems' gem 'rspec' require 'spec' end if ENV['EDGE_RAILS_PATH'] edge_path = File.expand_path(ENV['EDGE_RAILS_PATH']) require File.join(edge_path, 'activesupport', 'lib', 'active_support') require File.join(edge_path, 'activerecord', 'lib', 'active_record') end $:.unshift(File.dirname(__FILE__) + '/../lib') require 'acts_as_revisable' ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") def setup_db ActiveRecord::Schema.define(:version => 1) do create_table :people do |t| t.string :name, :revisable_name, :revisable_type t.text :notes t.boolean :revisable_is_current t.integer :revisable_original_id, :revisable_branched_from_id, :revisable_number, :project_id t.datetime :revisable_current_at, :revisable_revised_at, :revisable_deleted_at t.timestamps end create_table :projects do |t| t.string :name, :unimportant, :revisable_name, :revisable_type t.text :notes t.boolean :revisable_is_current t.integer :revisable_original_id, :revisable_branched_from_id, :revisable_number t.datetime :revisable_current_at, :revisable_revised_at, :revisable_deleted_at t.timestamps end create_table :foos do |t| t.string :name, :revisable_name, :revisable_type t.text :notes t.boolean :revisable_is_current t.integer :revisable_original_id, :revisable_branched_from_id, :revisable_number, :project_id t.datetime :revisable_current_at, :revisable_revised_at, :revisable_deleted_at t.timestamps end create_table :posts do |t| t.string :name, :revisable_name, :revisable_type, :type t.boolean :revisable_is_current t.integer :revisable_original_id, :revisable_branched_from_id, :revisable_number t.datetime :revisable_current_at, :revisable_revised_at, :revisable_deleted_at t.timestamps end end end setup_db def cleanup_db ActiveRecord::Base.connection.tables.each do |table| ActiveRecord::Base.connection.execute("delete from #{table}") end end class Person < ActiveRecord::Base belongs_to :project acts_as_revisable do revision_class_name "OldPerson" on_delete :revise end end class OldPerson < ActiveRecord::Base acts_as_revision do revisable_class_name "Person" clone_associations :all end end class Project < ActiveRecord::Base has_many :people acts_as_revisable do revision_class_name "Session" except :unimportant end end class Session < ActiveRecord::Base acts_as_revision do revisable_class_name "Project" clone_associations :all end end class Foo < ActiveRecord::Base acts_as_revisable :generate_revision_class => true, :no_validation_scoping => true validates_uniqueness_of :name end class Post < ActiveRecord::Base acts_as_revisable validates_uniqueness_of :name end class PostRevision < ActiveRecord::Base acts_as_revision end class Article < Post acts_as_revisable end class ArticleRevision < PostRevision acts_as_revision end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/branch_spec.rb
spec/branch_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' class Project validates_presence_of :name end describe WithoutScope::ActsAsRevisable, "with branching" do after(:each) do cleanup_db end before(:each) do @project = Project.create(:name => "Rich", :notes => "a note") @project.update_attribute(:name, "Sam") end it "should allow for branch creation" do @project.should == @project.branch.branch_source end it "should always tie the branch to the correct version" do b = @project.branch! @project.revise! prev = @project.find_revision(:last) b.reload.branch_source.should == prev end it "should have branches" do b = @project.branch! @project.branches.size.should == 1 end it "should branch without saving" do @project.branch.should be_new_record end it "should branch and save" do @project.branch!.should_not be_new_record end it "should not raise an error for a valid branch" do lambda { @project.branch!(:name => "A New User") }.should_not raise_error end it "should raise an error for invalid records" do lambda { @project.branch!(:name => nil) }.should raise_error end it "should not save an invalid record" do @branch = @project.branch(:name => nil) @branch.save.should be_false @branch.should be_new_record end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/spec/options_spec.rb
spec/options_spec.rb
require File.dirname(__FILE__) + '/spec_helper.rb' shared_examples_for "common Options usage" do it "should return a set value" do @options.one.should == 1 end it "should return nil for an unset value" do @options.two.should be_nil end it "should return false for unset query option" do @options.should_not be_unset_value end it "should return true for a query option set to true" do @options.should be_yes end it "should return false for a query option set to false" do @options.should_not be_no end it "should return false for a query on a non-boolean value" do @options.should_not be_one end it "should return an array when passed one" do @options.arr.should be_a_kind_of(Array) end it "should not return an array when not passed one" do @options.one.should_not be_a_kind_of(Array) end it "should have the right number of elements in an array" do @options.arr.size.should == 3 end end describe WithoutScope::ActsAsRevisable::Options do describe "with hash options" do before(:each) do @options = WithoutScope::ActsAsRevisable::Options.new :one => 1, :yes => true, :no => false, :arr => [1,2,3] end it_should_behave_like "common Options usage" end describe "with block options" do before(:each) do @options = WithoutScope::ActsAsRevisable::Options.new do one 1 yes true arr [1,2,3] end end it_should_behave_like "common Options usage" end describe "with both block and hash options" do before(:each) do @options = WithoutScope::ActsAsRevisable::Options.new(:yes => true, :arr => [1,2,3]) do one 1 end end it_should_behave_like "common Options usage" describe "the block should override the hash" do before(:each) do @options = WithoutScope::ActsAsRevisable::Options.new(:yes => false, :one => 10, :arr => [1,2,3,4,5]) do one 1 yes true arr [1,2,3] end end it_should_behave_like "common Options usage" end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable.rb
lib/acts_as_revisable.rb
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'activesupport' unless defined? ActiveSupport require 'activerecord' unless defined? ActiveRecord require 'acts_as_revisable/version.rb' require 'acts_as_revisable/base' ActiveRecord::Base.send(:include, WithoutScope::ActsAsRevisable)
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/version.rb
lib/acts_as_revisable/version.rb
module WithoutScope #:nodoc: module ActsAsRevisable module VERSION #:nodoc: MAJOR = 1 MINOR = 1 TINY = 1 STRING = [MAJOR, MINOR, TINY].join('.') end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/gem_spec_options.rb
lib/acts_as_revisable/gem_spec_options.rb
module WithoutScope #:nodoc: module ActsAsRevisable class GemSpecOptions HASH = { :name => "rich-acts_as_revisable", :version => WithoutScope::ActsAsRevisable::VERSION::STRING, :summary => "acts_as_revisable enables revision tracking, querying, reverting and branching of ActiveRecord models. Inspired by acts_as_versioned.", :email => "rich@withoutscope.com", :homepage => "http://github.com/rich/acts_as_revisable", :has_rdoc => true, :authors => ["Rich Cavanaugh", "Stephen Caudill"], :files => %w( LICENSE README.rdoc Rakefile ) + Dir["{spec,lib,generators,rails}/**/*"], :rdoc_options => ["--main", "README.rdoc"], :extra_rdoc_files => ["README.rdoc", "LICENSE"] } end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/options.rb
lib/acts_as_revisable/options.rb
module WithoutScope module ActsAsRevisable # This class provides for a flexible method of setting # options and querying them. This is especially useful # for giving users flexibility when using your plugin. class Options def initialize(*options, &block) @options = options.extract_options! instance_eval(&block) if block_given? end def method_missing(key, *args) return (@options[key.to_s.gsub(/\?$/, '').to_sym].eql?(true)) if key.to_s.match(/\?$/) if args.blank? @options[key.to_sym] else @options[key.to_sym] = args.size == 1 ? args.first : args end end end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/validations.rb
lib/acts_as_revisable/validations.rb
module WithoutScope module ActsAsRevisable module Validations def validates_uniqueness_of(*args) options = args.extract_options! (options[:scope] ||= []) << :revisable_is_current super(*(args << options)) end end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/base.rb
lib/acts_as_revisable/base.rb
require 'acts_as_revisable/options' require 'acts_as_revisable/quoted_columns' require 'acts_as_revisable/validations' require 'acts_as_revisable/acts/common' require 'acts_as_revisable/acts/revision' require 'acts_as_revisable/acts/revisable' require 'acts_as_revisable/acts/deletable' module WithoutScope # define the columns used internall by AAR REVISABLE_SYSTEM_COLUMNS = %w(revisable_original_id revisable_branched_from_id revisable_number revisable_name revisable_type revisable_current_at revisable_revised_at revisable_deleted_at revisable_is_current) # define the ActiveRecord magic columns that should not be monitored REVISABLE_UNREVISABLE_COLUMNS = %w(id type created_at updated_at) module ActsAsRevisable def self.included(base) base.send(:extend, ClassMethods) end module ClassMethods # This +acts_as+ extension provides for making a model the # revisable model in an acts_as_revisable pair. def acts_as_revisable(*args, &block) revisable_shared_setup(args, block) self.send(:include, Revisable) self.send(:include, Deletable) if self.revisable_options.on_delete == :revise end # This +acts_as+ extension provides for making a model the # revision model in an acts_as_revisable pair. def acts_as_revision(*args, &block) revisable_shared_setup(args, block) self.send(:include, Revision) end private # Performs the setup needed for both kinds of acts_as_revisable # models. def revisable_shared_setup(args, block) class << self attr_accessor :revisable_options end options = args.extract_options! self.revisable_options = Options.new(options, &block) self.send(:include, Common) self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping? self.send(:include, WithoutScope::QuotedColumnConditions) end end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/quoted_columns.rb
lib/acts_as_revisable/quoted_columns.rb
# This module is more about the pretty than anything else. This allows # you to use symbols for column names in a conditions hash. # # User.find(:all, :conditions => ["? = ?", :name, "sam"]) # # Would generate: # # select * from users where "users"."name" = 'sam' # # This is consistent with Rails and Ruby where symbols are used to # represent methods. Only a symbol matching a column name will # trigger this beavior. module WithoutScope::QuotedColumnConditions def self.included(base) base.send(:extend, ClassMethods) end module ClassMethods def quote_bound_value(value) if value.is_a?(Symbol) && column_names.member?(value.to_s) # code borrowed from sanitize_sql_hash_for_conditions attr = value.to_s table_name = quoted_table_name return "#{table_name}.#{connection.quote_column_name(attr)}" end super(value) end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/acts/common.rb
lib/acts_as_revisable/acts/common.rb
module WithoutScope module ActsAsRevisable # This module is mixed into the revision and revisable classes. # # ==== Callbacks # # * +before_branch+ is called on the +Revisable+ or +Revision+ that is # being branched # * +after_branch+ is called on the +Revisable+ or +Revision+ that is # being branched module Common def self.included(base) #:nodoc: base.send(:extend, ClassMethods) base.class_inheritable_hash :revisable_after_callback_blocks base.revisable_after_callback_blocks = {} base.class_inheritable_hash :revisable_current_states base.revisable_current_states = {} base.instance_eval do define_callbacks :before_branch, :after_branch has_many :branches, (revisable_options.revision_association_options || {}).merge({:class_name => base.name, :foreign_key => :revisable_branched_from_id}) after_save :execute_blocks_after_save end end # Executes the blocks stored in an accessor after a save. def execute_blocks_after_save #:nodoc: return unless revisable_after_callback_blocks[:save] revisable_after_callback_blocks[:save].each do |block| block.call end revisable_after_callback_blocks.delete(:save) end # Stores a block for later execution after a given callback. # The parameter +key+ is the callback the block should be # executed after. def execute_after(key, &block) #:nodoc: return unless block_given? revisable_after_callback_blocks[key] ||= [] revisable_after_callback_blocks[key] << block end # Branch the +Revisable+ or +Revision+ and return the new # +revisable+ instance. The instance has not been saved yet. # # ==== Callbacks # * +before_branch+ is called on the +Revisable+ or +Revision+ that is # being branched # * +after_branch+ is called on the +Revisable+ or +Revision+ that is # being branched # * +after_branch_created+ is called on the newly created # +Revisable+ instance. def branch(*args, &block) is_branching! unless run_callbacks(:before_branch) { |r, o| r == false} raise ActiveRecord::RecordNotSaved end options = args.extract_options! options[:revisable_branched_from_id] = self.id self.class.column_names.each do |col| next unless self.class.revisable_should_clone_column? col options[col.to_sym] = self[col] unless options.has_key?(col.to_sym) end br = self.class.revisable_class.new(options) br.is_branching! br.execute_after(:save) do begin run_callbacks(:after_branch) br.run_callbacks(:after_branch_created) ensure br.is_branching!(false) is_branching!(false) end end block.call(br) if block_given? br end # Same as #branch except it calls #save! on the new +Revisable+ instance. def branch!(*args) branch(*args) do |br| br.save! end end # Globally sets the reverting state of this record. def is_branching!(value=true) #:nodoc: set_revisable_state(:branching, value) end # XXX: This should be done with a "belongs_to" but the default # scope on the target class prevents the find with revisions. def branch_source self[:branch_source] ||= if self[:revisable_branched_from_id] self.class.find(self[:revisable_branched_from_id], :with_revisions => true) else nil end end # Returns true if the _record_ (not just this instance # of the record) is currently being branched. def is_branching? get_revisable_state(:branching) end # When called on a +Revision+ it returns the original id. When # called on a +Revisable+ it returns the id. def original_id self[:revisable_original_id] || self[:id] end # Globally sets the state for a given record. This is keyed # on the primary_key of a saved record or the object_id # on a new instance. def set_revisable_state(type, value) #:nodoc: key = self.read_attribute(self.class.primary_key) key = object_id if key.nil? revisable_current_states[type] ||= {} revisable_current_states[type][key] = value revisable_current_states[type].delete(key) unless value end # Returns the state of the given record. def get_revisable_state(type) #:nodoc: key = self.read_attribute(self.class.primary_key) revisable_current_states[type] ||= {} revisable_current_states[type][key] || revisable_current_states[type][object_id] || false end # Returns true if the instance is the first revision. def first_revision? self.revision_number == 1 end # Returns true if the instance is the most recent revision. def latest_revision? self.revision_number == self.current_revision.revision_number end # Returns true if the instance is the current record and not a revision. def current_revision? self.is_a? self.class.revisable_class end # Accessor for revisable_number just to make external API more pleasant. def revision_number self[:revisable_number] ||= 0 end def revision_number=(value) self[:revisable_number] = value end def diffs(what) what = current_revision.find_revision(what) returning({}) do |changes| self.class.revisable_class.revisable_watch_columns.each do |c| changes[c] = [self[c], what[c]] unless self[c] == what[c] end end end def deleted? self.revisable_deleted_at.present? end module ClassMethods # Returns true if the revision should clone the given column. def revisable_should_clone_column?(col) #:nodoc: return false if (REVISABLE_SYSTEM_COLUMNS + REVISABLE_UNREVISABLE_COLUMNS).member? col true end # acts_as_revisable's override for instantiate so we can # return the appropriate type of model based on whether # or not the record is the current record. def instantiate(record) #:nodoc: is_current = columns_hash["revisable_is_current"].type_cast( record["revisable_is_current"]) if (is_current && self == self.revisable_class) || (!is_current && self == self.revision_class) return super(record) end object = if is_current self.revisable_class else self.revision_class end.allocate object.instance_variable_set("@attributes", record) object.instance_variable_set("@attributes_cache", Hash.new) if object.respond_to_without_attributes?(:after_find) object.send(:callback, :after_find) end if object.respond_to_without_attributes?(:after_initialize) object.send(:callback, :after_initialize) end object end end end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/acts/revision.rb
lib/acts_as_revisable/acts/revision.rb
module WithoutScope module ActsAsRevisable # This module is mixed into the revision classes. # # ==== Callbacks # # * +before_restore+ is called on the revision class before it is # restored as the current record. # * +after_restore+ is called on the revision class after it is # restored as the current record. module Revision def self.included(base) #:nodoc: base.send(:extend, ClassMethods) class << base attr_accessor :revisable_revisable_class, :revisable_cloned_associations end base.instance_eval do set_table_name(revisable_class.table_name) default_scope :conditions => {:revisable_is_current => false} define_callbacks :before_restore, :after_restore before_create :revision_setup after_create :grab_my_branches named_scope :deleted, :conditions => ["? is not null", :revisable_deleted_at] [:current_revision, revisable_association_name.to_sym].each do |a| belongs_to a, :class_name => revisable_class_name, :foreign_key => :revisable_original_id end [[:ancestors, "<"], [:descendants, ">"]].each do |a| # Jumping through hoops here to try and make sure the # :finder_sql is cross-database compatible. :finder_sql # in a plugin is evil but, I see no other option. has_many a.first, :class_name => revision_class_name, :finder_sql => "select * from #{quoted_table_name} where #{quote_bound_value(:revisable_original_id)} = \#{revisable_original_id} and #{quote_bound_value(:revisable_number)} #{a.last} \#{revisable_number} and #{quote_bound_value(:revisable_is_current)} = #{quote_value(false)} order by #{quote_bound_value(:revisable_number)} #{(a.last.eql?("<") ? "DESC" : "ASC")}" end end end def find_revision(*args) current_revision.find_revision(*args) end # Return the revision prior to this one. def previous_revision self.class.find(:first, :conditions => {:revisable_original_id => revisable_original_id, :revisable_number => revisable_number - 1}) end # Return the revision after this one. def next_revision self.class.find(:first, :conditions => {:revisable_original_id => revisable_original_id, :revisable_number => revisable_number + 1}) end # Setter for revisable_name just to make external API more pleasant. def revision_name=(val) #:nodoc: self[:revisable_name] = val end # Accessor for revisable_name just to make external API more pleasant. def revision_name #:nodoc: self[:revisable_name] end # Sets some initial values for a new revision. def revision_setup #:nodoc: now = Time.current prev = current_revision.revisions.first prev.update_attribute(:revisable_revised_at, now) if prev self[:revisable_current_at] = now + 1.second self[:revisable_is_current] = false self[:revisable_branched_from_id] = current_revision[:revisable_branched_from_id] self[:revisable_type] = current_revision[:type] || current_revision.class.name end def grab_my_branches self.class.revisable_class.update_all(["revisable_branched_from_id = ?", self[:id]], ["revisable_branched_from_id = ?", self[:revisable_original_id]]) end def from_revisable current_revision.for_revision end def reverting_from from_revisable[:reverting_from] end def reverting_from=(val) from_revisable[:reverting_from] = val end def reverting_to from_revisable[:reverting_to] end def reverting_to=(val) from_revisable[:reverting_to] = val end module ClassMethods # Returns the +revisable_class_name+ as configured in # +acts_as_revisable+. def revisable_class_name #:nodoc: self.revisable_options.revisable_class_name || self.name.gsub(/Revision/, '') end # Returns the actual +Revisable+ class based on the # #revisable_class_name. def revisable_class #:nodoc: self.revisable_revisable_class ||= self.revisable_class_name.constantize end # Returns the revision_class which in this case is simply +self+. def revision_class #:nodoc: self end def revision_class_name #:nodoc: self.name end # Returns the name of the association acts_as_revision # creates. def revisable_association_name #:nodoc: revisable_class_name.underscore end # Returns an array of the associations that should be cloned. def revision_cloned_associations #:nodoc: clone_associations = self.revisable_options.clone_associations self.revisable_cloned_associations ||= if clone_associations.blank? [] elsif clone_associations.eql? :all revisable_class.reflect_on_all_associations.map(&:name) elsif clone_associations.is_a? [].class clone_associations elsif clone_associations[:only] [clone_associations[:only]].flatten elsif clone_associations[:except] revisable_class.reflect_on_all_associations.map(&:name) - [clone_associations[:except]].flatten end end end end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/acts/deletable.rb
lib/acts_as_revisable/acts/deletable.rb
module WithoutScope module ActsAsRevisable module Deletable def self.included(base) base.instance_eval do define_callbacks :before_revise_on_destroy, :after_revise_on_destroy end end def destroy now = Time.current prev = self.revisions.first self.revisable_deleted_at = now self.revisable_is_current = false self.revisable_current_at = if prev prev.update_attribute(:revisable_revised_at, now) prev.revisable_revised_at + 1.second else self.created_at end self.revisable_revised_at = self.revisable_deleted_at return false unless run_callbacks(:before_revise_on_destroy) { |r, o| r == false} returning(self.save(:without_revision => true)) do run_callbacks(:after_revise_on_destroy) end end end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rich/acts_as_revisable
https://github.com/rich/acts_as_revisable/blob/32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf/lib/acts_as_revisable/acts/revisable.rb
lib/acts_as_revisable/acts/revisable.rb
module WithoutScope module ActsAsRevisable # This module is mixed into the revision classes. # # ==== Callbacks # # * +before_revise+ is called before the record is revised. # * +after_revise+ is called after the record is revised. # * +before_revert+ is called before the record is reverted. # * +after_revert+ is called after the record is reverted. # * +before_changeset+ is called before a changeset block is called. # * +after_changeset+ is called after a changeset block is called. # * +after_branch_created+ is called on the new revisable instance # created by branching after it's been created. module Revisable def self.included(base) #:nodoc: base.send(:extend, ClassMethods) class << base attr_accessor :revisable_revision_class, :revisable_columns end base.class_inheritable_hash :revisable_shared_objects base.revisable_shared_objects = {} base.instance_eval do attr_accessor :revisable_new_params, :revisable_revision define_callbacks :before_revise, :after_revise, :before_revert, :after_revert, :before_changeset, :after_changeset, :after_branch_created before_create :before_revisable_create before_update :before_revisable_update after_update :after_revisable_update after_save :clear_revisable_shared_objects!, :unless => :is_reverting? default_scope :conditions => {:revisable_is_current => true} [:revisions, revisions_association_name.to_sym].each do |assoc| has_many assoc, (revisable_options.revision_association_options || {}).merge({:class_name => revision_class_name, :foreign_key => :revisable_original_id, :order => "#{quoted_table_name}.#{connection.quote_column_name(:revisable_number)} DESC", :dependent => :destroy}) end end if !Object.const_defined?(base.revision_class_name) && base.revisable_options.generate_revision_class? Object.const_set(base.revision_class_name, Class.new(ActiveRecord::Base)).instance_eval do acts_as_revision end end end # Finds a specific revision of self. # # The +by+ parameter can be a revision_class instance, # the symbols :first, :previous or :last, a Time instance # or an Integer. # # When passed a revision_class instance, this method # simply returns it. This is used primarily by revert_to!. # # When passed :first it returns the first revision created. # # When passed :previous or :last it returns the last revision # created. # # When passed a Time instance it returns the revision that # was the current record at the given time. # # When passed an Integer it returns the revision with that # revision_number. def find_revision(by) by = Integer(by) if by.is_a?(String) && by.match(/[0-9]+/) case by when self.class by when self.class.revision_class by when :first revisions.last when :previous, :last revisions.first when Time revisions.find(:first, :conditions => ["? >= ? and ? <= ?", :revisable_revised_at, by, :revisable_current_at, by]) when self.revisable_number self else revisions.find_by_revisable_number(by) end end # Returns a revisable_class instance initialized with the record # found using find_revision. # # The +what+ parameter is simply passed to find_revision and the # returned record forms the basis of the reverted record. # # ==== Callbacks # # * +before_revert+ is called before the record is reverted. # * +after_revert+ is called after the record is reverted. # # If :without_revision => true has not been passed the # following callbacks are also called: # # * +before_revise+ is called before the record is revised. # * +after_revise+ is called after the record is revised. def revert_to(what, *args, &block) #:yields: is_reverting! unless run_callbacks(:before_revert) { |r, o| r == false} raise ActiveRecord::RecordNotSaved end options = args.extract_options! rev = find_revision(what) self.reverting_to, self.reverting_from = rev, self unless rev.run_callbacks(:before_restore) { |r, o| r == false} raise ActiveRecord::RecordNotSaved end self.class.column_names.each do |col| next unless self.class.revisable_should_clone_column? col self[col] = rev[col] end self.no_revision! if options.delete :without_revision self.revisable_new_params = options yield(self) if block_given? rev.run_callbacks(:after_restore) run_callbacks(:after_revert) self ensure is_reverting!(false) clear_revisable_shared_objects! end # Same as revert_to except it also saves the record. def revert_to!(what, *args) revert_to(what, *args) do self.no_revision? ? save! : revise! end end # Equivalent to: # revert_to(:without_revision => true) def revert_to_without_revision(*args) options = args.extract_options! options.update({:without_revision => true}) revert_to(*(args << options)) end # Equivalent to: # revert_to!(:without_revision => true) def revert_to_without_revision!(*args) options = args.extract_options! options.update({:without_revision => true}) revert_to!(*(args << options)) end # Globally sets the reverting state of this record. def is_reverting!(val=true) #:nodoc: set_revisable_state(:reverting, val) end # Returns true if the _record_ (not just this instance # of the record) is currently being reverted. def is_reverting? get_revisable_state(:reverting) || false end # Sets whether or not to force a revision. def force_revision!(val=true) #:nodoc: set_revisable_state(:force_revision, val) end # Returns true if a revision should be forced. def force_revision? #:nodoc: get_revisable_state(:force_revision) || false end # Sets whether or not a revision should be created. def no_revision!(val=true) #:nodoc: set_revisable_state(:no_revision, val) end # Returns true if no revision should be created. def no_revision? #:nodoc: get_revisable_state(:no_revision) || false end # Force an immediate revision whether or # not any columns have been modified. # # The +args+ catch-all argument is not used. It's primarily # there to allow +revise!+ to be used directly as an association # callback since association callbacks are passed an argument. # # ==== Callbacks # # * +before_revise+ is called before the record is revised. # * +after_revise+ is called after the record is revised. def revise!(*args) return if in_revision? begin force_revision! in_revision! save! ensure in_revision!(false) force_revision!(false) end end # Groups statements that could trigger several revisions into # a single revision. The revision is created once #save is called. # # ==== Example # # @project.revision_number # => 1 # @project.changeset do |project| # # each one of the following statements would # # normally trigger a revision # project.update_attribute(:name, "new name") # project.revise! # project.revise! # end # @project.save # @project.revision_number # => 2 # # ==== Callbacks # # * +before_changeset+ is called before a changeset block is called. # * +after_changeset+ is called after a changeset block is called. def changeset(&block) return unless block_given? return yield(self) if in_revision? unless run_callbacks(:before_changeset) { |r, o| r == false} raise ActiveRecord::RecordNotSaved end begin force_revision! in_revision! returning(yield(self)) do run_callbacks(:after_changeset) end ensure in_revision!(false) end end # Same as +changeset+ except it also saves the record. def changeset!(&block) changeset do block.call(self) save! end end def without_revisions! return if in_revision? || !block_given? begin no_revision! in_revision! yield save! ensure in_revision!(false) no_revision!(false) end end # acts_as_revisable's override for ActiveRecord::Base's #save! def save!(*args) #:nodoc: self.revisable_new_params ||= args.extract_options! self.no_revision! if self.revisable_new_params.delete :without_revision super end # acts_as_revisable's override for ActiveRecord::Base's #save def save(*args) #:nodoc: self.revisable_new_params ||= args.extract_options! self.no_revision! if self.revisable_new_params.delete :without_revision super(args) end # Set some defaults for a newly created +Revisable+ instance. def before_revisable_create #:nodoc: self[:revisable_is_current] = true self.revision_number ||= 0 end # Checks whether or not a +Revisable+ should be revised. def should_revise? #:nodoc: return false if new_record? return true if force_revision? return false if no_revision? return false unless self.changed? !(self.changed.map(&:downcase) & self.class.revisable_watch_columns).blank? end # Checks whether or not a revision should be stored. # If it should be, it initialized the revision_class # and stores it in an accessor for later saving. def before_revisable_update #:nodoc: return unless should_revise? in_revision! unless run_callbacks(:before_revise) { |r, o| r == false} in_revision!(false) return false end self.revisable_revision = self.to_revision end # Checks if an initialized revision_class has been stored # in the accessor. If it has been, this instance is saved. def after_revisable_update #:nodoc: if no_revision? # check and see if no_revision! was called in a callback self.revisable_revision = nil return true elsif self.revisable_revision self.revisable_revision.save revisions.reload run_callbacks(:after_revise) end in_revision!(false) force_revision!(false) true end # Returns true if the _record_ (not just this instance # of the record) is currently being revised. def in_revision? get_revisable_state(:revision) end # Manages the internal state of a +Revisable+ controlling # whether or not a record is being revised. This works across # instances and is keyed on primary_key. def in_revision!(val=true) #:nodoc: set_revisable_state(:revision, val) end # This returns a new +Revision+ instance with all the appropriate # values initialized. def to_revision #:nodoc: rev = self.class.revision_class.new(self.revisable_new_params) rev.revisable_original_id = self.id new_revision_number = revisions.maximum(:revisable_number) + 1 rescue self.revision_number rev.revision_number = new_revision_number self.revision_number = new_revision_number + 1 self.class.column_names.each do |col| next unless self.class.revisable_should_clone_column? col val = self.send("#{col}_changed?") ? self.send("#{col}_was") : self.send(col) rev.send("#{col}=", val) end self.revisable_new_params = nil rev end # This returns def current_revision self end def for_revision key = self.read_attribute(self.class.primary_key) self.class.revisable_shared_objects[key] ||= {} end def reverting_to for_revision[:reverting_to] end def reverting_to=(val) for_revision[:reverting_to] = val end def reverting_from for_revision[:reverting_from] end def reverting_from=(val) for_revision[:reverting_from] = val end def clear_revisable_shared_objects! key = self.read_attribute(self.class.primary_key) self.class.revisable_shared_objects.delete(key) end module ClassMethods # acts_as_revisable's override for with_scope that allows for # including revisions in the scope. # # ==== Example # # with_scope(:with_revisions => true) do # ... # end def with_scope(*args, &block) #:nodoc: options = (args.grep(Hash).first || {})[:find] if options && options.delete(:with_revisions) with_exclusive_scope do super(*args, &block) end else super(*args, &block) end end # acts_as_revisable's override for find that allows for # including revisions in the find. # # ==== Example # # find(:all, :with_revisions => true) def find(*args) #:nodoc: options = args.grep(Hash).first if options && options.delete(:with_revisions) with_exclusive_scope do super(*args) end else super(*args) end end # Returns the +revision_class_name+ as configured in # +acts_as_revisable+. def revision_class_name #:nodoc: self.revisable_options.revision_class_name || "#{self.name}Revision" end # Returns the actual +Revision+ class based on the # #revision_class_name. def revision_class #:nodoc: self.revisable_revision_class ||= self.revision_class_name.constantize end # Returns the revisable_class which in this case is simply +self+. def revisable_class #:nodoc: self end # Returns the name of the association acts_as_revisable # creates. def revisions_association_name #:nodoc: revision_class_name.pluralize.underscore end # Returns an Array of the columns that are watched for changes. def revisable_watch_columns #:nodoc: return self.revisable_columns unless self.revisable_columns.blank? return self.revisable_columns ||= [] if self.revisable_options.except == :all return self.revisable_columns ||= [self.revisable_options.only].flatten.map(&:to_s).map(&:downcase) unless self.revisable_options.only.blank? except = [self.revisable_options.except].flatten || [] except += REVISABLE_SYSTEM_COLUMNS except += REVISABLE_UNREVISABLE_COLUMNS except.uniq! self.revisable_columns ||= (column_names - except.map(&:to_s)).flatten.map(&:downcase) end end end end end
ruby
MIT
32b7d3d5f198a3ba81a5bba3a94ad04b69d9c1bf
2026-01-04T17:44:21.594614Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/helpers/application_helper.rb
app/helpers/application_helper.rb
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def github_url_for_sha1(sha1) "https://github.com/rails/rails/commit/#{sha1}" end def github_url_for_tag(tag) "https://github.com/rails/rails/tree/#{tag}" end def link_to_commit_in_github(commit) link_to content_tag(:span, commit.short_sha1, class: 'sha1'), github_url_for_sha1(commit.sha1), class: 'commit' end def link_to_release_in_github(release) link_to content_tag(:span, release.tag, class: 'tag'), github_url_for_tag(release.tag), class: 'tag' end def link_to_contributor(contributor) link_to contributor.name, contributor_commits_path(contributor) end def link_to_release(release) link_to release.name, release_contributors_path(release) end def add_window_to(title, time_window) time_window ||= 'all-time' "#{title} - #{TimeConstraints.label_for(time_window)}".html_safe end def sidebar_tab(name, current, options={}, html_options={}) li_options = current ? {class: 'current'} : {} content_tag :li, li_options do link_to name, options, html_options end end def normalize_title(title) title = title.starts_with?('Rails Contributors') ? title : "Rails Contributors - #{title}" strip_tags(title) end def date(timestamp) timestamp.strftime('%d %b %Y') end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/controllers/contributors_controller.rb
app/controllers/contributors_controller.rb
class ContributorsController < ApplicationController caches_page :index, :in_time_window, :in_edge def index @contributors = if params[:release_id].present? set_release Contributor.all_with_ncommits_by_release(@release) else Contributor.all_with_ncommits end end def in_time_window set_time_constraints @contributors = if @since Contributor.all_with_ncommits_by_time_window(@since, @upto) else Contributor.all_with_ncommits end render 'index' end def in_edge @edge = true @contributors = Contributor.all_with_ncommits_in_edge render 'index' end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/controllers/faqs_controller.rb
app/controllers/faqs_controller.rb
class FaqsController < ApplicationController caches_page :show def show end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
class CommitsController < ApplicationController caches_page :index, :in_time_window, :in_release, :in_edge before_action :set_target, only: %w(index in_release) before_action :set_contributor, only: %w(in_edge in_time_window) before_action :set_time_constraints, only: 'in_time_window' def index @commits = @target.commits.sorted end def in_time_window commits = @contributor.commits commits = commits.in_time_window(@since, @upto) if @since @commits = commits.sorted render 'index' end def in_release @commits = @contributor.commits.release(@release).sorted render 'index' end def in_edge @edge = true @commits = @contributor.commits.edge.sorted render 'index' end private def set_target if params[:contributor_id].present? set_contributor end if params[:release_id].present? set_release end @target = @contributor || @release end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/controllers/releases_controller.rb
app/controllers/releases_controller.rb
class ReleasesController < ApplicationController caches_page :index def index @releases = Release.all_with_ncommits_and_ncontributors end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/controllers/application_controller.rb
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base before_action :trace_user_agent private def set_contributor @contributor = Contributor.find_by_param(params[:contributor_id]) head :not_found unless @contributor end def set_release @release = Release.find_by_param(params[:release_id]) head :not_found unless @release end def set_time_constraints @time_window = params[:time_window].presence || 'all-time' if TimeConstraints.valid_time_window?(@time_window) @since, @upto = TimeConstraints.time_window_for(@time_window).values_at(:since, :upto) else head :not_found end end BOTS_REGEXP = %r{ Baidu | Gigabot | Openbot | Google | libwww-perl | lwp-trivial | msnbot | SiteUptime | Slurp | WordPress | ZIBB | ZyBorg | Yahoo | Lycos_Spider | Infoseek | ia_archiver | scoutjet | nutch | nuhk | dts\ agent | twiceler | ask\ jeeves | Webspider | Daumoa | MEGAUPLOAD | Yammybot | yacybot | GingerCrawler | Yandex | Gaisbot | TweetmemeBot | HttpClient | DotBot | 80legs | MLBot | wasitup | ichiro | discobot | bingbot | FAST | MauiBot | yrspider | SemrushBot }xi def trace_user_agent if request.user_agent =~ BOTS_REGEXP logger.info("(BOT) #{request.user_agent}") else logger.info("(BROWSER) #{request.user_agent}") end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/repo_update.rb
app/models/repo_update.rb
class RepoUpdate < ApplicationRecord end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/release.rb
app/models/release.rb
class Release < ApplicationRecord include Comparable has_many :commits, :dependent => :nullify has_many :contributors, :through => :commits scope :sorted, -> { order('releases.major DESC, releases.minor DESC, releases.tiny DESC, releases.patch DESC') } validates :tag, presence: true, uniqueness: true # Computes the commits of every release, imports any of them missing, and # associates them. def self.process_commits(repo, new_releases) new_releases.sort.each do |release| release.process_commits(repo) end end # Imports a rugged object that was returned as a reference to a tag. # # Some tags are full objects (annotated tags), and other tags are kinda # symlinks to commits (lightweight tags). The method understands both. def self.import!(tag, rugged_object) case rugged_object when Rugged::Tag date = rugged_object.tagger[:time] target = rugged_object.target when Rugged::Commit date = rugged_object.author[:time] target = rugged_object end # Some tags, like v1.2.0, do not have their target imported. Ensure the # target of a tag is in the database. unless commit = Commit.find_by_sha1(target.oid) commit = Commit.import!(target) end Release.create!(tag: tag, date: date) end # Releases are ordered by their version, numerically. Note this is not # chronological, since it is customary that stable branches have maintenance # releases in parallel. def <=>(other) (major <=> other.major).nonzero? || (minor <=> other.minor).nonzero? || (tiny <=> other.tiny).nonzero? || (patch <=> other.patch).nonzero? || 0 end # Writes the tag and sets major, minor, tiny, and patch from the new value. def tag=(str) write_attribute(:tag, str) split_version end # Sets the date, correcting it for releases whose Git date we know is wrong. def date=(date) date = actual_date_for_release(date) write_attribute(:date, date) end # The name of a release is the tag name except for the leading "v". def name tag[1..-1] end # Returns the name with dots converted to hyphens. def to_param name.tr('.', '-') end # Encapsulates what needs to be queried given a param. def self.find_by_param(param) find_by_tag('v' + param.tr('-', '.')) end # Computes the commits in this release, imports any of them missing, and # associates them. def process_commits(repo) released_sha1s = repo.rev_list(prev.try(:tag), tag) released_sha1s.each_slice(1024) do |sha1s| import_missing_commits(repo, sha1s) associate_commits(sha1s) end end # About a thousand of commits from the Subversion times are not reachable # from branch tips, which is what the main importer walks back. When a # release is detected we make sure the commits reported by rev-list are # present in the database. def import_missing_commits(repo, released_sha1s) existing_sha1s = Commit.where(sha1: released_sha1s).pluck(:sha1) (released_sha1s - existing_sha1s).each do |sha1| logger.debug("importing #{sha1} for #{tag}") Commit.import!(repo.repo.lookup(sha1)) end end # Associate the given SHA1s to this release, assuming they exist in the # commits table. def associate_commits(sha1s) # We force release_id to be NULL because rev-list in svn yields some # repeated commits in several releases. Commit.where(sha1: sha1s, release_id: nil).update_all(release_id: id) end # Computes the previous release as of today from the database. The previous # release may change with time. For example, the previous release of 3.2.0 # may be 3.1.5 one day, and 3.1.6 if it gets later released. def prev Release.where(<<-SQL).sorted.first (major = #{major} AND minor = #{minor} AND tiny = #{tiny} AND patch < #{patch}) OR (major = #{major} AND minor = #{minor} AND tiny < #{tiny}) OR (major = #{major} AND minor < #{minor}) OR (major < #{major}) SQL end # Returns all releases, ordered by version, with virtual attributes ncommits # and ncontributors. def self.all_with_ncommits_and_ncontributors # Outer joins, because 2.0.1 according to git rev-list v2.0.0..v2.0.1 was a # release with no commits. select(<<-SELECT).joins(<<-JOINS).group('releases.id').sorted.to_a releases.*, COUNT(DISTINCT(commits.id)) AS ncommits, COUNT(DISTINCT(contributions.contributor_id)) AS ncontributors SELECT LEFT OUTER JOIN commits ON commits.release_id = releases.id LEFT OUTER JOIN contributions ON commits.id = contributions.commit_id JOINS end # Returns the URL of this commit in GitHub. def github_url "https://github.com/rails/rails/tree/#{tag}" end private def split_version numbers = name.split('.') self.major = numbers[0].to_i self.minor = numbers[1].to_i self.tiny = numbers[2].to_i self.patch = numbers[3].to_i end # Releases coming from Subversion were tagged in 2008 when the repo was # imported into git. I have scrapped # # http://rubyforge.org/frs/?group_id=307 # # to generate this case statement. def actual_date_for_release(date) case tag when 'v0.5.0' DateTime.new(2004, 7, 24) when 'v0.5.5' DateTime.new(2004, 7, 28) when 'v0.5.6' DateTime.new(2004, 7, 29) when 'v0.5.7' DateTime.new(2004, 8, 1) when 'v0.6.0' DateTime.new(2004, 8, 6) when 'v0.6.5' DateTime.new(2004, 8, 20) when 'v0.7.0' DateTime.new(2004, 9, 5) when 'v0.8.0' DateTime.new(2004, 10, 25) when 'v0.8.5' DateTime.new(2004, 11, 17) when 'v0.9.0' DateTime.new(2004, 12, 16) when 'v0.9.1' DateTime.new(2004, 12, 17) when 'v0.9.2' DateTime.new(2004, 12, 23) when 'v0.9.3' DateTime.new(2005, 1, 4) when 'v0.9.4' DateTime.new(2005, 1, 17) when 'v0.9.4.1' DateTime.new(2005, 1, 18) when 'v0.9.5' DateTime.new(2005, 1, 25) when 'v0.10.0' DateTime.new(2005, 2, 24) when 'v0.10.1' DateTime.new(2005, 3, 7) when 'v0.11.0' DateTime.new(2005, 3, 22) when 'v0.11.1' DateTime.new(2005, 3, 27) when 'v0.12.0' DateTime.new(2005, 4, 19) when 'v0.12.1' DateTime.new(2005, 4, 19) when 'v0.13.0' DateTime.new(2005, 7, 6) when 'v0.13.1' DateTime.new(2005, 7, 11) when 'v0.14.1' DateTime.new(2005, 10, 19) when 'v0.14.2' DateTime.new(2005, 10, 26) when 'v0.14.3' DateTime.new(2005, 11, 7) when 'v0.14.4' DateTime.new(2005, 12, 8) when 'v1.0.0' DateTime.new(2005, 12, 13) when 'v1.1.0' DateTime.new(2006, 3, 28) when 'v1.1.1' DateTime.new(2006, 4, 6) when 'v1.1.2' DateTime.new(2006, 4, 9) when 'v1.1.3' DateTime.new(2006, 6, 27) when 'v1.1.4' DateTime.new(2006, 6, 29) when 'v1.1.5' DateTime.new(2006, 8, 8) when 'v1.1.6' DateTime.new(2006, 8, 10) when 'v1.2.0' DateTime.new(2007, 1, 18) when 'v1.2.1' DateTime.new(2007, 1, 18) when 'v1.2.2' DateTime.new(2007, 2, 6) when 'v1.2.3' DateTime.new(2007, 3, 13) when 'v1.2.4' DateTime.new(2007, 10, 4) when 'v1.2.5' DateTime.new(2007, 10, 12) when 'v1.2.6' DateTime.new(2007, 11, 24) when 'v2.0.0' DateTime.new(2007, 12, 6) when 'v2.0.1' DateTime.new(2007, 12, 7) when 'v2.0.2' DateTime.new(2007, 12, 16) when 'v2.0.4' DateTime.new(2008, 9, 4) when 'v2.1.0' DateTime.new(2008, 5, 31) else date end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/contribution.rb
app/models/contribution.rb
class Contribution < ApplicationRecord belongs_to :contributor belongs_to :commit end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/contributor.rb
app/models/contributor.rb
class Contributor < ApplicationRecord has_many :contributions, dependent: :destroy has_many :commits, through: :contributions validates :name, presence: true, uniqueness: true validates :url_id, presence: true, uniqueness: true nfc :name scope :with_no_commits, -> { left_joins(:contributions).where(contributions: { commit_id: nil }) } def self.all_with_ncommits _all_with_ncommits(:contributions) end def self.all_with_ncommits_by_time_window(since, upto) if upto _all_with_ncommits(:commits, ['commits.committer_date BETWEEN ? AND ?', since, upto]) else _all_with_ncommits(:commits, ['commits.committer_date >= ?', since]) end end def self.all_with_ncommits_by_release(release) _all_with_ncommits(:commits, 'commits.release_id' => release.id) end def self.all_with_ncommits_in_edge _all_with_ncommits(:commits, 'commits.release_id' => nil) end def self._all_with_ncommits(joins, where=nil) select('contributors.*, COUNT(*) AS ncommits'). joins(joins). where(where). group('contributors.id'). order('ncommits DESC, contributors.url_id ASC') end def self.set_first_contribution_timestamps(only_new) scope = only_new ? 'first_contribution_at IS NULL' : '1 = 1' connection.execute(<<-SQL) UPDATE contributors SET first_contribution_at = first_contributions.committer_date FROM ( SELECT contributor_id, MIN(commits.committer_date) AS committer_date FROM contributions INNER JOIN commits ON commits.id = commit_id GROUP BY contributor_id ) AS first_contributions WHERE id = first_contributions.contributor_id AND #{scope} SQL end # The contributors table may change if new name equivalences are added and IDs # in particular are expected to move. So, we just put the parameterized name # in URLs, which is unique anyway. def to_param url_id end def self.find_by_param(param) find_by_url_id(param) end def name=(name) super set_url_id end private def set_url_id self.url_id = name.parameterize end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/time_constraints.rb
app/models/time_constraints.rb
module TimeConstraints ALL = { 'all-time' => 'All time', 'today' => 'Today', 'this-week' => 'This week', 'this-month' => 'This month', 'this-year' => 'This year', } DATE_RANGE = /\A(\d+)(?:-(\d+))?\z/ def self.all ALL end def self.label_for(key) ALL[key] || 'Date Range' end def self.valid_time_window?(key) ALL[key] || key =~ DATE_RANGE end # These date objects have to be computed per call, they can't be associated # to the keys. def self.time_window_for(key) case key when 'all-time' {} when 'today' { since: Date.current.beginning_of_day } when 'this-week' { since: Date.current.beginning_of_week } when 'this-month' { since: Date.current.beginning_of_month } when 'this-year' { since: Date.current.beginning_of_year } when DATE_RANGE { since: parse_time($1, false), upto: parse_time($2, true) } else raise ArgumentError, "Unknown time window key #{key}" end end def self.parse_time(str, end_of_day_if_date) if str time = Time.zone.parse(str) str.length == 8 && end_of_day_if_date ? time.end_of_day : time end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/application_record.rb
app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/names_manager.rb
app/models/names_manager.rb
require 'set' module NamesManager extend HardCodedAuthors extend FalsePositives extend CanonicalNames # Determines whether any heuristic has been updated since +ts+. def self.updated_since?(ts) [__FILE__, *Dir.glob("#{__dir__}/names_manager/*.rb")].any? do |filename| File.mtime(filename) > ts end end # Removes email addresses (anything between <...>), and strips whitespace. def self.sanitize(name) name.sub(/<[^>]+>/, '').strip end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/repo.rb
app/models/repo.rb
require 'application_utils' class Repo attr_reader :logger, :path, :heads, :tags, :repo, :rebuild_all # Clone with --mirror: # # git clone --mirror git://github.com/rails/rails.git # PATH = "#{Rails.root}/rails.git" HEADS = %r{\Arefs/heads/(main|[\d\-]+(-stable)?)\z} TAGS = %r{\Arefs/tags/v[\d.]+\z} # This is the entry point to sync the database from cron jobs etc: # # bundle exec rails runner Repo.sync # # is the intended usage. This fetches new stuff, imports new commits if any, # imports new releases if any, assigns contributors and updates ranks. # # If the names manager has been updated since the previous execution special # code detects names that are gone and recomputes the contributors for their # commits. This can be forced by passing rebuild_all: true. def self.sync(path: PATH, heads: HEADS, tags: TAGS, rebuild_all: false) new(path: path, heads: heads, tags: tags, rebuild_all: rebuild_all).sync end def initialize(path: PATH, heads: HEADS, tags: TAGS, rebuild_all: false) @logger = Rails.logger @path = path @heads = heads @tags = tags @rebuild_all = rebuild_all || names_mapping_updated? @repo = Rugged::Repository.new(path) end # Executes a git command, optionally capturing its output. # # If the execution is not successful +StandardError+ is raised. def git(args, capture=false) cmd = "git #{args}" logger.info(cmd) Dir.chdir(path) do if capture out = `#{cmd}` return out if $?.success? raise "git error: #{$?}" else system(cmd) or raise "git error: #{$?}" end end end # Issues a git fetch. def fetch git 'fetch --quiet --prune' end # Returns the patch of the given commit. def diff(sha1) git "diff --no-color #{sha1}^!", true end # Returns the commits between +from+ and +to+. That is, that a reachable from # +to+, but not from +from+. # # We use this method to determine which commits belong to a release. def rev_list(from, to) arg = from ? "#{from}..#{to}" : to lines = git "rev-list #{arg}", true lines.split("\n") end # This method does the actual work behind Repo.sync. def sync ApplicationUtils.acquiring_lock_file('updating') do started_at = Time.current fetch ActiveRecord::Base.transaction do ncommits = sync_commits nreleases = sync_releases if ncommits > 0 || nreleases > 0 || rebuild_all sync_names sync_ranks sync_first_contribution_timestamps end RepoUpdate.create!( ncommits: ncommits, nreleases: nreleases, started_at: started_at, ended_at: Time.current, rebuild_all: rebuild_all ) ApplicationUtils.expire_cache if cache_needs_expiration?(ncommits, nreleases) end end end protected def refs(regexp) repo.refs.select do |ref| ref.name =~ regexp end end # Imports those commits in the Git repo that do not yet exist in the database # by walking the main and stable branches backwards starting at the tips # and following parents. def sync_commits ncommits = 0 ActiveRecord::Base.logger.silence do refs(heads).each do |ref| to_visit = [repo.lookup(ref.target.oid)] while commit = to_visit.shift unless Commit.exists?(sha1: commit.oid) ncommits += 1 Commit.import!(commit) to_visit.concat(commit.parents) end end end end ncommits end # Imports new releases, if any, determines which commits belong to them, and # associates them. By definition, a release corresponds to a stable tag, one # that matches <tt>\Av[\d.]+\z</tt>. def sync_releases new_releases = [] refs(tags).each do |ref| tag = ref.name[%r{[^/]+\z}] unless Release.exists?(tag: tag) target = ref.target commit = target.is_a?(Rugged::Commit) ? target : target.target new_releases << Release.import!(tag, commit) end end Release.process_commits(self, new_releases) new_releases.size end # Computes the name of the contributors and adjusts associations and the # names table. If some names are gone due to new mappings collapsing two # names into one, for example, the credit for commits of gone names is # revised, resulting in the canonical name being associated. def sync_names Contribution.delete_all if rebuild_all assign_contributors Contributor.with_no_commits.delete_all if rebuild_all end # Once all tables have been updated we compute the rank of each contributor. def sync_ranks i = 0 prev_ncommits = nil new_rank = 0 ranks_to_update = Hash.new {|h, k| h[k] = []} # Compute new ranks, and store those which need to be updated. Contributor.all_with_ncommits.each do |contributor| i += 1 if contributor.ncommits != prev_ncommits new_rank = i prev_ncommits = contributor.ncommits end if contributor.rank != new_rank ranks_to_update[new_rank] << contributor.id end end # Update new ranks, if any. ranks_to_update.each do |rank, contributor_ids| Contributor.where(id: contributor_ids).update_all("rank = #{rank}") end end def sync_first_contribution_timestamps Contributor.set_first_contribution_timestamps(!rebuild_all) end # Determines whether the names mapping has been updated. This is useful because # if the names mapping is up to date we only need to assign contributors for # new commits. def names_mapping_updated? @nmu ||= begin lastru = RepoUpdate.last # Use started_at in case a revised names manager is deployed while an update # is running. lastru ? NamesManager.updated_since?(lastru.started_at) : true end end # Goes over all or new commits in the database and builds a hash that maps # each sha1 to the array of the canonical names of their contributors. # # This computation ignores the current contributions table altogether, it # only takes into account the current mapping rules for name resolution. def compute_contributor_names_per_commit Hash.new {|h, sha1| h[sha1] = []}.tap do |contributor_names_per_commit| Commit.with_no_contributors.find_each do |commit| commit.extract_contributor_names(self).each do |contributor_name| contributor_names_per_commit[commit.sha1] << contributor_name end end end end # Iterates over all commits with no contributors and assigns to them the ones # in the previously computed <tt>contributor_names_per_commit</tt>. def assign_contributors contributor_names_per_commit = compute_contributor_names_per_commit contributors = Hash.new {|h, name| h[name] = Contributor.find_or_create_by(name: name)} data = [] Commit.with_no_contributors.find_each do |commit| contributor_names_per_commit[commit.sha1].each do |contributor_name| # FIXME: This check is needed because creation in a few exceptional # cases fails due to url_id collisions (Geoffrey ROGUELON, Adam), or # due blank url_ids (प्रथमेश). if contributors[contributor_name].id data << "#{contributors[contributor_name].id},#{commit.id}\n" end end end conn = ActiveRecord::Base.connection.raw_connection conn.copy_data('COPY contributions (contributor_id, commit_id) FROM STDIN CSV') do data.each do |row| conn.put_copy_data(row) end end end # Do we need to expire the cached pages? def cache_needs_expiration?(ncommits, nreleases) ncommits > 0 || nreleases > 0 || rebuild_all end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/commit.rb
app/models/commit.rb
# frozen-string-literal: true class Commit < ApplicationRecord has_many :contributions, dependent: :destroy has_many :contributors, through: :contributions belongs_to :release, optional: true scope :with_no_contributors, -> { select('commits.*'). # otherwise we get read-only records left_joins(:contributions). where(contributions: { commit_id: nil }) } scope :in_time_window, ->(since, upto) { if upto where(committer_date: since..upto) else where('commits.committer_date >= ?', since) end } scope :release, ->(release) { where(release_id: release.id) } scope :edge, -> { where(release_id: nil) } scope :sorted, -> { order(committer_date: :desc) } validates :sha1, presence: true, uniqueness: true nfc :author_name, :committer_name, :message, :diff # Constructor that initializes the object from a Rugged commit. def self.import!(rugged_commit) commit = new_from_rugged_commit(rugged_commit) commit.save! commit end def self.new_from_rugged_commit(rugged_commit) new( sha1: rugged_commit.oid, author_name: rugged_commit.author[:name].force_encoding('UTF-8'), author_email: rugged_commit.author[:email].force_encoding('UTF-8'), author_date: rugged_commit.author[:time], committer_name: rugged_commit.committer[:name].force_encoding('UTF-8'), committer_email: rugged_commit.committer[:email].force_encoding('UTF-8'), committer_date: rugged_commit.committer[:time], message: rugged_commit.message.force_encoding('UTF-8'), merge: rugged_commit.parents.size > 1 ) end # Returns a shortened sha1 for this commit. Length is 7 by default. def short_sha1(length=7) sha1[0, length] end # Returns the URL of this commit in GitHub. def github_url "https://github.com/rails/rails/commit/#{sha1}" end def short_message @short_message ||= message ? message.split("\n").first : nil end # Returns the list of canonical contributor names of this commit. def extract_contributor_names(repo) names = extract_candidates(repo) names = canonicalize(names) names.uniq end protected def imported_from_svn? message.include?('git-svn-id: http://svn-commit.rubyonrails.org/rails') end # Both svn and git may have the name of the author in the message using the [...] # convention. If none is found we check the changelog entry for svn commits. # If that fails as well the contributor is the git author by definition. def extract_candidates(repo) names = hard_coded_authors if names.nil? names = extract_contributor_names_from_message if names.empty? names = extract_svn_contributor_names_diffing(repo) if imported_from_svn? if names.empty? sanitized = sanitize([author_name]) names = handle_false_positives(sanitized) if names.empty? # This is an edge case, some rare commits have an empty author name. names = sanitized end end end end # In modern times we are counting merge commits, because behind a merge # commit there is work by the core team member in the pull request. To # be fair, we are going to do what would be analogous for commits in # Subversion, where each commit has to be considered a merge commit. # # Note we do a uniq later in case normalization yields a clash. if imported_from_svn? && !names.include?(author_name) names << author_name end names.map(&:nfc) end def hard_coded_authors NamesManager.hard_coded_authors(self) end def sanitize(names) names.map {|name| NamesManager.sanitize(name)} end def handle_false_positives(names) names.map {|name| NamesManager.handle_false_positives(name)}.flatten.compact end def canonicalize(names) names.map {|name| NamesManager.canonical_name_for(name, author_email)}.flatten end def extract_contributor_names_from_message subject, body = message.split("\n\n", 2) # Check the end of subject first. contributor_names = extract_contributor_names_from_text(subject) return contributor_names if contributor_names.any? return [] if body.nil? # Some modern commits have an isolated body line with the credit. body.scan(/^\[[^\]]+\]$/) do |match| contributor_names = extract_contributor_names_from_text(match) return contributor_names if contributor_names.any? end # See https://help.github.com/en/articles/creating-a-commit-with-multiple-authors. co_authors = body.scan(/^Co-authored-by:(.*)$/i) return sanitize([author_name] + co_authors.flatten) if co_authors.any? # Check the end of the body as last option. if imported_from_svn? return extract_contributor_names_from_text(body.sub(/git-svn-id:.*/m, '')) end [] end # When Rails had a svn repo there was a convention for authors: the committer # put their name between brackets at the end of the commit or changelog message. # For example: # # Fix case-sensitive validates_uniqueness_of. Closes #11366 [miloops] # # Sometimes there's a "Closes #tiquet" after it, as in: # # Correct documentation for dom_id [jbarnette] Closes #10775 # Models with no attributes should just have empty hash fixtures [Sam] (Closes #3563) # # Of course this is not robust, but it is the best we can get. def extract_contributor_names_from_text(text) names = text =~ /\[([^\]]+)\](?:\s+\(?Closes\s+#\d+\)?)?\s*\z/ ? [$1] : [] names = sanitize(names) handle_false_positives(names) end # Looks for contributor names in changelogs. There are +1600 commits with credit here. def extract_svn_contributor_names_diffing(repo) cache_diff(repo) unless diff return [] if only_modifies_changelogs? extract_changelog.split("\n").map do |line| extract_contributor_names_from_text(line) end.flatten rescue # There are 10 diffs that have invalid UTF-8 and we get an exception, just # ignore them. See f0753992ab8cc9bbbf9b047fdc56f8899df5635e for example. update_column(:diff, $!.message) [] end def cache_diff(repo) update(diff: repo.diff(sha1).force_encoding('UTF-8')) end # Extracts any changelog entry for this commit. This is done by diffing with # git show, and is an expensive operation. So, we do this only for those # commits where this is needed, and cache the result in the database. def extract_changelog changelog = +'' in_changelog = false diff.each_line do |line| if line =~ /^diff --git/ in_changelog = false elsif line =~ /^\+\+\+.*changelog$/i in_changelog = true elsif in_changelog && line =~ /^\+\s*\*/ changelog << line end end changelog end # Some commits only touch CHANGELOGs, for example # # https://github.com/rails/rails/commit/f18356edb728522fcd3b6a00f11b29fd3bff0577 # # Note we need this only for commits coming from Subversion, where # CHANGELOGs had no extension. def only_modifies_changelogs? diff.scan(/^diff --git(.*)$/) do |fname| return false unless fname.first.strip.ends_with?('CHANGELOG') end true end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/names_manager/false_positives.rb
app/models/names_manager/false_positives.rb
module NamesManager module FalsePositives CONNECTORS_REGEXP = %r{(?:[,/&+]|\band\b)} # Returns +nil+ if +name+ is known *not* to correspond to an author, the # author name(s) if special handling applies, like multiple authors separated # by a connector. If nothing applies, returns +name+ back. # # Note that this method is responsible for extracting names as they appear # in the original string. Canonicalization is done elsewhere. def handle_false_positives(name) case name when /\A\d+\b/ when /#\d+/ when /GH-\d+/ when /\A\s*\z/ when /RAILS_ENV/ when /^See rails ML/ when /RubyConf/ when 'update from Trac' when /\A['":]/ when 'RC1' when %r{https://} when '\\x00-\\x1f' when /\ACVE-[\d-]+\z/i when 'and' when 'options' when 'API DOCS' when 'hat-tip to anathematic' when 'props to Zarathu in #rubyonrails' when 'thanks Pratik!' when 'multiple=true' when /ci[\s_-]s?kip/i when 'ci skp' when 'ci ski' when /skip[ -]ci/i when 'key' when '.lock' when "{ :ca => :'es-ES' }" when 'fixes 5f5e6d924973003c105feb711cefdb726f312768' when '79990505e5080804b53d81fec059136afa2237d7' when 'direct_upload_xls_in_chrome' when "schoenm\100earthlink.net sandra.metz\100duke.edu" name.split when '=?utf-8?q?Adam=20Cig=C3=A1nek?=' 'Adam Cigánek'.nfc when '=?utf-8?q?Mislav=20Marohni=C4=87?=' 'Mislav Marohnić'.nfc when 'nik.wakelin Koz' ['nik.wakelin', 'Koz'] when "me\100jonnii.com rails\100jeffcole.net Marcel Molina Jr." ["me\100jonnii.com", "rails\100jeffcole.net", 'Marcel Molina Jr.'] when "jeremy\100planetargon.com Marcel Molina Jr." ["jeremy\100planetargon.com", 'Marcel Molina Jr.'] when "matt\100mattmargolis.net Marcel Molina Jr." ["matt\100mattmargolis.net", 'Marcel Molina Jr.'] when "doppler\100gmail.com phil.ross\100gmail.com" ["doppler\100gmail.com", "phil.ross\100gmail.com"] when 'After much pestering from Dave Thomas' 'Dave Thomas' when "jon\100blankpad.net)" ["jon\100blankpad.net"] when 'Jose and Yehuda' ['José Valim'.nfc, 'Yehuda Katz'] when /\A(?:Suggested|Aggregated)\s+by\s+(.*)/i $1 when /\A(?:DHH\s*)?via\s+(.*)/i $1 # These are present in some of Ben Sheldon commits. This pattern needs # ad-hoc handling because "/" is considered to be a name connector. when %r{\[he/him\]} $`.strip when /\b\w+\+\w+@/ # The plus sign is taken to be a connector below, this catches some known # addresses that use a plus sign in the username, see unit tests for examples. # We know there's no case where the plus sign acts as well as a connector in # the same string. name.split(/\s*,\s*/).map(&:strip) when CONNECTORS_REGEXP # There are lots of these, even with a combination of connectors. name.split(CONNECTORS_REGEXP).map(&:strip).reject do |part| part == 'others' || part == '?' end else # just return the candidate back name end end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/names_manager/canonical_names.rb
app/models/names_manager/canonical_names.rb
module NamesManager module CanonicalNames # Returns the canonical name for +name+. # # Email addresses are removed, leading/trailing whitespace and # surrounding Markdown *s are deleted. If no equivalence is known # the canonical name is the resulting sanitized string by definition. def canonical_name_for(name, email) name = name.sub(/<[^>]+>/, '') # remove any email address in angles name.strip! # Commit 28d52c59f2cb32180ca24770bf95597ea3ad8198 for example uses # Markdown in the commit message: [*Godfrey Chan*, *Aaron Patterson*]. # This is really exceptional so we special-case this instead of doing # anything more generic. name.sub!(/\A\*/, '') name.sub!(/\*\z/, '') disambiguate(name, email) || multialias(name) || CANONICAL_NAME_FOR[name] || name end private def disambiguate(name, email) case name when 'abhishek' case email when 'abhishek.jain@vinsol.com' then 'Abhishek Jain' when 'bigbeliever@gmail.com' then 'Abhishek Yadav' end when 'Adam' case email when 'Adam89@users.noreply.github.com' then 'Adam Magan' when 'kohnkecomm@Adam-iMac.local' then 'kohnkecomm' end when 'Alexander' case email when "avabonec\100gmail.com", "abonec\100gmail.com" then 'Alexander Baronec' when "alxndr+github\100gmail.com" then 'Alexander Quine' when "dembskoi\100gmail.com" then 'Dembskiy Alexander' end when 'Akshay' case email when "akshaymohite31\100yahoo.com" then 'Akshay Mohite' end when 'Sam' case email when "sam.saffron\100gmail.com" then 'Sam Saffron' end when 'James' case email when "james.bowles\100abletech.co.nz" then 'James Bowles' end when 'root' case email when "mohamed.o.alnagdy\100gmail.com" then 'Mohamed Osama' end when 'unknown' case email when "agrimm\100.(none)" then 'Andrew Grimm' when "jeko1\100.npfit.nhs.uk" then 'Jens Kolind' when "Manish Puri\100NYO000011657014.ads.mckinsey.com" then 'Manish Puri' end when 'David' case email when "david\100loudthinking.com" then 'David Heinemeier Hansson' when "DevilDavidWang\100gmail.com" then 'David Wang' end when 'Dan' case email when "dan.burnette\100watershed5.com" then 'Daniel Burnette' end when 'Drew' case email when 'dbragg@within3.com' then 'Drew Bragg' end when 'Jan' case email when "jan\100habermann24.com" then 'Jan Habermann' when "jan.h.xie\100gmail.com" then 'Jan Xie' end when 'Mark' case email when "mark\100rakino.(none)" then 'MarkMT' when "markchav3z\100gmail.com" then 'mrkjlchvz' end when 'Jonathan' case email when "greenbigfrog\100gmail.com" then 'greenbigfrog' end when 'Jack' case email when "aquajach\100gmail.com" then 'aquajach' end when 'Josh' case email when "shup_d\100cube.(none)" then 'Josh Peek' when "jdeseno\100gmail.com" then 'Josh Deseno' when "josh\100josh.mn" then 'Josh Brody' end when '' case email when "JRadosz\100gmail.com" then 'Jarek Radosz' end end end def multialias(name) case name when 'Carlhuda' ['Yehuda Katz', 'Carl Lerche'] when 'tomhuda' ['Yehuda Katz', 'Tom Dale'] end end # canonical name => handlers, emails, typos, etc. SEEN_ALSO_AS = {} def self.map(canonical_name, *also_as) SEEN_ALSO_AS[canonical_name.nfc] = also_as.map(&:nfc) end # Some people appear in Rails logs under different names, there are nicks, # typos, email addresses, shortenings, etc. This is a hand-made list to map # them in order to be able to aggregate commits from the same real author. # # This mapping does not use regexps on purpose, it is more robust to put the # exact string equivalences. The manager has to be very strict about this. map 'Aaron Eisenberger', 'Aaron' map 'Aaron Gray', 'aarongray' map 'Aaron Namba', 'anamba' map 'Aaron Pfeifer', 'obrie' map 'Aaron Todd', 'ozzyaaron' map 'Abhay Kumar', 'abhay' map 'Abhishek Yadav', 'abhishek' map 'Adam Hawkins', 'twinturbo', 'adman65' map 'Adam Johnson', 'adamj' map 'Adam Kramer', "adam\100the-kramers.net" map 'Adam Magan', 'Adam89', 'mrageh' map 'Adam Majer', "adamm\100galacticasoftware.com" map 'Adam Wiggins', 'adamwiggins' map 'Adam Williams', 'aiwilliams', 'awilliams' map 'Adelle Hartley', "adelle\100bullet.net.au" map 'Aditya Chadha', 'Aditya' map 'Aditya Kapoor', 'aditya-kapoor' map 'Adrian Marin', 'Adrian' map 'Adrien Coquio', 'bobbus' map 'Adrien Siami', 'Intrepidd' map 'Agis Anastasopoulos', 'Agis-' map 'Akhil G Krishnan', 'akhilgkrishnan' map 'Akio Tajima', 'arton', 'artonx' map 'Akira Ikeda', "ikeda\100dream.big.or.jp" map 'Akira Matsuda', '松田 明' map 'Akira Tagoh', 'tagoh' map 'Akshay Gupta', 'kitallis' map 'Akshay Vishnoi', 'Mr A' map 'Alan Francis', 'alancfrancis', 'acf',"alancfrancis\100gmail.com" map 'Albert Lash', 'docunext' map 'Alberto Almagro', 'Alberto Almagro Sotelo' map 'Alex Chaffee', 'alexch' map 'Alex Mishyn', 'amishyn' map 'Alex Pooley', "alex\100msgpad.com" map 'Alex Riabov', 'ariabov' map 'Alex Wayne', "rubyonrails\100beautifulpixel.com", 'Squeegy' map 'Alex Wolfe', "alexkwolfe\100gmail.com" map 'Alexander Baronec', 'abonec' map 'Alexander Belaev', 'alexbel' map 'Alexander Borovsky', "alex.borovsky\100gmail.com" map 'Alexander Dymo', 'adymo', "dymo\100mk.ukrtelecom.ua" map 'Alexander Karmes', '90yukke' map 'Alexander Staubo', "alex\100purefiction.net", "alex\100byzantine.no" map 'Alexander Uvarov', 'wildchild' map 'Alexey Nikitin', 'tank-bohr' map 'Alexey Trofimenko', 'codesnik' map 'Alexey Zatsepin', 'alexey', 'Alexey' map 'Ali Ibrahim', 'alimi' map 'Aliaksey Kandratsenka', 'Aleksey Kondratenko' map 'Aliaxandr Rahalevich', 'saksmlz', 'saks' map 'Alessandra Pereyra', 'Xenda' map 'Alkesh Ghorpade', 'alkesh26', 'alkeshghorpade' map 'Amit Kumar Suroliya', 'amitkumarsuroliya' map 'Anand Muthukrishnan', 'Anand' map 'Anatoli Makarevich', 'Anatoly Makarevich' map 'Andrea Longhi', 'andrea longhi', 'spaghetticode' map 'Andreas Isaksson', 'isak' map 'Andreas Wurm', 'Kanetontli', 'Kane', 'kane' map 'Andrew A. Smith', "andy\100tinnedfruit.org" map 'Andrew Bennett', 'PotatoSalad' map 'Andrew Chase', 'acechase', 'Andrew' map 'Andrew Evans', 'agius' map 'Andrew Grim', 'stopdropandrew' map 'Andrew Kaspick', "akaspick\100gmail.com", 'akaspick', "andrew\100redlinesoftware.com" map 'Andrew Novoselac', "andrew.novoselac\100shopify.com" map 'Andrew Peters', "andrew.john.peters\100gmail.com" map 'Andrew Shcheglov', 'windock' map 'Andrew White', 'pixeltrix' map 'Andrey Molchanov', 'Neodelf', 'Molchanov Andrey' map 'Andrey Morskov', 'accessd', 'Accessd' map 'Andrey Nering', "andrey.nering\100gmail.com" map 'Andy Lien', "andylien\100gmail.com" map 'Angelo Capilleri', 'angelo giovanni capilleri', 'Angelo capilleri', 'acapilleri' map 'Anil Kumar Maurya', 'anilmaurya' map 'Ankit Bansal', 'ankit1910' map 'Ankit Gupta', 'ankit8898', 'Ankit Gupta-FIR', 'Ankit gupta' map 'Anna Ershova', 'AnnaErshova' map 'Ant Ramm', 'antramm' map 'Anthony Alberto', 'Anthony' map 'Anthony Eden', 'aeden' map 'Anthony Navarre', 'anthonynavarre' map 'Anton Cherepanov', 'davetoxa' map 'Antonio Tapiador del Dujo', 'Antonio Tapiador' map 'Anuj Dutta', 'anuj dutta' map 'Anup Narkhede', 'railsbob' map 'Ara T Howard', 'ara.t.howard' map 'Ariejan de Vroom', 'ariejan' map 'Arkadiusz Holko', 'fastred' map 'Arkadiy Zabazhanov', 'pyromaniac' map 'Artem Avetisyan', 'artemave' map 'Artem Kramarenko', 'artemk' map 'Arthur Neves', 'Arthur Nogueira Neves' map 'Arthur Zapparoli', 'arthurgeek' map 'Arvid Andersson', 'arvida' map 'Arvind Mehra', 'arvind' map 'Asherah Connor', 'Ashe Connor' map 'Ashley Moran', "work\100ashleymoran.me.uk" map 'Ask Bjørn Hansen', "ask\100develooper.com" map 'Assaf Arkin', "assaf.arkin\100gmail.com", 'Assaf' map 'AthonLab', 'athonlab' map 'Atsushi Nakamura', 'alfa-jpn' map 'August Zaitzow Flatby', "zaitzow\100gmail.com" map 'August Zajonc', "augustz\100augustz.com" map 'Avner Cohen', 'AvnerCohen' map 'Ayose Cazorla', 'Ayose' map 'Bagwan Pankaj', 'bagwanpankaj' map 'Bas van Klinkenberg', "flash\100vanklinkenbergsoftware.nl", 'Bas Van Klinkenberg' map 'Bart de Water', 'Bart' map 'Ben A. Morgan', 'Ben A Morgan' map 'Ben Bangert', "ben\100groovie.org" map 'Ben Holley', 'benolee' map 'Ben Murphy', 'benmmurphy' map 'Ben Sandofsky', 'sandofsky' map 'Ben Scofield', 'bscofield' map 'Ben Sinclair', "ben\100bensinclair.com" map 'Benedikt Deicke', 'benedikt' map 'Benjamin Curtis', "rails\100bencurtis.com" map 'Benny Klotz', 'Benjamin Klotz' map 'Bermi Ferrer', 'bermi' map 'Bert Goethals', 'BertG' map 'Blaine Cook', 'Blaine', 'blaine', "blaine\100odeo.com" map 'Blair Zajac', "blair\100orcaware.com" map 'Blake Watters', "blake\100near-time.com" map 'Blane Dabney', "mdabney\100cavoksolutions.com" map 'Bob Aman', "bob\100sporkmonger.com" map 'Bob Silva', 'BobSilva', "ruby\100bobsilva.com" map 'bogdanvlviv', 'Bogdan' map 'Brad Ediger', "brad.ediger\100madriska.com", "brad\100madriska.com", 'bradediger' map 'Brad Ellis', "bellis\100deepthought.org" map 'Brad Greenlee', 'bgreenlee' map 'Bogdan Gusiev', 'bogdan' map 'Brad Robertson', 'bradrobertson' map 'Brandon Keepers', 'brandon', "brandon\100opensoul.org" map 'Brandt Kurowski', "brandt\100kurowski.net" map 'Brendan Baldwin', 'brendan' map 'Brent Miller', 'Foliosus' map 'Brian Donovan', 'eventualbuddha', "devslashnull\100gmail.com" map 'Brian Egge', "brianegge\100yahoo.com" map 'Brian Gernhardt', "benji\100silverinsanity.com" map 'Brian Mattern', "rephorm\100rephorm.com" map 'Brian Morearty', 'BMorearty' map 'Brian Pearce', 'brianp' map 'Bruce Williams', "wbruce\100gmail.com" map 'Bruno Miranda', 'brupm' map 'Bryan Helmkamp', 'brynary' map 'Bryan Kang', 'deepblue' map 'Buddhika Laknath', 'laknath', 'Laknath' map 'Caio Chassot', 'caio', "k\100v2studio.com" map 'Caleb Buxton', 'Caleb' map 'Caleb Tennis', "caleb\100aei-tech.com" map 'Caleb Hearth', 'Caleb Thompson' map 'Calvin Yu', 'cyu' map 'Carina C. Zona', 'cczona' map 'Carl Tashian', 'tashian' map 'Cássio Marques', 'CassioMarques' map 'Cédric Fabianski', 'Cédric FABIANSKI', 'cfabianski' map 'Celestino Gomes', 'tinogomes' map 'Cesar Ho', 'codafoo' map 'Chad Humphries', 'spicycode' map 'Chad Ingram', 'matrix9180' map 'Chad Pytel', 'cpytel' map 'Chad Woolley', 'thewoolleyman' map 'Chaitanya Vellanki', 'chaitanyav' map 'Charles M. Gerungan', "charles.gerungan\100gmail.com" map 'Charles Nutter', "headius\100headius.com" map 'Chas Grundy', 'chas' map 'Cheah Chu Yeow', 'Chu Yeow', 'chuyeow' map 'Chedli Bourguiba', 'chaadow' map 'Choon Keat', "choonkeat\100gmail.com", 'choonkeat' map 'Chris Anderson', 'jchris' map 'Chris Brinker', "chris\100chrisbrinker.com" map 'Chris Carter', "cdcarter\100gmail.com" map 'Chris Finne', 'chrisfinne', 'chris finne' map 'Chris Hapgood', 'cch1' map 'Chris Kampmeier', 'kampers', 'chrisk' map 'Chris Kohlbrenner', 'chriskohlbrenner' map 'Chris McGrath', "c.r.mcgrath\100gmail.com", 'c.r.mcgrath', "chris\100octopod.info", 'octopod' map 'Chris Mear', "chris\100feedmechocolate.com", 'chrismear' map "Chris O'Sullivan", 'thechrisoshow' map 'Chris Roos', 'chrisroos', "chris\100seagul.co.uk" map 'Chris Wanstrath', "chris\100ozmm.org", 'defunkt' map 'Christof Spies', 'wingfire' map 'Christopher Redinger', 'redinger' map 'Chriztian Steinmeier', "chriztian.steinmeier\100gmail.com" map 'Claudio Baccigalupo', 'claudiob', 'Claudio B.', 'claudiofullscreen', 'Claudio B' map 'Clayton Liggitt', 'arktisklada' map 'Clifford Heath', 'cjheath' map 'Clifford T. Matthews', 'ctm' map 'Coda Hale', 'codahale' map 'Cody Fauser', "codyfauser\100gmail.com" map 'Colman Nady', "colman\100rominato.com" map 'Corey Haines', 'coreyhaines' map 'Corey Leveen', 'mntj' map 'Cory Gwin', "Cory Gwin \100gwincr11" map 'Courtenay Gasking', 'court3nay', 'courtenay', "court3nay\100gmail.com", 'Court3nay' map 'Craig Davey', 'eigentone', "eigentone\100gmail.com" map 'Cristi Balan', 'Cristi BALAN' map 'Daisuke Taniwaki', 'dtaniwaki' map 'Damian Janowski', 'djanowski' map 'Damien Mathieu', 'dmathieu' map 'Dan Cheail', 'codeape' map 'Dan Croak', 'dancroak' map 'Dan Kaplan', 'dkaplan88' map 'Dan Kubb', 'dkubb' map 'Dan Manges', 'dcmanges' map 'Dan Peterson', "dpiddy\100gmail.com" map 'Dan Sketcher', "dansketcher\100gmail.com" map 'Dane Jensen', 'careo' map 'Daniel Cohen', 'danielc192' map 'Daniel Hobe', "daniel\100nightrunner.com" map 'Daniel Morrison', 'danielmorrison' map 'Daniel Rodríguez Troitiño', 'drodriguez' map 'Daniel Sheppard', "daniels\100pronto.com.au" map 'Daniel Wanja', "daniel\100nouvelles-solutions.com" map 'Danni Friedland', 'BlueHotDog' map 'Dave Dribin', "dave-ml\100dribin.org" map 'Dave Goodchild', 'buddhamagnet' map 'Dave Lee', "dave\100cherryville.org" map 'Dave Moore', 'DAVID MOORE' map 'Dave Murphy', 'Wintermute' map 'Dave Naffis', 'naffis' map 'Dave Thomas', "dave\100pragprog.com", 'pragdave' map 'David A. Black', 'dblack', "dblack\100wobblini.net" map 'David Altenburg', "gensym\100mac.com" map 'David Auza', 'davidauza-engineer' map 'David Calavera', 'calavera', 'david.calavera' map 'David Chelimsky', 'dchelimsky' map 'David Demaree', 'ddemaree' map 'David Dollar', 'ddollar' map 'David E. Wheeler', 'Theory' map 'David Easley', "easleydp\100gmail.com" map 'David Felstead', "david.felstead\100gmail.com", "dfelstead\100site5.com" map 'David François', 'David FRANCOIS', 'davout' map 'David Heinemeier Hansson', 'DHH', 'dhh', 'David' # for David see 5d5f0bad6e934d9d4fad7d0fa4643d04c13709a9 map 'David Morton', "mortonda\100dgrmm.net" map 'David N. Welton', 'davidw' map 'David Raynes', 'rayners' map 'David Rice', 'davidjrice' map 'David Roetzel', "rails\100roetzel.de" map 'David Rose', "doppler\100gmail.com" map 'David Rupp', "david\100ruppconsulting.com" map 'David Wang', 'dahakawang' map 'David Weitzman', "dweitzman\100gmail.com" map 'Dawid Janczak', 'DawidJanczak' map 'Dee Zsombor', 'Dee.Zsombor', 'zsombor', "Dee.Zsombor\100gmail.com" map 'Deirdre Saoirse', "deirdre\100deirdre.net" map 'DeLynn Berry', 'Delynn', 'DeLynn', 'delynnb', 'DeLynn Barry', 'DeLynnB', 'DelynnB', 'DeLynn B', "delynn\100gmail.com" map 'Demetrius Nunes', 'demetrius', 'Demetrius' map 'Derek DeVries', 'devrieda' map 'Derrick Spell', "derrickspell\100cdmplus.com" map 'Dev Mehta', 'dpmehta02' map 'Dick Davies', 'rasputnik' map 'Diego Algorta' 'Diego Algorta Casamayou' map 'Diego Giorgini', 'ogeidix' map 'Dieter Komendera', 'kommen' map 'Dino Maric', 'dixpac' map 'Dirkjan Bussink', 'dbussink' map 'Dmitrii Samoilov', 'german' map 'Dmitrij Mjakotnyi', 'kucaahbe' map 'Dmitriy Budnik', "Дмитро Будник" map 'Dmitriy Timokhin', 'pager' map 'Dmitry Dedov', 'dm1try' map 'Dmitry Lipovoi', 'pleax' map 'Dmitry Vorotilin', 'Dmitriy Vorotilin' map 'Dmytro Vasin', 'Vasin Dmitriy' map 'Dominic Sisneros', "dom\100sisna.com" map 'Don Park', "don.park\100gmail.com" map 'Donald Piret', "donald.piret\100synergetek.be" map 'Dr Nic Williams', 'drnic', 'Dr Nic' map 'Duane Johnson', "duane.johnson\100gmail.com", 'canadaduane' map 'Duff OMelia', "dj\100omelia.org" map 'Duncan Beevers', 'duncanbeevers' map 'Duncan Robertson', "duncan\100whomwah.com" map 'Dustin Curtis', 'dcurtis' map 'Dylan Thacker-Smith', 'Dylan Smith' map 'Eaden McKee', 'eadz', 'Eadz' map 'Eddie Cianci', 'defeated' map 'Eddie Stanley', "eddiewould\100paradise.net.nz" map 'Edho Arief', 'edogawaconan' map 'Eduardo Cavazos', 'dharmatech' map 'Edward Betts', "edward\100debian.org" map 'Eelco Lempsink', "rails\10033lc0.net" map 'Egor Homakov', 'homa', 'homakov', '@homakov' map 'Eileen M. Uchitelle', 'eileencodes', 'Eileen Uchitelle', 'Eileen' map 'Elan Feingold', "elan\100bluemandrill.com" map 'Elijah Miller', "elijah.miller\100gmail.com", 'jqr' map 'Elliot Smith', "elliot\100townx.org" map 'Elliot Winkler', 'mcmire' map 'Elliot Yates', 'ejy' map 'Eloy Duran', 'alloy' map 'Emili Parreño', 'eparreno', 'Emili Parreno' map 'Emilio Tagua', 'miloops' map 'Eric Daspet', "eric.daspet\100survol.net" map 'Eric Hodel', "drbrain\100segment7.net" map 'Erik Abele', "erik\100codefaktor.de" map 'Erik Ordway', "ordwaye\100evergreen.edu" map 'Erik Terpstra', "erik\100ruby-lang.nl" map 'Erlend Halvorsen', "ehalvorsen+rails\100runbox.com" map 'Ernesto Jimenez', 'ernesto.jimenez' map 'Ershad Kunnakkadan', 'Ershad K', 'ershad' map 'Esad Hajdarevic', "esad\100esse.at", 'esad' map 'Eugene Gilburg', 'egilburg' map 'Eugene Pimenov', 'libc' map 'Evan DiBiase', 'edibiase' map 'Evan Henshaw-Plath', "evan\100protest.net" map 'Evan Weaver', 'evan' map 'Evgeny Zislis', "evgeny.zislis\100gmail.com" map 'Fabian Winkler', 'wynksaiddestroy' map 'Fabián Rodríguez', 'Fabian Rodriguez' map 'Fabien Mannessier', "fabien\100odilat.com" map 'Farley Knight', 'farleyknight' map 'Farzad Farid', 'farzy' map 'fatkodima', 'Dima Fatko', 'Fatko Dima', 'fatkodima123' map 'Fedot Praslov', 'fedot' map 'Felix Dominguez', 'dacat' map 'Ferdinand Niedermann', 'nerdinand' map 'Ferdinand Svehla', "f.svehla\100gmail.com", 'f.svehla' map 'Florian Munz', 'theflow' map 'Francesco Rodríguez', 'Francesco Rodriguez' map 'François Beausoleil', 'François Beausolei', 'Francois Beausoleil', "fbeausoleil\100ftml.net", "francois.beausoleil\100gmail.com" map 'Frank Müller', 'suchasurge' map 'Franky Wahl', 'Franky W' map 'Frederick Cheung', 'fcheung', 'Fred Cheung', 'frederick.cheung', "frederick.cheung\100gmail.com" map 'Frederico Macedo', 'frederico' map 'Frederik Spang', 'frederikspang', 'Frederik Erbs Spang Thomsen' map 'G S Phani Kumar', 'gsphanikumar' map 'Gabe da Silveira', 'dasil003' map 'Gabriel Gironda', "gabriel.gironda\100gmail.com", "gabriel\100gironda.org" map 'Ganesh Kumar', 'ganesh' map 'Gaspard Bucher', "g.bucher\100teti.ch" map 'Gaurav Sharma', 'Gaurav Sharam' map 'Gavin Morrice', 'Bodacious' map 'Genki Takiuchi', "takiuchi\100drecom.co.jp" map 'Geoff Buesing', 'gbuesing', 'Geoffrey Buesing' map 'Geoff Coffey', 'gwcoffey' map 'Geoff Garside', 'ggarside' map 'Geoff Jacobsen', 'jacott' map 'Geoffrey Grosenbach', 'topfunky' map 'Geoffrey Roguelon', 'Geoffrey ROGUELON' map 'Geoffroy Lorieux', 'glorieux' map 'Georg Friedrich', 'gfriedrich' map 'Giovanni Intini', "medlar\100medlar.it", 'intinig' map 'Girish Sonawane', 'Girish S' map 'Glen Gibb', 'grg' map 'Glenn Vanderburg', 'glv' map 'Go Sueyoshi', 'sue445' map 'Gonzalo Rodríguez-Baltanás Díaz', 'Nerian' map 'Graeme Mathieson', 'mathie' map 'Grant Hollingworth', "grant\100antiflux.org" map 'Greg Lappen', "greg\100lapcominc.com" map 'Greg Miller', 'vertigoclinic' map 'Greg Spiers', 'gspiers' map 'Grzegorz Daniluk', "daniluk\100yahoo.com" map 'Guillaume Carbonneau', 'guillaume' map 'Guo Xiang Tan', 'Guo Xiang', 'Alan Tan', 'Alan Guo Xiang Tan' map 'Gustavo Leon', 'HPNeo' map 'Guy Naor', "guy.naor\100famundo.com" map 'Hakan Ensari', 'hakanensari' map 'Hal Brodigan', 'postmodern' map 'Hampton Catlin', "hcatlin\100gmail.com" map 'Harsh Deep', 'Harsh' map 'Hartley McGuire', 'Hartley McGuire @skipkayhil' map 'Hendrik Mans', "hendrik\100mans.de" map 'Hendy Irawan', 'ceefour' map 'Henrik Nyh', 'Henrik N', "henrik\100nyh.se", 'henrik' map 'Herryanto Siatono', 'jugend' map 'Hirofumi Wakasugi', 'WAKASUGI 5T111111' map 'Hiroshi Saito', 'hiroshi' map 'Hongli Lai (Phusion)', 'FooBarWidget', 'Hongli Lai', 'Hongli Lai (Phusion' map 'Huiming Teo', 'Teo Hui Ming' map 'Ian White', "ian.w.white\100gmail.com" map 'Ibrahim Abdullah', 'simply-phi' map 'Ignazio Mostallino', 'gnagno' map 'Igor Fedoronchuk', 'Igor', 'Fivell' map 'Igor Guzak', 'igor04' map 'Indrek Juhkam', 'innu' map 'Iñigo Solano Pàez', '1334' map 'Innokenty Mikhailov', 'gregolsen' map 'Ionatan Wiznia', 'iwiznia' map 'Irfan Adilovic', 'Irfy' map 'Irina Bednova', 'jafrog' map 'Isaac Feliu', 'isaacfeliu' map 'Isaac Reuben', "isaac\100reuben.com" map 'Ivan Korunkov', 'Ivan' map 'Iván Vega', 'ivanvr' map 'J Kittiyachavalit', 'jkit' map 'Jack Christensen', "jackc\100hylesanderson.com" map 'Jack Danger Canty', 'danger', 'Danger' map 'Jacob Atzen', 'jacobat' map 'Jacob Duffy', 'jpd800' map 'Jacob Fugal', 'lukfugl' map 'Jacob Herrington', 'jacobherrington' map 'Jacob Straszynski', 'jacobstr' map 'Jaehyun Shin', 'keepcosmos' map 'Jake Janovetz', 'janovetz' map 'Jake Waller', 'wallerjake' map 'Jakob Skjerning', 'Jakob S', "jakob\100mentalized.net" map 'James Adam', 'lazyatom', "james.adam\100gmail.com" map 'James Coglan', 'jcoglan' map 'James Conroy-Finn', 'jcf' map 'James Cox', 'imajes' map 'James Edward Gray II', "james\100grayproductions.net", 'JEG2' map 'James Golick', 'jamesgolick' map 'James Healy', 'yob' map 'James Lindley', 'jlindley' map 'James Mead', 'floehopper' map 'James Megquier', "james\100slashetc.com" map 'James Miller', 'bensie' map 'James Strachan', "jstrachan" map 'James Tucker', 'raggi' map 'Jamie Hill', 'jamie' map 'Jamie Macey', "jamie\100bravenet.com", "maceywj\100telus.net" map 'Jamie Orchard-Hays', "jamie\100dang.com" map 'Jamie van Dyke', 'fearoffish' map 'Jamis Buck', 'Jamis' map 'Jan Berdajs', 'MrBrdo', 'mrbrdo' map 'Jan De Poorter', 'DefV' map 'Jan Krutisch', 'halfbyte' map 'Jan Prill', "JanPrill\100blauton.de" map 'Jan Schwenzien', 'jeanmartin' map 'Jared Haworth', 'jardeon' map 'Jarkko Laine', "jarkko\100jlaine.net", 'Jarkko', 'jarkko' map 'Jason Frey', 'Jason Frey (Fryguy)' map 'Jason Garber', 'jgarber' map 'Jason Kaye', 'JayK31' map 'Jason Ketterman', 'anshkakashi' map 'Jason L Perry', 'ambethia' map 'Jason Roth', 'Jason' map 'Jason Stewart', 'jstewart' map 'Jason Stirk', "jstirk\100oobleyboo.com" map 'Javier Ramírez', 'jramirez' map 'Jay Levitt', "jay\100jay.fm" map 'JC (Jonathan Chen)', 'Jonathan Chen' map 'Jean Baptiste Barth', 'jbbarth' map 'Jean Boussier', 'Jean byroot Boussier' map 'Jean Helou', "jean.helou\100gmail.com", 'jean.helou' map 'Jean-François Labbé', "Jean-Francois Labbé", "jean-francois labbe" map 'Jean-Philippe Bougie', "jp.bougie\100gmail.com" map 'Jeff Berg', "jeff\100ministrycentered.com" map 'Jeff Cohen', "cohen.jeff\100gmail.com" map 'Jeff Cole', "rails\100jeffcole.net" map 'Jeff Dickey', 'dickeyxxx' map 'Jeff Dutil', 'jdutil' map 'Jeff Lindsay', "progrium\100gmail.com" map 'Jeffrey Hardy', 'packagethief' map 'Jeffrey Moss', "jeff\100opendbms.com" map 'Jens-Christian Fischer', "jcfischer\100gmail.com" map 'Jeong Changhoon', 'seapy' map 'Jeremy Daer', 'Jeremy Daer (Kemper)', 'Jeremy Kemper', 'bitsweat' map 'Jeremy Durham', "jeremydurham\100gmail.com" map 'Jeremy Evans', "jeremyevans0\100gmail.com", 'jeremyevans', "jeremye\100bsa.ca.gov", "code\100jeremyevans.net" map 'Jeremy Hopple', "jeremy\100jthopple.com" map 'Jeremy Jackson', 'jejacks0n' map 'Jeremy Lightsmith', 'stellsmi' map 'Jeremy McAnally', 'jeremymcnally', 'jeremymcanally' map 'Jeremy Voorhis', "jeremy\100planetargon.com", 'jvoorhis' map 'Jeroen van Ingen', 'jeroeningen' map 'Jérôme Lipowicz', 'jerome' map 'Jerrett Taylor', "jerrett\100bravenet.com" map 'Jesse Merriman', "jessemerriman\100warpmail.net" map '簡煒航 (Jian Weihang)', 'Jian Weihang' map 'Jim Helm', "perlguy\100gmail.com" map 'Jim Hughes', 'jeem' map 'Jim Meyer', 'purp' map 'Jim Winstead', "jimw\100mysql.com" map 'Joé Dupuis', 'Joe Dupuis' map 'Joe Ellis', 'joeellis' map 'Joe Ferris', 'jferris' map 'Joe Goldwasser', "joe\100mjg2.com" map 'Joe Lewis', 'swapdisc' map 'Joel Smith', 'jbsmith86' map 'Joel Watson', 'watsonian' map 'Joerg Diekmann', "joergd\100pobox.com" map 'Johan Sørensen', 'Johan Sorensen', 'Johan Sörensen', "johan\100johansorensen.com", "johan\100textdrive.com" map 'Johannes Barre', 'iGEL' map 'John Barnette', 'jbarnette' map 'John Barton', 'johnb' map 'John Dewey', 'retr0h' map 'John F. Douthat', 'johndouthat' map 'John J. Wang', 'wangjohn', 'John J Wang' map 'John Mettraux', 'jmettraux' map 'John Nunemaker', "nunemaker\100gmail.com" map 'John Oxton', "rails\100electricvisions.com" map 'John Pignata', 'Developer', 'Jay Pignata' # see 179b451 map 'John Sheets', "dev\100metacasa.net", "jsheets" map 'John Warwick', 'jwarwick' map 'John Wells', 'jbwiv' map 'John Wilger', 'jwilger' map 'Johnson Wang', 'spyhole' map 'Jon Bright', "jon\100siliconcircus.com" map 'Jon Evans', "jon.evans\100pobox.com", 'evansj' map 'Jon Moses', "jon\100burningbush.us"
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
true
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/app/models/names_manager/hard_coded_authors.rb
app/models/names_manager/hard_coded_authors.rb
module NamesManager module HardCodedAuthors # Sometimes the information to give credit for some commits is just not # present in the repository, or is present in a way the application does # not understand. This method has a hard-coded list of contributor names # for those commits. # # See the comment in each case for their justification. # # Please add commits here very exceptionally, only when there's no way # we can extract the candidates from the commit. False positives are # handled by NamesManager::FalsePositives, and regular aliases are managed # by NamesManager::CanonicalNames. def hard_coded_authors(commit) case commit.sha1 when '1382f4de1f9b0e443e7884bd4da53c20f0754568' # This was a commit backported from 2.3 that missed Dana in the way. ['David Burger', 'Dana Jones'] when '882dd4e6054470ee56c46ab1432861952c81b633' # The following patch comes from this ticket https://rails.lighthouseapp.com/projects/8994/tickets/2856 # but Yehuda told me credit for that commit was screwed up. ['David Calavera'] when 'f9a02b12d15bdbd3c2ed18b16b31b712a77027bc' # The attribution is done with parens in a way we do not extract. ['Juan Lupión'] when '4b4aa8f6e08ba2aa2ddce56f1d5b631a78eeef6c' # parens again ['Jesper Hvirring Henriksen'] when '945d999aadc9df41487e675fa0a863396cb54e31' # Author is "pivotal", but Adam Milligan told me Chris is the author (via github). ['Chris Heisterkamp'] when 'eb457ceee13779ade67e1bdebd2919d476148277' # Author is "pivotal", but Adam Milligan told me Joseph is the author (via github). ['Joseph Palermo'] when '6f2c4991efbbc5f567a6df36ca78de4f3ca24ee2', '9dbde4f5cbd0617ee6cce3e41d41335f9c9ce3fd' # Author is "pivotal", but Adam Milligan told me he himself is the author (via github). ['Adam Milligan'] when 'ddf2b4add33d5e54c5f5e7adacadbb50d3fa7b52' # These were Xavier's edits that for some reason were committed by Mikel. ['Xavier Noria'] when '3b1c69d2dd2b24a29e4443d7dc481589320a3f3e' # This was a patch from a bugmash that was applied by Xavier directly. # See https://rails.lighthouseapp.com/projects/8994/tickets/4284. ['Kieran Pilkington'] when 'a4041c5392457448cfdfef2e1b24007cfa46948b' # Vishnu forked using a different email address, and credit goes in the git commit # to Vishnu K. Sharma because of that, but the commit is his. ['Vishnu Atrai'] when 'ec44763f03b49e8c6e3bff71772ba32863a01306' # Mohammad El-Abid asked for this fix on Twitter (see https://twitter.com/The_Empty/status/73864303123496960). ['Mohammad Typaldos'] when '99dd117d6292b66a60567fd950c7ca2bda7e01f3' # Same here. ['Mohammad Typaldos'] when '3582bce6fdb30730b34b91a17b8bb33066eed7b8' # The attribution was wrong, and amended later in 33736bc18a9733d95953f6eaec924db10badc908. ['Juanjo Bazán', 'Tarmo Tänav', 'BigTitus'] when '7e8e91c439c1a877f867cd7ba634f7297ccef04b' # Credit was given in a non-conventional manner. ['Godfrey Chan', 'Philippe Creux'] when '798881ecd4510b9e1e5e10529fc2d81b9deb961e', '134c1156dd5713da41c62ff798fe3979723e64cc' # Idem. ['Godfrey Chan', 'Sergio Campamá'] when 'b23ffd0dac895aa3fd3afd8d9be36794941731b2' # See https://github.com/rails/rails/pull/13692#issuecomment-33617156. ['Łukasz Sarnacki', 'Matt Aimonetti'] when '1240338a02e5decab2a94b651fff78889d725e31' # Blake and Arthur paired on this YAML compatibility backport. ['Blake Mesdag', 'Arthur Neves'] when 'd318badc269358c53d9dfb4000e8c4c21a94b578' # Adrien worked on the fix, Grey on a regression spec, but only Grey's PR # was merged. See https://github.com/fxn/rails-contributors/pull/59. ['Grey Baker', 'Adrien Siami'] when '41adf8710e695f01a8100a87c496231d29e57cf2' # This commit uses non-conventional notation for multiple credits. ['Mislav Marohnić', 'Geoff Buesing'] when '6ddde027c4e51262e58f67438672d66a2b278f43' # Idem. ['Arthur Zapparoli', 'Michael Koziarski'] when '063c393bf0a2eb762770c97f925b7c2867361ad4' ['ivanvr'] when '872e22c60391dc45b7551cc0698d5530bb310611' # This patch comes from https://github.com/rails/web-console/pull/91, # originally authored by Daniel, but ported to upstream Rails by Genadi. ['Daniel Rikowski', 'Genadi Samokovarov'] when '92209356c310caabda8665d6369d3b1e4a1800d1' # Tsukuru Tanimichi originally worked on the PR, but Aaron Patterson and # Eileen Uchitelle changed the implementation on a separate branch. ['Eileen M. Uchitelle', 'Aaron Patterson', 'Tsukuru Tanimichi'] when '9668cc3bb03740b13477df0832332eec71563bc5' # Backport of the above commit. ['Eileen M. Uchitelle', 'Aaron Patterson', 'Tsukuru Tanimichi'] when '4f1472d4de37f1f77195c36390ce8bb65bb61e71' # The metadata for this commit completely lacks the name of the original # author. You'll see there only stuff related to ImgBot. ['John Bampton'] when '903dcefbaff8cf3a0e9db61048aebd9e753835ea' ['Josh Peek', 'David Heinemeier Hansson'] when 'fdbc55b9d55ae9d2b5b39be3ef4af5f60f6954a3', '6c6c3fa166975e5aebbe444605d736909e9eb75b' ['Yasuo Honda'] when '83c6ba18899a9f797d79726ca0078bdf618ec3d4' # This is a Git commit, but credit was still given in the CHANGELOG. ['S. Brent Faulkner'] else nil end end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/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 => 'Daley', :city => cities.first)
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/db/schema.rb
db/schema.rb
# 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/rails # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to # be faster and is potentially less error prone than running all of your # migrations from scratch. Old migrations may fail to apply correctly if those # migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[7.0].define(version: 2016_05_12_095609) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" create_table "commits", id: :serial, force: :cascade do |t| t.string "sha1", null: false t.string "author_email", null: false t.string "author_name", null: false t.datetime "author_date", precision: nil, null: false t.string "committer_email", null: false t.string "committer_name", null: false t.datetime "committer_date", precision: nil, null: false t.text "message", null: false t.text "diff" t.integer "release_id" t.boolean "merge", null: false t.index ["release_id"], name: "index_commits_on_release_id" t.index ["sha1"], name: "index_commits_on_sha1", unique: true end create_table "contributions", id: :serial, force: :cascade do |t| t.integer "contributor_id", null: false t.integer "commit_id", null: false t.index ["commit_id"], name: "index_contributions_on_commit_id" t.index ["contributor_id"], name: "index_contributions_on_contributor_id" end create_table "contributors", id: :serial, force: :cascade do |t| t.string "name", null: false t.string "url_id", null: false t.integer "rank" t.datetime "first_contribution_at", precision: nil t.index ["name"], name: "index_contributors_on_name", unique: true t.index ["url_id"], name: "index_contributors_on_url_id", unique: true end create_table "releases", id: :serial, force: :cascade do |t| t.string "tag", null: false t.datetime "date", precision: nil, null: false t.integer "major", null: false t.integer "minor", null: false t.integer "tiny", null: false t.integer "patch", null: false t.index ["tag"], name: "index_releases_on_tag", unique: true end create_table "repo_updates", id: :serial, force: :cascade do |t| t.integer "ncommits", null: false t.datetime "started_at", precision: nil, null: false t.datetime "ended_at", precision: nil, null: false t.integer "nreleases", null: false t.boolean "rebuild_all", null: false end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/db/migrate/20160512095609_rename_nmupdated.rb
db/migrate/20160512095609_rename_nmupdated.rb
class RenameNmupdated < ActiveRecord::Migration[4.2] def change rename_column :repo_updates, :nmupdated, :rebuild_all end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/db/migrate/20150326181907_add_first_contribution_at_to_contributors.rb
db/migrate/20150326181907_add_first_contribution_at_to_contributors.rb
class AddFirstContributionAtToContributors < ActiveRecord::Migration[4.2] def up add_column :contributors, :first_contribution_at, :datetime Contributor.try(:fill_missing_first_contribution_timestamps) end def down remove_column :contributors, :first_contribution_at end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/db/migrate/20141101094005_initial_schema.rb
db/migrate/20141101094005_initial_schema.rb
class InitialSchema < ActiveRecord::Migration[4.2] def up create_table :commits do |t| t.string :sha1, null: false t.string :author_email, null: false t.string :author_name, null: false t.datetime :author_date, null: false t.string :committer_email, null: false t.string :committer_name, null: false t.datetime :committer_date, null: false t.text :message, null: false t.text :diff t.integer :release_id t.boolean :merge, null: false t.index :sha1, unique: true t.index :release_id end create_table :contributions do |t| t.integer :contributor_id, null: false t.integer :commit_id, null: false t.index :contributor_id t.index :commit_id end create_table :contributors do |t| t.string :name, null: false t.string :url_id, null: false t.integer :rank t.index :name, unique: true t.index :url_id, unique: true end create_table :releases do |t| t.string :tag, null: false t.datetime :date, null: false t.integer :major, null: false t.integer :minor, null: false t.integer :tiny, null: false t.integer :patch, null: false t.index :tag, unique: true end create_table :repo_updates do |t| t.integer :ncommits, null: false t.datetime :started_at, null: false t.datetime :ended_at, null: false t.integer :nreleases, null: false t.boolean :nmupdated, null: false end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/application_system_test_case.rb
test/application_system_test_case.rb
require "test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :selenium, using: :chrome, screen_size: [1400, 1400] end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/test_helper.rb
test/test_helper.rb
require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require_relative 'support/assert_contributor_names' class ActiveSupport::TestCase TODAY = Time.zone.parse('2012-12-26') fixtures :all def time_travel(&block) travel_to(TODAY, &block) end def read_fixture(name) File.read("#{Rails.root}/test/fixtures/#{name}") end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/credits/wanted_aliases_test.rb
test/credits/wanted_aliases_test.rb
require 'test_helper' # These are aliases the application should not map to real names because # authors requested it. This suite prevents future passes resolving aliases # from forgetting this commitment. module Credits class WantedAliasesTest < ActiveSupport::TestCase include AssertContributorNames test 'bogdanvlviv' do assert_contributor_names 'f2489f4', 'bogdanvlviv' end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/credits/cleanup_test.rb
test/credits/cleanup_test.rb
require 'test_helper' module Credits class CleanupTest < ActiveSupport::TestCase include AssertContributorNames # CHANGELOG has "[François Beausoleil <...>, Blair Zajac <...>]". test 'names get email addresses stripped' do assert_contributor_names 'dfda57a', 'François Beausoleil', 'Blair Zajac' end # Commit message has "[*Godfrey Chan*, *Aaron Patterson*]". test 'removes Markdown emphasis' do assert_contributor_names '28d52c5', 'Godfrey Chan', 'Aaron Patterson' end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/credits/hard_coded_authors_test.rb
test/credits/hard_coded_authors_test.rb
require 'test_helper' module Credits class SpecialCasedCommitsTest < ActiveSupport::TestCase include AssertContributorNames test 'special-cased commits' do assert_contributor_names '1382f4d', 'David Burger', 'Dana Jones' assert_contributor_names '882dd4e', 'David Calavera' assert_contributor_names 'f9a02b1', 'Juan Lupión' assert_contributor_names '4b4aa8f', 'Jesper Hvirring Henriksen' assert_contributor_names '945d999', 'Chris Heisterkamp' assert_contributor_names 'eb457ce', 'Joseph Palermo' assert_contributor_names '6f2c499', 'Adam Milligan' assert_contributor_names '9dbde4f', 'Adam Milligan' assert_contributor_names 'ddf2b4a', 'Xavier Noria' assert_contributor_names '3b1c69d', 'Kieran Pilkington' assert_contributor_names 'a4041c5', 'Vishnu Atrai' assert_contributor_names 'ec44763', 'Mohammad Typaldos' assert_contributor_names '99dd117', 'Mohammad Typaldos' assert_contributor_names '3582bce', 'Juanjo Bazán', 'Tarmo Tänav', 'BigTitus' assert_contributor_names '7e8e91c', 'Godfrey Chan', 'Philippe Creux' assert_contributor_names '798881e', 'Godfrey Chan', 'Sergio Campamá' assert_contributor_names '134c115', 'Godfrey Chan', 'Sergio Campamá' assert_contributor_names 'b23ffd0', 'Łukasz Sarnacki', 'Matt Aimonetti' assert_contributor_names '1240338', 'Blake Mesdag', 'Arthur Neves' assert_contributor_names 'd318bad', 'Grey Baker', 'Adrien Siami' assert_contributor_names '41adf87', 'Mislav Marohnić', 'Geoff Buesing' assert_contributor_names '6ddde02', 'Arthur Zapparoli', 'Michael Koziarski' assert_contributor_names '063c393', 'Iván Vega' assert_contributor_names '872e22c', 'Daniel Rikowski', 'Genadi Samokovarov' assert_contributor_names '9220935', 'Eileen M. Uchitelle', 'Aaron Patterson', 'Tsukuru Tanimichi' assert_contributor_names '9668cc3', 'Eileen M. Uchitelle', 'Aaron Patterson', 'Tsukuru Tanimichi' assert_contributor_names '4f1472d', 'John Bampton' assert_contributor_names 'fdbc55b', 'Yasuo Honda' assert_contributor_names '6c6c3fa', 'Yasuo Honda' assert_contributor_names '83c6ba1', 'S. Brent Faulkner' end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/credits/false_positives_test.rb
test/credits/false_positives_test.rb
require 'test_helper' # Heuristics sometimes yield contributor names we know are false positives. # # For example, "[DHH]" in a commit message means David should be credited, # but "[Sean Griffin & ysbaddaden]" or "[ci skip]" need special handling. module Credits class FalsePositivesTest < ActiveSupport::TestCase include AssertContributorNames test 'integers' do assert_contributor_names '02daf68', 'Nick Ragaz' assert_contributor_names '2ffa50f', 'Neeraj Singh' assert_contributor_names '708ee9c', 'Santiago Pastorino' end test 'ticket references' do assert_contributor_names '001ca89', 'Kieran Pilkington' assert_contributor_names '01c9782', 'Xavier Noria' assert_contributor_names '0ed6ebc', 'Xavier Noria' assert_contributor_names '198d9e3', 'Arthur Neves' assert_contributor_names '3413643', 'Akira Matsuda' assert_contributor_names '7db2ef4', 'Jason Noble' assert_contributor_names 'a9050e7', 'Claudio Baccigalupo' end test 'GH-\d+' do assert_contributor_names '777c39c', 'zzak' end test 'whitespace' do assert_contributor_names '4e873ff', 'Jarek Radosz' end test 'See Rails ML' do assert_contributor_names 'bec70cf', 'David Heinemeier Hansson' end test 'RAILS_ENV' do assert_contributor_names '6422f8b', 'David Heinemeier Hansson' end test 'RubyConf' do assert_contributor_names '5e5c332', 'David Heinemeier Hansson' end test 'update from Trac' do assert_contributor_names '70117b0', 'Jeremy Daer' end test 'leading single quote' do assert_contributor_names 'f48b9ab', 'Josh Peek' assert_contributor_names 'c61b3ce', 'Paul Nikitochkin' end test 'leading double quote' do assert_contributor_names '20e8344', 'Toshinori Kajihara' assert_contributor_names '7f318c3', 'Bryan Helmkamp' end test 'leading colon' do assert_contributor_names '0c525f6', 'Aaron Suggs' assert_contributor_names '006f710', 'Alex Johnson' end test 'RC1' do assert_contributor_names '57c31a3', 'David Heinemeier Hansson' end test 'https://' do assert_contributor_names '42cdc75', 'Luca Guidi' assert_contributor_names 'b960000', 'Val Kotlarov Hoffman' end test '\\x00-\\x1f' do assert_contributor_names '808cad2', 'Dwayne Litzenberger' assert_contributor_names 'a900205', 'Dwayne Litzenberger' end test 'CVE-\d+' do assert_contributor_names '0075f36', 'Charlie Somerville' end test 'and' do assert_contributor_names 'd891ad4', 'Santiago Pastorino' end test 'options' do assert_contributor_names 'bf176e9', 'Piotr Sarnacki' end test 'API DOCS' do assert_contributor_names '9726ed8', 'Rohit Arondekar' end test 'hat-tip to anathematic' do assert_contributor_names 'b67dc00', 'Ryan Bigg' end test 'props to Zarathu in #rubyonrails' do assert_contributor_names '09b7e35', 'Ryan Bigg' end test 'thanks Pratik!' do assert_contributor_names 'a646780', 'David Heinemeier Hansson' end test 'multiple=true' do assert_contributor_names 'e591d14', 'Piotr Sarnacki' end test 'ci skip' do assert_contributor_names '2e679ac', 'Akshay Vishnoi' end test 'ci <underscore> skip' do assert_contributor_names '86c5cea', 'Damian Galarza' end test 'ci <hyphen> skip' do assert_contributor_names 'b76269a', 'Max Goldstein' end test 'ci kip' do assert_contributor_names 'd9e8ec6', 'Rafael Mendonça França'.nfc end test 'ci skp' do assert_contributor_names '94e8fc0', 'Yves Senn' end test 'ci ski' do assert_contributor_names '1c2717d', 'Justin' end test 'skip ci' do assert_contributor_names 'b1c28d7', 'Arun Agrawal' end test 'skip-ci' do assert_contributor_names 'd273741', 'Amit Thawait' end test 'ci <new line> skip' do assert_contributor_names '319baed', 'Sadman Khan' end test 'key' do assert_contributor_names '98f4aee', 'Xavier Noria' end test '.lock' do assert_contributor_names 'c71b961', 'Ryan Bigg' end test "{ :ca => :'es-ES' }" do assert_contributor_names '0c2ccc0', 'Vipul A M', exact: true end test 'fixes 5f5e6d924973003c105feb711cefdb726f312768' do assert_contributor_names 'e7c48db', 'Arthur Neves' end test '79990505e5080804b53d81fec059136afa2237d7' do assert_contributor_names 'eade591', 'Prem Sichanugrist' end test 'direct_upload_xls_in_chrome' do assert_contributor_names '1d133e8', 'Nick Weiland' end test "schoenm\100earthlink.net sandra.metz\100duke.edu" do assert_contributor_names '242cd06', 'Michael Schoen', 'Sandi Metz' end test '=?utf-8?q?Adam=20Cig=C3=A1nek?=' do assert_contributor_names 'fcd58dc', 'Adam Cigánek'.nfc end test '=?utf-8?q?Mislav=20Marohni=C4=87?=' do assert_contributor_names '21cd4c0', 'Mislav Marohnić'.nfc end test 'nik.wakelin Koz' do assert_contributor_names '5bf40f7', 'Nik Wakelin', 'Michael Koziarski' end test "me\100jonnii.com rails\100jeffcole.net Marcel Molina Jr." do assert_contributor_names '4793a2f', 'Jonathan Goldman', 'Jeff Cole', 'Marcel Molina Jr.' end test "jeremy\100planetargon.com Marcel Molina Jr." do assert_contributor_names '30c6bd9', 'Jeremy Voorhis', 'Marcel Molina Jr.' end test "matt\100mattmargolis.net Marcel Molina Jr." do assert_contributor_names '883c54a', 'Matt Margolis', 'Marcel Molina Jr.' end test "doppler\100gmail.com phil.ross\100gmail.com" do assert_contributor_names 'f4f7e75', 'David Rose', 'Philip Ross' end test 'After much pestering from Dave Thomas' do assert_contributor_names '7d01005', 'Dave Thomas' end test "jon\100blankpad.net)" do assert_contributor_names '35d3ede', 'Jon Wood' end test 'Jose and Yehuda' do assert_contributor_names 'afd7140', 'José Valim'.nfc, 'Yehuda Katz' end test 'email addresses with a plus sign' do assert_contributor_names '2890b96', 'Nick Murphy' assert_contributor_names '49efa02', 'Erlend Halvorsen' assert_contributor_names 'c92ecb8', "alec+rails\100veryclever.net" end test 'Spotted by' do assert_contributor_names 'b059ceb', 'Robby Russel' end test 'Aggregated by' do assert_contributor_names '7a2ce50', 'Michael Schoen' end test 'via' do assert_contributor_names '7cc67eb', 'Tim Bray' assert_contributor_names 'f74ba37', 'Jay Fields' end test 'connector ,' do assert_contributor_names '9159489', 'Pratik Naik', 'Jeremy Daer' end test 'connector /' do assert_contributor_names '8f2221d', 'Rick Olson', 'David Heinemeier Hansson' end test 'connector &' do assert_contributor_names 'b0f2b94', 'Siân Griffin', 'Julien Portalier' end test 'connector +' do assert_contributor_names '3c15cba', 'Yehuda Katz', 'Carl Lerche' end test 'connector and' do assert_contributor_names 'd39c456', 'Nick Quaranto', 'Josh Nichols' end test 'ignores and if it is not a word' do assert_contributor_names '13823a4', 'James Sanders', 'Jason Noble' end test 'multiple connectors at the same time' do assert_contributor_names '3534791', 'Sam Umbach', 'Zachary Porter', 'Michael Pell' assert_contributor_names '175ba04', 'Daniel Fox', 'Grant Hutchins', 'Trace Wax' end test 'ignores unknown contributors symbolized by a ?' do assert_contributor_names 'eb5ca2e', 'caleb', exact: true assert_contributor_names '8ff6d76', 'Sam Stephenson', exact: true end test 'ignores unknown contributors referred as "others"' do assert_contributor_names 'da4b15f', 'Kevin Jackson', 'David Heinemeier Hansson', exact: true end test '[he/him] ad-hoc handling' do assert_contributor_names 'fe03a19', 'Ben Sheldon' end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/credits/heuristics_test.rb
test/credits/heuristics_test.rb
require 'test_helper' module Credits class HeuristicsTest < ActiveSupport::TestCase include AssertContributorNames # Example from 1c47d04: # # Added Object#presence that returns the object if it's #present? otherwise returns nil [DHH/Colin Kelley] # test 'captures credit at the end of the subject' do assert_contributor_names '1c47d04', 'David Heinemeier Hansson', 'Colin Kelley' end # Example from 9e9793b: # # do not trigger AR lazy load hook before initializers ran. # # [Rafael Mendonça França & Yves Senn] # # This require caused the `active_record.set_configs` initializer to # ... # test 'captures credit in an isolated line' do # First line in body. assert_contributor_names '9e9793b', 'Rafael Mendonça França', 'Yves Senn' # Line in the middle. assert_contributor_names '2a67e12', 'Matthew Draper', 'Yves Senn' # There are multiple lines with [...], only one of them has credits. assert_contributor_names '84c0f73', 'Godfrey Chan', 'Xavier Noria' end # Example from ec20838: # # diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG # index b793bda..b76db7c 100644 # --- a/activerecord/CHANGELOG # +++ b/activerecord/CHANGELOG # @@ -1,5 +1,7 @@ # *SVN* # # +* ActiveRecord::Base.remove_connection explicitly ... welcome. #3591 [Simon Stapleton, Tom Ward] # + # ... # test 'captures credit from CHANGELOGs in commits imported from Subversion' do assert_contributor_names 'ec20838', 'Simon Stapleton', 'Tom Ward' assert_contributor_names 'cf656ec', 'Christopher Cotton' assert_contributor_names '532d4e8', 'Michael Schoen' assert_contributor_names 'c95365a', 'Geoff Buesing' assert_contributor_names '8dea60b', 'Vitaly Kushner' end # Example from 71528b1: # # Previously we only added the "lib" subdirectory to the load path when # setting up gem dependencies for frozen gems. Now we add the "ext" # subdirectory as well for those gems which have compiled C extensions # as well. [Wincent Colaiuta] # # [#268 state:resolved] # test 'subject is defined by two consecutive newlines' do assert_contributor_names '71528b1', 'Wincent Colaiuta' end # Example from bf0f145: # # let the rails command recurse upwards looking for script/rails, and exec ruby on it for better portability [Xavier Noria] (Closes #4008) # # These were common in the SVN days. test 'eventual trailing "(Closes #nnn)" are ignored' do assert_contributor_names 'bf0f145', 'Xavier Noria' end # Example from 41bfede: # # Tidy up framework initialization code to ensure that it doesn't add folders to the load path that it doesn't intend to require. # # Work around mongrel swallowing LoadErrors to ensure that users get more helpful errors if active_resource is required but not missing. [mislav] Closes #9 # # # git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7738 5ecf4fe2-1ee6-0310-87b1-e25e094e27de # test 'captures credit at the end of the body message of commits imported from Subversion' do assert_contributor_names '03d37a2', 'Tobias Lütke' assert_contributor_names '41bfede', 'Mislav Marohnić' end # Example from 4e873ff: # # commit 4e873ffcdab0c445e2211db1d27ddd5b349f7913 # Author: <JRadosz@gmail.com> # Date: Tue Apr 12 00:59:55 2011 -0700 # ... # test 'captures credit from email if author name is empty' do assert_contributor_names '4e873ff', 'Jarek Radosz' end test 'fallback to the author name' do assert_contributor_names 'f756bfb', 'Jeremy Daer' assert_contributor_names 'cf6b13b', 'Carlos Antonio da Silva' assert_contributor_names '6033d2c', 'Iñigo Solano Pàez' end test 'committers get credit for commits imported from Subversion' do assert_contributor_names 'cf656ec', 'Christopher Cotton', 'Marcel Molina Jr.', equal: true end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/credits/disambiguation_test.rb
test/credits/disambiguation_test.rb
require 'test_helper' # Some commits need disambiguation to be credited correctly. module Credits class DisambiguationTest < ActiveSupport::TestCase include AssertContributorNames test 'disambiguates abhishek' do assert_contributor_names '21f0c580', 'Abhishek Jain' assert_contributor_names '00e30b8f', 'Abhishek Yadav' end test 'disambiguates Sam' do assert_contributor_names 'b37399a', 'Sam Saffron' assert_contributor_names '0a57f34', 'Sam Saffron' assert_contributor_names '44fb54f', 'Sam' end test 'disambiguates James' do assert_contributor_names '63d7fd6', 'James Bowles' end test 'disambiguates root' do assert_contributor_names 'a9d3b77', 'Mohamed Osama' end test 'disambiguates unknown' do assert_contributor_names 'e813ad2a', 'Andrew Grimm' assert_contributor_names '2414fdb2', 'Jens Kolind' assert_contributor_names '3833d45', 'Manish Puri' end test 'disambiguates David' do assert_contributor_names '5d5f0bad', 'David Heinemeier Hansson', 'Sam Stephenson' assert_contributor_names 'bc437632', 'David Wang' end test 'disambiguates Jan' do assert_contributor_names '4942b41', 'Jan Habermann' assert_contributor_names 'f294540', 'Jan Xie' end test 'empty author' do assert_contributor_names '4e873ff', 'Jarek Radosz' end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/credits/canonical_names_test.rb
test/credits/canonical_names_test.rb
require 'test_helper' module Credits class CanonicalNamesTest < ActiveSupport::TestCase include AssertContributorNames test 'タコ焼き仮面' do assert_contributor_names '84403ae', 'Takoyaki Kamen' end test '松田 明' do assert_contributor_names 'bb33432', 'Akira Matsuda' end test '簡煒航' do assert_contributor_names 'c32978d', 'Tony Jian' end test '簡煒航 (Jian Weihang)' do assert_contributor_names '4459576', '簡煒航 (Jian Weihang)' end test '1334' do assert_contributor_names '47d95c8', 'Iñigo Solano Pàez' end test '90yukke' do assert_contributor_names 'b289519', 'Alexander Karmes' end test '_tiii' do assert_contributor_names 'a4b02be', 'Titus Ramczykowski' end test 'Aaron' do assert_contributor_names '1477a61', 'Aaron Eisenberger' end test 'aarongray' do assert_contributor_names 'b30805b', 'Aaron Gray' end test 'abhay' do assert_contributor_names '3353b85', 'Abhay Kumar' end test 'abonec' do assert_contributor_names '20519ef', 'Alexander Baronec' end test 'acapilleri' do assert_contributor_names 'c08c468', 'Angelo Capilleri' end test 'Accessd' do assert_contributor_names 'db25ca7', 'Andrey Morskov' end test 'acechase' do assert_contributor_names '331d9c0', 'Andrew Chase' end test 'Adam' do assert_contributor_names '5dc1f09', 'Adam Magan' end test "adam\100the-kramers.net" do assert_contributor_names '01cfd2b', 'Adam Kramer' end test 'Adam89' do assert_contributor_names '52720b4', 'Adam Magan' end test 'adamj' do assert_contributor_names '4d96ece', 'Adam Johnson' end test "adamm\100galacticasoftware.com" do assert_contributor_names '10a86b2', 'Adam Majer' end test 'adamwiggins' do assert_contributor_names 'ee6b607', 'Adam Wiggins' end test "adelle\100bullet.net.au" do assert_contributor_names '101968f', 'Adelle Hartley' end test 'Aditya' do assert_contributor_names 'd67adf1', 'Aditya Chadha' end test 'aditya-kapoor' do assert_contributor_names '426f42c', 'Aditya Kapoor' end test 'adman65' do assert_contributor_names '7dfa8c0', 'Adam Hawkins' end test 'Adrian' do assert_contributor_names '475bb4b', 'Adrian Marin' end test 'adymo' do assert_contributor_names '9d03813', 'Alexander Dymo' end test 'aeden' do assert_contributor_names 'c9770d8', 'Anthony Eden' end test 'Agis-' do assert_contributor_names '666a248', 'Agis Anastasopoulos' end test 'agius' do assert_contributor_names '1ff67d8', 'Andrew Evans' end test 'aguynamedryan' do assert_contributor_names '4eaa8ba', 'Ryan Duryea' end test 'aiwilliams' do assert_contributor_names 'dd605e9', 'Adam Williams' end test 'akaspick' do assert_contributor_names '0d82b14', 'Andrew Kaspick' end test "akaspick\100gmail.com" do assert_contributor_names 'e30699f', 'Andrew Kaspick' end test 'akhilgkrishnan' do assert_contributor_names 'bf79a4c', 'Akhil G Krishnan' end test 'Akshay' do assert_contributor_names '4d62704', 'Akshay Mohite' end test 'Akshat Sharma' do assert_contributor_names '2438a1c', 'Pramod Sharma' end test 'alancfrancis' do assert_contributor_names '0b45b89', 'Alan Francis' end test "alancfrancis\100gmail.com" do assert_contributor_names 'dfd0bdf', 'Alan Francis' end test 'Alan Tan' do assert_contributor_names 'c9430db', 'Guo Xiang Tan' end test 'Alan Guo Xiang Tan' do assert_contributor_names 'e6da3eb', 'Guo Xiang Tan' end test 'Alberto Almagro Sotelo' do assert_contributor_names '5c62bd5', 'Gannon McGibbon', 'Alberto Almagro' end test 'Aleksandr Koss' do assert_contributor_names 'b7bdacf', 'Sasha Koss' end test 'Aleksey Kondratenko' do assert_contributor_names 'a9113b8', 'Aliaksey Kandratsenka' end test "alex.borovsky\100gmail.com" do assert_contributor_names 'f1a01c8', 'Alexander Borovsky' end test "alex\100byzantine.no" do assert_contributor_names 'ad63c96', 'Alexander Staubo' end test "alex\100msgpad.com" do assert_contributor_names '4277568', 'Alex Pooley' end test "alex\100purefiction.net" do assert_contributor_names 'd016d9a', 'Alexander Staubo' end test 'Alexander' do assert_contributor_names 'bdcc271', 'Alexander Baronec' assert_contributor_names '9e39dc4', 'Alexander Baronec' assert_contributor_names '7c643d9', 'Alexander Quine' assert_contributor_names 'ca6a12d', 'Dembskiy Alexander' end test 'alexbel' do assert_contributor_names '6aaf4bf', 'Alexander Belaev' end test 'alexch' do assert_contributor_names '2559feb', 'Alex Chaffee' end test 'Alexey' do assert_contributor_names 'd336ca5', 'Alexey Zatsepin' end test 'alexey' do assert_contributor_names '52fe604', 'Alexey Zatsepin' end test 'Alexey Markov' do assert_contributor_names '0c85705', 'Markov Alexey' end test "alexkwolfe\100gmail.com" do assert_contributor_names 'b5c2366', 'Alex Wolfe' end test 'alfa-jpn' do assert_contributor_names '9bd4386', 'Atsushi Nakamura' end test 'alimi' do assert_contributor_names '6b5df90', 'Ali Ibrahim' end test 'alkesh26' do assert_contributor_names '393566c', 'Alkesh Ghorpade' end test 'alkeshghorpade' do assert_contributor_names 'aed448c', 'Alkesh Ghorpade' end test "alles\100atomicobject.com" do assert_contributor_names '68dfe3e', 'Micah Alles' end test 'alloy' do assert_contributor_names '4d1c87a', 'Eloy Duran' end test 'ambethia' do assert_contributor_names '18c663e', 'Jason L Perry' end test 'amishyn' do assert_contributor_names 'e32149a', 'Alex Mishyn' end test 'amitkumarsuroliya' do assert_contributor_names '44e94a3', 'Amit Kumar Suroliya' end test 'anamba' do assert_contributor_names '6ccbef5', 'Aaron Namba' end test 'Anand' do assert_contributor_names '25f60cc', 'Anand Muthukrishnan' end test 'Anatoly Makarevich' do assert_contributor_names 'fce0d08', 'Anatoli Makarevich' end test 'andrea longhi' do assert_contributor_names 'd7f0e43', 'Andrea Longhi' end test 'Andrew' do assert_contributor_names '3d6ed50', 'Andrew Chase' end test "andrew.john.peters\100gmail.com" do assert_contributor_names '03097d3', 'Andrew Peters' end test "andrew\100redlinesoftware.com" do assert_contributor_names 'd3cf2a6', 'Andrew Kaspick' end test "andrew.novoselac\100shopify.com" do assert_contributor_names '0b8e083', "Andrew Novoselac" end test "andrey.nering\100gmail.com" do assert_contributor_names '6d59473', 'Andrey Nering' end test "andy\100tinnedfruit.org" do assert_contributor_names 'ab7c7a8', 'Andrew A. Smith' end test "andylien\100gmail.com" do assert_contributor_names '35240ba', 'Andy Lien' end test 'Angelo capilleri' do assert_contributor_names 'b97e0a1', 'Angelo Capilleri' end test 'angelo giovanni capilleri' do assert_contributor_names '64af96b', 'Angelo Capilleri' end test 'anilmaurya' do assert_contributor_names '41722dd', 'Anil Kumar Maurya' end test 'Ankit Gupta-FIR' do assert_contributor_names '6a71d09', 'Ankit Gupta' end test 'ankit1910' do assert_contributor_names '3900671', 'Ankit Bansal' end test 'ankit8898' do assert_contributor_names '46a0eac', 'Ankit Gupta' end test 'Ankit gupta' do assert_contributor_names '72c5b5', 'Ankit Gupta' end test 'anna' do assert_contributor_names '9326222', 'maiha' end test "anna\100wota.jp" do assert_contributor_names 'e72ff35', 'maiha' end test 'AnnaErshova' do assert_contributor_names '0166adc', 'Anna Ershova' end test 'anshkakashi' do assert_contributor_names 'ab09984', 'Jason Ketterman' end test 'Anthony' do assert_contributor_names '78f5874', 'Anthony Alberto' end test 'anthonynavarre' do assert_contributor_names 'bdc5141', 'Anthony Navarre' end test 'Anton' do assert_contributor_names 'f0ae503', 'Tõnis Simo' end test 'Antonio Tapiador' do assert_contributor_names '5dd80db', 'Antonio Tapiador del Dujo' end test 'antramm' do assert_contributor_names '083b0b7', 'Ant Ramm' end test 'anuj dutta' do assert_contributor_names 'd572bf9', 'Anuj Dutta' end test 'aquajach' do assert_contributor_names 'c0eb542', 'aquajach' end test 'ara.t.howard' do assert_contributor_names '99c08c7', 'Ara T Howard' end test "arc\100uchicago.edu" do assert_contributor_names '5177333', 'Shu-yu Guo' end test 'ariabov' do assert_contributor_names '34a3d42', 'Alex Riabov' end test 'ariejan' do assert_contributor_names '388e5d3', 'Ariejan de Vroom' end test 'arktisklada' do assert_contributor_names 'd8bd9cf', 'Clayton Liggitt' end test 'Arsen7' do assert_contributor_names 'f756bfb', 'Mariusz Pękala' end test 'artemave' do assert_contributor_names '6c5a3bb', 'Artem Avetisyan' end test 'artemk' do assert_contributor_names 'b386951', 'Artem Kramarenko' end test 'Arthur Nogueira Neves' do assert_contributor_names '5772ffe', 'Arthur Neves' end test 'arthurgeek' do assert_contributor_names '6ddde02', 'Arthur Zapparoli' end test 'arton' do assert_contributor_names 'c11e78c', 'Akio Tajima' end test 'arvida' do assert_contributor_names '2a7230a', 'Arvid Andersson' end test 'arvind' do assert_contributor_names 'dad0c26', 'Arvind Mehra' end test 'Ashe Connor' do assert_contributor_names '8f5f2bf', 'Asherah Connor' end test "ask\100develooper.com" do assert_contributor_names '17ef706', 'Ask Bjørn Hansen' end test 'asmega' do assert_contributor_names '61fa600', 'Phil Lee' end test 'Assaf' do assert_contributor_names '87ef365', 'Assaf Arkin' end test "assaf.arkin\100gmail.com" do assert_contributor_names '3142502', 'Assaf Arkin' end test 'athonlab' do assert_contributor_names 'ce2eadb', 'AthonLab' end test "augustz\100augustz.com" do assert_contributor_names '3d99d33', 'August Zajonc' end test 'AvnerCohen' do assert_contributor_names 'd20a529', 'Avner Cohen' end test 'awilliams' do assert_contributor_names 'b045b5c', 'Adam Williams' end test 'Ayose' do assert_contributor_names '6ad8f6e', 'Ayose Cazorla' end test 'Azzurrio' do assert_contributor_names '80e8259', 'Karim El-Husseiny' end test "babie7a0\100ybb.ne.jp" do assert_contributor_names '9ded584', 'Michiaki Baba' end test 'backspace' do assert_contributor_names '3b795c1', 'Ken Gerrard' end test 'bagwanpankaj' do assert_contributor_names 'c424fb2', 'Bagwan Pankaj' end test 'Bart' do assert_contributor_names 'c2f59f3', 'Bart de Water' end test 'Bas Van Klinkenberg' do assert_contributor_names 'b99914c', 'Bas van Klinkenberg' end test 'Ben A. Morgan' do assert_contributor_names 'bee4c8f', 'Ben A. Morgan' end test 'bastilian' do assert_contributor_names '071f48b', 'Sebastian Graessl' end test 'beerlington' do assert_contributor_names '3da275c', 'Pete Brown' end test "bellis\100deepthought.org" do assert_contributor_names 'dc87eba', 'Brad Ellis' end test "ben\100bensinclair.com" do assert_contributor_names '1d9905a', 'Ben Sinclair' end test "ben\100groovie.org" do assert_contributor_names 'b9c79f1', 'Ben Bangert' end test 'benedikt' do assert_contributor_names 'b17fd25', 'Benedikt Deicke' end test 'Benjamin Klotz' do assert_contributor_names 'd5847f4', 'Benny Klotz' end test "benji\100silverinsanity.com" do assert_contributor_names 'd08f838', 'Brian Gernhardt' end test 'benmmurphy' do assert_contributor_names 'c8168a7', 'Ben Murphy' end test 'benolee' do assert_contributor_names '008023c', 'Ben Holley' end test 'bermi' do assert_contributor_names '6ca789b', 'Bermi Ferrer' end test 'BertG' do assert_contributor_names '06afb8c', 'Bert Goethals' end test 'bgipsy' do assert_contributor_names '88f2284', 'Serge Balyuk' end test 'bgreenlee' do assert_contributor_names '083b0b7', 'Brad Greenlee' end test 'bitsweat' do assert_contributor_names '253a2bb', 'Jeremy Daer' end test 'Blaine' do assert_contributor_names 'f5977b2', 'Blaine Cook' end test 'blaine' do assert_contributor_names '7d517a1', 'Blaine Cook' end test "blaine\100odeo.com" do assert_contributor_names 'bf3f920', 'Blaine Cook' end test "blair\100orcaware.com" do assert_contributor_names '46796e7', 'Blair Zajac' end test "blake\100near-time.com" do assert_contributor_names '604eb8a', 'Blake Watters' end test 'BlueHotDog' do assert_contributor_names '8642c2a', 'Danni Friedland' end test 'BMorearty' do assert_contributor_names '436da68', 'Brian Morearty' end test "bob\100sporkmonger.com" do assert_contributor_names 'ce458a7', 'Bob Aman' end test 'bobbus' do assert_contributor_names '7ded3b8', 'Adrien Coquio' end test 'BobSilva' do assert_contributor_names '0c94868', 'Bob Silva' end test 'Bodacious' do assert_contributor_names '39b9c94', 'Gavin Morrice' end test 'bogdan' do assert_contributor_names 'b644964', 'Bogdan Gusiev' end test 'Bogdan' do assert_contributor_names '2686130', 'bogdanvlviv' end test 'boone' do assert_contributor_names '3486d54', 'Mike Boone' end test 'Bounga' do assert_contributor_names '39de84d', 'Nicolas Cavigneaux' end test "brad\100madriska.com" do assert_contributor_names '785e1fa5', 'Brad Ediger' end test 'bradediger' do assert_contributor_names '6c77370', 'Brad Ediger' end test 'bradrobertson' do assert_contributor_names '0252376', 'Brad Robertson' end test 'brainopia' do assert_contributor_names 'da82b0a', 'Ravil Bayramgalin' end test 'brandon' do assert_contributor_names '35ffc1a', 'Brandon Keepers' end test "brandon\100opensoul.org" do assert_contributor_names 'fe4d5ea', 'Brandon Keepers' end test "brandt\100kurowski.net" do assert_contributor_names '6d7175d', 'Brandt Kurowski' end test 'brendan' do assert_contributor_names '88f2284', 'Brendan Baldwin' end test "brianegge\100yahoo.com" do assert_contributor_names 'a092749', 'Brian Egge' end test 'brianp' do assert_contributor_names '50a7391', 'Brian Pearce' end test 'bronson' do assert_contributor_names 'cb1f569', 'Scott Bronson' end test 'brupm' do assert_contributor_names '4e7d332', 'Bruno Miranda' end test 'brynary' do assert_contributor_names '5dc831f', 'Bryan Helmkamp' end test 'bscofield' do assert_contributor_names '81991d6', 'Ben Scofield' end test 'buddhamagnet' do assert_contributor_names 'a85729c', 'Dave Goodchild' end test 'c.r.mcgrath' do assert_contributor_names '838ae35', 'Chris McGrath' end test 'chaadow' do assert_contributor_names 'a5e1fc97d2', 'Chedli Bourguiba' end test "c.r.mcgrath\100gmail.com" do assert_contributor_names '6a51940', 'Chris McGrath' end test 'caio' do assert_contributor_names 'c089974', 'Caio Chassot' end test 'calavera' do assert_contributor_names '4196616', 'David Calavera' end test 'Caleb' do assert_contributor_names '5fa8793', 'Caleb Buxton', 'Tobias Lütke' end test "caleb\100aei-tech.com" do assert_contributor_names 'd5b67ed8', 'Caleb Tennis' end test 'Caleb Thompson' do assert_contributor_names '17136c20', 'Caleb Hearth' assert_contributor_names '382a70c8', 'Caleb Hearth' assert_contributor_names '75f3584d', 'Caleb Hearth' assert_contributor_names 'd5867a01', 'Caleb Hearth' assert_contributor_names '3d3fd39c', 'Caleb Hearth' end test 'canadaduane' do assert_contributor_names 'cab2494', 'Duane Johnson' end test 'careo' do assert_contributor_names '50ee332', 'Dane Jensen' end test 'Carlhuda' do assert_contributor_names 'c102db9', 'Yehuda Katz', 'Carl Lerche' end test 'CassioMarques' do assert_contributor_names '053afbe', 'Cássio Marques' end test 'Catfish' do assert_contributor_names '9679cb4', 'Jonathan del Strother' end test 'catfish' do assert_contributor_names 'eff27ab', 'Jonathan del Strother' end test 'cavalle' do assert_contributor_names 'b96db52', 'Luismi Cavallé' end test 'cavelle' do assert_contributor_names '9e45586', 'Luismi Cavallé' end test 'cch1' do assert_contributor_names '569a78c', 'Chris Hapgood' end test 'cczona' do assert_contributor_names '6ee8e92', 'Carina C. Zona' end test "cdcarter\100gmail.com" do assert_contributor_names '2139921', 'Chris Carter' end test 'Cédric FABIANSKI' do assert_contributor_names '9f54921', 'Cédric Fabianski' end test 'ceefour' do assert_contributor_names '7e33de4', 'Hendy Irawan' end test 'ch33hau' do assert_contributor_names 'ac85125', 'Lim Chee Hau' end test 'chaitanyav' do assert_contributor_names '449cf50', 'Chaitanya Vellanki' end test "charles.gerungan\100gmail.com" do assert_contributor_names '3c0e7b1', 'Charles M. Gerungan' end test 'chas' do assert_contributor_names '6f63287', 'Chas Grundy' end test 'chocoby' do assert_contributor_names '04907b6', 'Kenta Okamoto' end test 'choonkeat' do assert_contributor_names '099c206', 'Choon Keat' end test "choonkeat\100gmail.com" do assert_contributor_names '89840c4', 'Choon Keat' end test "chris\100chrisbrinker.com" do assert_contributor_names 'a685579', 'Chris Brinker' end test 'chris finne' do assert_contributor_names 'b80fa81', 'Chris Finne' end test "chris\100octopod.info" do assert_contributor_names '3c0e7b1', 'Chris McGrath' end test "chris\100ozmm.org" do assert_contributor_names '11c715a', 'Chris Wanstrath' end test "chris\100seagul.co.uk" do assert_contributor_names '760bcc6', 'Chris Roos' end test 'chrisfinne' do assert_contributor_names '76d2c45', 'Chris Finne' end test 'chrisk' do assert_contributor_names '19a1586', 'Chris Kampmeier' end test 'chriskohlbrenner' do assert_contributor_names '2ec51d0', 'Chris Kohlbrenner' end test 'chrismear' do assert_contributor_names 'afd288c', 'Chris Mear' end test 'chrisroos' do assert_contributor_names '50253ed', 'Chris Roos' end test "chriztian.steinmeier\100gmail.com" do assert_contributor_names 'd40af24', 'Chriztian Steinmeier' end test 'Chu Yeow' do assert_contributor_names 'dc3e55d', 'Cheah Chu Yeow' end test 'chuyeow' do assert_contributor_names '56e6462', 'Cheah Chu Yeow' end test 'ciastek' do assert_contributor_names '2bcfdec', 'Sebastian Spieszko' end test 'cjheath' do assert_contributor_names '12d8d48', 'Clifford Heath' end test 'Claudio B' do assert_contributor_names '0b0042c', 'Claudio Baccigalupo' end test 'Claudio B.' do assert_contributor_names '2651810', 'Claudio Baccigalupo' end test 'claudiob' do assert_contributor_names '0e56c1d', 'Claudio Baccigalupo' end test 'claudiofullscreen' do assert_contributor_names '0b725aa', 'Claudio Baccigalupo' end test 'cluon' do assert_contributor_names 'deda0ee', 'Phil Orwig' end test 'cnaize' do assert_contributor_names 'bf15169', 'Nikita Loskutov' end test 'codafoo' do assert_contributor_names 'be827f9', 'Cesar Ho' end test 'codahale' do assert_contributor_names '4aabe46', 'Coda Hale' end test 'codeape' do assert_contributor_names '9a42096', 'Dan Cheail' end test 'codebrulee' do assert_contributor_names 'ebe8dd6', 'Kevin Smith' end test 'codesnik' do assert_contributor_names '96d4da1', 'Alexey Trofimenko' end test "codyfauser\100gmail.com" do assert_contributor_names 'f49ba11', 'Cody Fauser' end test 'coffee2code' do assert_contributor_names 'ab9f324', 'Scott Reilly' end test "cohen.jeff\100gmail.com" do assert_contributor_names 'e57bd72', 'Jeff Cohen' end test "colman\100rominato.com" do assert_contributor_names 'b762e01', 'Colman Nady' end test "contact\100lukeredpath.co.uk" do assert_contributor_names 'e9d4b36', 'Luke Redpath' end test "contact\100maik-schmidt.de" do assert_contributor_names '2d24bed', 'Maik Schmidt' end test 'coreyhaines' do assert_contributor_names 'df755d4', 'Corey Haines' end test 'Cory Gwin' do assert_contributor_names '31021c7', 'Cory Gwin' end test 'court3nay' do assert_contributor_names '891a962', 'Courtenay Gasking' end test 'Court3nay' do assert_contributor_names 'ee87dbe', 'Courtenay Gasking' end test "court3nay\100gmail.com" do assert_contributor_names 'df97ed5', 'Courtenay Gasking' end test 'courtenay' do assert_contributor_names '14e7c7c', 'Courtenay Gasking' end test 'cpytel' do assert_contributor_names 'f254616', 'Chad Pytel' end test 'Cristi BALAN' do assert_contributor_names '6d566e8', 'Cristi Balan' end test 'ctm' do assert_contributor_names 'c26cca3', 'Clifford T. Matthews' end test 'cyu' do assert_contributor_names '2b68762', 'Calvin Yu' end test 'dacat' do assert_contributor_names 'f854ecd', 'Felix Dominguez' end test 'dancroak' do assert_contributor_names '569a78c', 'Dan Croak' end test 'danger' do assert_contributor_names '1dd0034', 'Jack Danger Canty' end test 'Danger' do assert_contributor_names '2c6e616', 'Jack Danger Canty' end test 'Daniel Burnette' do assert_contributor_names 'b93ae0c', 'Daniel Burnette' end test "daniel\100nightrunner.com" do assert_contributor_names 'ba309a3', 'Daniel Hobe' end test "daniel\100nouvelles-solutions.com" do assert_contributor_names '1671609', 'Daniel Wanja' end test 'danielc192' do assert_contributor_names '0fc481d', 'Daniel Cohen' end test 'danielmorrison' do assert_contributor_names 'cb5b8a7', 'Daniel Morrison' end test "daniels\100pronto.com.au" do assert_contributor_names '6a1a1e5', 'Daniel Sheppard' end test "daniluk\100yahoo.com" do assert_contributor_names 'c99df46', 'Grzegorz Daniluk' end test "dansketcher\100gmail.com" do assert_contributor_names 'fb619127', 'Dan Sketcher' end test "darashi\100gmail.com" do assert_contributor_names '17d2732', 'Yoji Shidara' end test 'dasil003' do assert_contributor_names '2a07886', 'Gabe da Silveira' end test "dave\100cherryville.org" do assert_contributor_names 'b66b1ff', 'Dave Lee' end test "dave-ml\100dribin.org" do assert_contributor_names '2fe8610', 'Dave Dribin' end test "dave\100pragprog.com" do assert_contributor_names 'c80c636', 'Dave Thomas' end test 'davetoxa' do assert_contributor_names 'cc585c8', 'Anton Cherepanov' end test 'david.calavera' do assert_contributor_names '7e1c04d', 'David Calavera' end test "david.felstead\100gmail.com" do assert_contributor_names '8dda7c5', 'David Felstead' end test 'David FRANCOIS' do assert_contributor_names '18aa1ae', 'David François' end test 'DAVID MOORE' do assert_contributor_names '4c945cc', 'Dave Moore' end test "david\100ruppconsulting.com" do assert_contributor_names 'c4a3634', 'David Rupp' end test 'davidauza-engineer' do assert_contributor_names 'e3d496a', 'David Auza' end test 'davidjrice' do assert_contributor_names '82a85e8', 'David Rice' end test 'davidw' do assert_contributor_names '1f80296', 'David N. Welton' end test 'DawidJanczak' do assert_contributor_names '89a8143', 'Dawid Janczak' end test 'Dawnthorn' do assert_contributor_names 'f999ab0', 'Peter Haight' end test 'dblack' do assert_contributor_names '11a5492', 'David A. Black' end test "dblack\100wobblini.net" do assert_contributor_names '91247b6', 'David A. Black' end test 'dbussink' do assert_contributor_names '78727dd', 'Dirkjan Bussink' end test 'dchelimsky' do assert_contributor_names '42ebf55', 'David Chelimsky' end test 'dcmanges' do assert_contributor_names '16fde4c', 'Dan Manges' end test 'dcurtis' do assert_contributor_names '248fa70', 'Dustin Curtis' end test 'ddemaree' do assert_contributor_names 'f90160c', 'David Demaree' end test 'ddollar' do assert_contributor_names '8ff9e93', 'David Dollar' end test 'Dee.Zsombor' do assert_contributor_names '2bf2230', 'Dee Zsombor' end test "Dee.Zsombor\100gmail.com" do assert_contributor_names '26022d8', 'Dee Zsombor' end test 'deepblue' do assert_contributor_names '2a34e08', 'Bryan Kang' end test 'defeated' do assert_contributor_names 'dcaa074', 'Eddie Cianci' end test 'defunkt' do assert_contributor_names '49cb412', 'Chris Wanstrath' end test 'DefV' do assert_contributor_names 'c71de03', 'Jan De Poorter' end test "deirdre\100deirdre.net" do assert_contributor_names '9105cd1', 'Deirdre Saoirse' end test 'DeLynn' do assert_contributor_names 'aa09c77', 'DeLynn Berry' end test 'DeLynn B' do assert_contributor_names '6cd3bda', 'DeLynn Berry' end test 'DeLynn Barry' do assert_contributor_names 'f2e6945', 'DeLynn Berry' end test 'delynnb' do assert_contributor_names '665ab93', 'DeLynn Berry' end test 'DelynnB' do assert_contributor_names 'ba96827', 'DeLynn Berry' end test 'DeLynnB' do assert_contributor_names 'ed46cc3', 'DeLynn Berry' end test 'demetrius' do assert_contributor_names 'ec6f0a1', 'Demetrius Nunes' end test 'Demetrius' do assert_contributor_names '93ec130', 'Demetrius Nunes' end test "derrickspell\100cdmplus.com" do assert_contributor_names '416385a', 'Derrick Spell' end test "dev\100metacasa.net" do assert_contributor_names '9a5b91a', 'John Sheets' end test 'Developer' do assert_contributor_names '179b451', 'John Pignata' end test 'Dmitriy Budnik' do assert_contributor_names 'a209652', 'Dmitriy Budnik' end test 'devrieda' do assert_contributor_names '45d679b', 'Derek DeVries' end test "devslashnull\100gmail.com" do assert_contributor_names '4bd80f1', 'Brian Donovan' end test "dfelstead\100site5.com" do assert_contributor_names '5e5b87b', 'David Felstead' end test 'dfens' do assert_contributor_names 'ab9140f', 'Paweł Mikołajewski' end test 'dharmatech' do assert_contributor_names 'f74a4d8', 'Eduardo Cavazos' end test 'Dima Fatko' do assert_contributor_names '238432d', 'Jorge Manrubia', 'fatkodima' end test 'dixpac' do assert_contributor_names 'c520417', 'Dino Maric' end test 'DHH' do assert_contributor_names 'bd261ff', 'David Heinemeier Hansson' end test 'dhh' do assert_contributor_names 'dd6f3e1', 'David Heinemeier Hansson' end test 'diatmpravin' do assert_contributor_names 'a302597', 'Pravin Mishra' end test 'dickeyxxx' do assert_contributor_names '21586d3', 'Jeff Dickey' end test "dj\100omelia.org" do assert_contributor_names 'f6ec9e3', 'Duff OMelia' end test 'djanowski' do assert_contributor_names '0e6c8e5', 'Damian Janowski' end test 'dkaplan88' do assert_contributor_names 'a0bdf2f', 'Dan Kaplan' end test 'dkubb' do assert_contributor_names '11a92b3', 'Dan Kubb' end test 'dm1try' do assert_contributor_names 'c12024b', 'Dmitry Dedov' end test 'dmathieu' do assert_contributor_names '18bce29', 'Damien Mathieu' end test 'Dmitriy Vorotilin' do assert_contributor_names '705a1d5', 'Dmitry Vorotilin' end test 'Vasin Dmitriy' do assert_contributor_names 'dc8ddea', 'Dmytro Vasin' end test 'doabit' do assert_contributor_names '8094156', 'Sean Dent' end test 'docunext' do assert_contributor_names 'c070cc4', 'Albert Lash' end test "dom\100sisna.com" do assert_contributor_names 'c81af99', 'Dominic Sisneros' end test "don.park\100gmail.com" do assert_contributor_names '2ed6d36', 'Don Park' end test "donald.piret\100synergetek.be" do assert_contributor_names 'd94af9a', 'Donald Piret' end test "doppler\100gmail.com" do assert_contributor_names 'f4f7e75', 'David Rose' end test "dpiddy\100gmail.com" do assert_contributor_names '58f2bd0c', 'Dan Peterson' end test 'dpmehta02' do assert_contributor_names 'b9ead0f', 'Dev Mehta' end test 'Dr Nic' do assert_contributor_names '868e6b0', 'Dr Nic Williams' end test "drbrain\100segment7.net" do assert_contributor_names 'ce0653b', 'Eric Hodel' end test 'Dreamer3' do assert_contributor_names 'c6a1830', 'Josh Goebel' end test "dreamer3\100gmail.com" do assert_contributor_names 'dfa8aa0', 'Josh Goebel' end test 'dreamfall' do assert_contributor_names '7c3a5ec', 'Vasili Kachalko' end test 'Drew' do assert_contributor_names '28a9b65', 'Drew Bragg' end test 'DrMark' do assert_contributor_names '56fec2f', 'Mark Lane' end test 'drnic' do assert_contributor_names '346d36b', 'Dr Nic Williams' end test 'drodriguez' do assert_contributor_names '046a87a', 'Daniel Rodríguez Troitiño' end test 'dtaniwaki' do assert_contributor_names 'c91e1cc', 'Daisuke Taniwaki' end test "duane.johnson\100gmail.com" do assert_contributor_names '0b92d38', 'Duane Johnson' end test "duncan\100whomwah.com" do assert_contributor_names 'fd8ee0a', 'Duncan Robertson' end test 'duncanbeevers' do assert_contributor_names '9f1fdcc', 'Duncan Beevers' end test "dweitzman\100gmail.com" do assert_contributor_names '9ca9f95', 'David Weitzman' end test 'Dylan Smith' do assert_contributor_names 'b4be619', 'Dylan Thacker-Smith' end test "dymo\100mk.ukrtelecom.ua" do assert_contributor_names '6ce3bf7', 'Alexander Dymo' end test 'Eadz' do assert_contributor_names '6a17151', 'Eaden McKee' end test 'eadz' do assert_contributor_names '9b6207c', 'Eaden McKee' end test "easleydp\100gmail.com" do assert_contributor_names 'eede40b', 'David Easley' end test "eddiewould\100paradise.net.nz" do assert_contributor_names '1e7ce13', 'Eddie Stanley' end test 'edibiase' do assert_contributor_names 'cb978ba', 'Evan DiBiase' end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
true
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/support/assert_contributor_names.rb
test/support/assert_contributor_names.rb
require 'set' module AssertContributorNames REPO = Repo.new def assert_contributor_names(sha1, *contributor_names, **options) begin commit = Commit.new_from_rugged_commit(REPO.repo.lookup(sha1)) rescue Rugged::OdbError raise "#{sha1} was not found, please make sure the local Rails checkout is up to date" end expected = contributor_names.to_set actual = commit.extract_contributor_names(REPO).to_set diff = expected - actual error_message = "credit for #{sha1} is #{actual.to_a.to_sentence}, expected #{diff.to_a.to_sentence} to be credited" if options[:equal] assert_equal expected, actual, error_message else assert expected.subset?(actual), error_message end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/integration/bot_killer_test.rb
test/integration/bot_killer_test.rb
require 'test_helper' class BotKillerTest < ActionDispatch::IntegrationTest test 'MauiBot is blacklisted' do get '/', headers: { 'User-Agent' => 'MauiBot (crawler.feedback+wc@gmail.com)' } assert_response :not_found end test 'FAST Enterprise is blacklisted' do get '/', headers: { 'User-Agent' => 'FAST Enterprise Crawler/5.3.4 (crawler@fast.no)' } assert_response :not_found end test 'other user agents are not blacklisted' do get '/', headers: { 'User-Agent' => 'Foo' } assert_response :ok end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/helpers/application_helper_test.rb
test/helpers/application_helper_test.rb
require 'test_helper' class ApplicationHelperTest < ActionView::TestCase include ApplicationHelper def test_github_url_for_sha1 sha1 = 'd4ab03a8f3c1ea8913ed76bb8653dd9bef6a894f' assert_equal "https://github.com/rails/rails/commit/#{sha1}", github_url_for_sha1(sha1) end def test_github_url_for_tag tag = 'v4.2.1' assert_equal "https://github.com/rails/rails/tree/#{tag}", github_url_for_tag(tag) end def test_date assert_equal '07 Mar 2015', date(Time.new(2015, 3, 7)) end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/controllers/commits_controller_test.rb
test/controllers/commits_controller_test.rb
require 'test_helper' class CommitsControllerTest < ActionController::TestCase def test_index_for_releases cases = [ [releases(:v3_2_0), Array(commits(:commit_6c65676, :commit_5b90635))], [releases(:v2_3_2), []], [releases(:v0_14_4), Array(commits(:commit_e0ef631))], ] cases.each do |release, commits| get :index, params: { release_id: release } assert_response :success assert_equal commits, assigns(:commits) label = commits.size == 1 ? 'commit' : 'commits' assert_select 'span.listing-total', "Showing #{commits.size} #{label}" assert_select 'li.current', 'Releases' end end def test_index_for_contributors cases = [ [:david, [:commit_339e4e8, :commit_e0ef631]], [:jeremy, [:commit_b821094, :commit_7cdfd91, :commit_5b90635]], [:jose, [:commit_5b90635]], ].map {|a, b| [contributors(a), Array(commits(*b))]} cases.each do |contributor, commits| get :index, params: { contributor_id: contributor } assert_response :success assert_equal commits, assigns(:commits) label = commits.size == 1 ? 'commit' : 'commits' assert_select 'span.listing-total', "Showing #{commits.size} #{label}" assert_select 'li.current', 'All time' end end def test_commits_in_time_window since = '20121219' date_range = '20121201-20121231' cases = { contributors(:david) => [ ['all-time', Array(commits(:commit_339e4e8, :commit_e0ef631))], ['today', []], ['this-week', []], ['this-year', Array(commits(:commit_339e4e8))], [since, []], [date_range, Array(commits(:commit_339e4e8))], ], contributors(:jeremy) => [ ['all-time', Array(commits(:commit_b821094, :commit_7cdfd91, :commit_5b90635))], ['today', Array(commits(:commit_b821094))], ['this-week', Array(commits(:commit_b821094))], ['this-year', Array(commits(:commit_b821094, :commit_7cdfd91, :commit_5b90635))], [since, Array(commits(:commit_b821094))], [date_range, Array(commits(:commit_b821094))], ], contributors(:vijay) => [ ['all-time', Array(commits(:commit_6c65676))], ['today', []], ['this-week', []], ['this-year', Array(commits(:commit_6c65676))], [since, []], [date_range, []], ], } time_travel do cases.each do |contributor, commits_per_time_window| commits_per_time_window.each do |time_window, commits| get :in_time_window, params: { contributor_id: contributor, time_window: time_window } assert_response :success assert_equal commits, assigns(:commits) label = commits.size == 1 ? 'commit' : 'commits' assert_select 'span.listing-total', "Showing #{commits.size} #{label}" if time_window == since || time_window == date_range assert_select 'li.current', false else assert_select 'li.current', TimeConstraints.label_for(time_window) end end end end end def test_in_release cases = { contributors(:jeremy) => {releases('v3_2_0') => [commits(:commit_5b90635)], contributors(:xavier) => {}}, contributors(:david) => {releases('v0_14_4') => [commits(:commit_e0ef631)]}, } all_releases = Release.all cases.each do |contributor, releases| all_releases.each do |release| commits = releases[release] || [] get :in_release, params: { contributor_id: contributor, release_id: release } assert_response :success assert_equal commits, assigns(:commits) label = commits.size == 1 ? 'commit' : 'commits' assert_select 'span.listing-total', "Showing #{commits.size} #{label}" assert_select 'li.current', 'Releases' end end end def test_in_edge cases = [ [:david, [:commit_339e4e8]], [:jeremy, [:commit_b821094, :commit_7cdfd91]], [:xavier, [:commit_26c024e]], ].map {|a, b| [contributors(a), Array(commits(*b))]} cases.each do |contributor, commits| get :in_edge, params: { contributor_id: contributor } assert_response :success assert_equal commits, assigns(:commits) label = commits.size == 1 ? 'commit' : 'commits' assert_select 'span.listing-total', "Showing #{commits.size} #{label}" assert_select 'li.current', 'Edge' end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/controllers/releases_controller_test.rb
test/controllers/releases_controller_test.rb
require 'test_helper' class ReleasesControllerTest < ActionController::TestCase def test_index get :index assert_response :success assert_select 'span.listing-total', 'Showing 5 releases' expected = %w( v3_2_0 v2_3_2_1 v2_3_2 v1_0_0 v0_14_4 ).map {|_| releases(_)} actual = assigns(:releases) assert_equal expected.size, actual.size expected.zip(assigns(:releases)).each do |e, a| assert_equal e.tag, a.tag assert_equal e.commits.count, a.ncommits assert_equal e.contributors.count, a.ncontributors end assert_select 'span.listing-total', 'Showing 5 releases' assert_select 'li.current', 'Releases' end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/controllers/contributors_controller_test.rb
test/controllers/contributors_controller_test.rb
require 'test_helper' class ContributorsControllerTest < ActionController::TestCase def test_index_main_listing # Order by ncommits DESC, url_id ASC. expected = [[:jeremy, 3], [:david, 2], [:jose, 1], [:vijay, 1], [:xavier, 1]] get :index assert_response :success actual = assigns(:contributors) assert_equal expected.size, actual.size expected.zip(actual).each do |e, a| assert_equal contributors(e.first).name, a.name assert_equal e.second, a.ncommits end end def test_index_by_release releases = { 'v3.2.0' => [[:jeremy, 1], [:jose, 1], [:vijay, 1]], 'v0.14.4' => [[:david, 1]] } Release.all.each do |release| get :index, params: { release_id: release } assert_response :success actual = assigns(:contributors) if expected = releases[release.tag] assert_equal expected.size, actual.size expected.zip(actual) do |e, a| assert_equal contributors(e.first).name, a.name assert_equal e.second, a.ncommits end else assert_equal [], actual end end end def test_in_time_window since = '20121219' date_range = '20121201-20121231' time_windows = { 'all-time' => [[:jeremy, 3], [:david, 2], [:jose, 1], [:vijay, 1], [:xavier, 1]], 'today' => [[:jeremy, 1]], 'this-week' => [[:jeremy, 1], [:xavier, 1]], 'this-month' => [[:david, 1], [:jeremy, 1], [:xavier, 1]], 'this-year' => [[:jeremy, 3], [:david, 1], [:jose, 1], [:vijay, 1], [:xavier, 1]], since => [[:jeremy, 1], [:xavier, 1]], date_range => [[:david, 1], [:jeremy, 1], [:xavier, 1]], } time_travel do time_windows.each do |time_window, expected| get :in_time_window, params: { time_window: time_window } assert_response :success actual = assigns(:contributors) assert_equal expected.size, actual.size expected.zip(actual).each do |e, a| assert_equal contributors(e.first).name, a.name assert_equal e.second, a.ncommits end end end end def test_in_edge # Order by ncommits DESC, url_id ASC. expected = [[:jeremy, 2], [:david, 1], [:xavier, 1]] get :in_edge assert_response :success actual = assigns(:contributors) assert_equal expected.size, actual.size expected.zip(actual).each do |e, a| assert_equal contributors(e.first).name, a.name assert_equal e.second, a.ncommits end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/models/time_constraints_test.rb
test/models/time_constraints_test.rb
require 'test_helper' class TimeConstraintsTest < ActiveSupport::TestCase def assert_time_window(actual, since = nil, upto = nil) [[since, :since], [upto, :upto]].each do |expected, key| # Written this way because assert_equal(nil, nil) fails in MT6. if expected.nil? assert_nil actual[key] else assert_equal expected, actual[key] end end end def test_label_for_returns_a_label_for_a_valid_time_window assert_equal 'All time', TimeConstraints.label_for('all-time') assert_equal 'Date Range', TimeConstraints.label_for('20150101') assert_equal 'Date Range', TimeConstraints.label_for('20150101-20150318') end def test_valid_time_window_returns_true_for_valid_time_windows assert TimeConstraints.valid_time_window?('all-time') assert TimeConstraints.valid_time_window?('20150101') assert TimeConstraints.valid_time_window?('20150101-20150318') end def test_valid_time_window_returns_false_for_invalid_time_windows assert !TimeConstraints.valid_time_window?('unknown-key') end def test_time_window_for_returns_an_empty_array_for_all_time assert_time_window TimeConstraints.time_window_for('all-time') end def test_time_window_for_returns_today_for_today time_travel do assert_time_window TimeConstraints.time_window_for('today'), TODAY end end def test_time_window_for_returns_beginning_of_week_for_this_week time_travel do assert_time_window TimeConstraints.time_window_for('this-week'), Time.zone.parse('2012-12-24') end end def test_time_window_for_returns_beginning_of_month_for_this_month time_travel do assert_time_window TimeConstraints.time_window_for('this-month'), Time.zone.parse('2012-12-01') end end def test_time_window_for_returns_beginning_of_year_for_this_year time_travel do assert_time_window TimeConstraints.time_window_for('this-year'), Time.zone.parse('2012-01-01') end end def test_time_window_for_parses_dates assert_time_window TimeConstraints.time_window_for('20180318'), Time.zone.parse('2018-03-18') end def test_time_window_for_parses_timestamps assert_time_window TimeConstraints.time_window_for('201803181721'), Time.zone.parse('2018-03-18 17:21') end def test_time_window_for_parses_date_ranges assert_time_window TimeConstraints.time_window_for('20180318-20150319'), Time.zone.parse('2018-03-18'), Time.zone.parse('2015-03-19').end_of_day end def test_time_window_for_parses_timestamp_ranges assert_time_window TimeConstraints.time_window_for('201803181721-201503191807'), Time.zone.parse('2018-03-18 17:21'), Time.zone.parse('2015-03-19 18:07') end def test_time_window_for_parses_mixed_ranges assert_time_window TimeConstraints.time_window_for('20180318-201503191807'), Time.zone.parse('2018-03-18 00:00'), Time.zone.parse('2015-03-19 18:07') assert_time_window TimeConstraints.time_window_for('201803181721-20150319'), Time.zone.parse('2018-03-18 17:21'), Time.zone.parse('2015-03-19').end_of_day end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/models/names_manager_test.rb
test/models/names_manager_test.rb
# The names manager has no unit tests. # # In general, the application does not care about the exact methods used to # give credit to contributors. Rather, we want to make sure a selected number # of commits get their credit right. # # Please check the test/credits directory for integration coverage.
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/models/contributor_test.rb
test/models/contributor_test.rb
require 'test_helper' require 'set' class ContributorTest < ActiveSupport::TestCase def test_the_name_writer_sets_url_id c = Contributor.new(name: 'Jeremy Daer') assert_equal 'jeremy-daer', c.url_id end def test_to_param_returns_the_url_id c = contributors(:jeremy) assert_equal c.url_id, c.to_param end def test_find_by_param c = contributors(:jeremy) assert_equal c, Contributor.find_by_param(c.to_param) end def test_with_no_commits jeremy = contributors(:jeremy) xavier = contributors(:xavier) jeremy.contributions.delete_all xavier.contributions.delete_all assert_equal [jeremy, xavier].to_set, Contributor.with_no_commits.to_set end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/models/parameterize_test.rb
test/models/parameterize_test.rb
# encoding: utf-8 require 'test_helper' class ParameterizeTest < ActiveSupport::TestCase test "normalizes special cases" do assert_equal 'sorensen', 'Sørensen'.parameterize assert_equal 'weierstrass', 'Weierstraß'.parameterize end test "delegates normalization of accented letters and friends" do assert_equal 'barca', 'Barça'.parameterize assert_equal 'campio', 'CAMPIÓ'.parameterize end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/models/repo_test.rb
test/models/repo_test.rb
require 'test_helper' class RepoTest < ActiveSupport::TestCase test '#sync_ranks' do Repo.new.send(:sync_ranks) {jeremy: 1, david: 2, jose: 3, xavier: 3, vijay: 3}.each do |c, r| assert_equal r, contributors(c).rank end end test '#sync_first_contributed_timestamps' do Contributor.update_all(first_contribution_at: nil) Repo.new.send(:sync_first_contribution_timestamps) assert_first_contribution :commit_e0ef631, :david assert_first_contribution :commit_5b90635, :jeremy assert_first_contribution :commit_5b90635, :jose assert_first_contribution :commit_26c024e, :xavier assert_first_contribution :commit_6c65676, :vijay end test '#sync_first_contributed_timestamps rebuilding all' do Contributor.update_all( first_contribution_at: Commit.minimum(:committer_date) - 1.year ) Repo.new(rebuild_all: true).send(:sync_first_contribution_timestamps) assert_first_contribution :commit_e0ef631, :david assert_first_contribution :commit_5b90635, :jeremy assert_first_contribution :commit_5b90635, :jose assert_first_contribution :commit_26c024e, :xavier assert_first_contribution :commit_6c65676, :vijay end def assert_first_contribution(commit, contributor) expected = commits(commit).committer_date actual = contributors(contributor).first_contribution_at assert_equal expected, actual end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/models/release_test.rb
test/models/release_test.rb
require 'test_helper' require 'set' class ReleaseTest < ActiveSupport::TestCase def check_version_split(tag, major=0, minor=0, tiny=0, patch=0) r = Release.new(tag: tag) assert_equal major, r.major assert_equal minor, r.minor assert_equal tiny, r.tiny assert_equal patch, r.patch end def ordered_releases %w( v3_2_0 v2_3_2_1 v2_3_2 v1_0_0 v0_14_4 ).map {|tag| releases(tag)} end def test_the_tag_writer_splits_the_version check_version_split('v4', 4) check_version_split('v3.2', 3, 2) check_version_split('v3.2.0', 3, 2, 0) check_version_split('v3.2.1', 3, 2, 1) check_version_split('v2.3.2.1', 2, 3, 2, 1) end def test_name assert_equal '3.2.0', releases(:v3_2_0).name end def test_to_param assert_equal '3-2-0', releases(:v3_2_0).to_param assert_equal '2-3-2-1', releases(:v2_3_2_1).to_param end def test_find_by_param r = releases(:v3_2_0) assert_equal r, Release.find_by_param(r.to_param) end def test_github_url assert_equal 'https://github.com/rails/rails/tree/v3.2.0', releases(:v3_2_0).github_url end def test_the_date_writer_corrects_the_date_if_needed date = DateTime.new(2011, 8, 30, 18, 58, 35) r = Release.new(tag: 'v3.1.0', date: date) assert_equal date, r.date date = DateTime.new(2005, 12, 13) r = Release.new(tag: 'v1.0.0', date: DateTime.current) assert_equal date, r.date end def test_spaceship_operator ordered_releases.each_cons(2) do |r, t| assert r > t end end def test_prev ordered_releases.each_cons(2) do |r, t| assert_equal t, r.prev end end def test_associate_commits Commit.update_all(release_id: nil) release = releases('v3_2_0') commits = [commits('commit_b821094'), commits('commit_339e4e8'), commits('commit_6c65676')] sha1s = commits.map(&:sha1) release.associate_commits(sha1s) assert_equal sha1s.to_set, release.commits.pluck(:sha1).to_set end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/models/nfc_attribute_normalizer_test.rb
test/models/nfc_attribute_normalizer_test.rb
require 'test_helper' class NFCAttributeNormalizerTest < ActiveSupport::TestCase A_GRAVE_NFC = "\u00c0" A_GRAVE_NON_NFC = "\u0041\u0300" NON_VALID = "\xa9" NORMALIZER = Class.new do extend NFCAttributeNormalizer nfc :title, :body def initialize @values = {} end def write_attribute(name, value) @values[name] = value end def read_attribute(name) @values[name] end end def setup @model = NORMALIZER.new end def test_normalizes_non_normalized_attributes @model.title = A_GRAVE_NON_NFC assert_equal A_GRAVE_NFC, @model.read_attribute(:title) @model.body = A_GRAVE_NON_NFC assert_equal A_GRAVE_NFC, @model.read_attribute(:body) end def test_normalizes_normalized_attributes @model.title = A_GRAVE_NFC assert_equal A_GRAVE_NFC, @model.read_attribute(:title) @model.body = A_GRAVE_NFC assert_equal A_GRAVE_NFC, @model.read_attribute(:body) end def test_ignores_nil @model.title = nil assert_nil @model.read_attribute(:title) @model.body = nil assert_nil @model.read_attribute(:body) end def test_scrubs assert !NON_VALID.valid_encoding? @model.title = NON_VALID assert_equal '�', @model.read_attribute(:title) assert @model.read_attribute(:title).valid_encoding? end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/test/models/commit_test.rb
test/models/commit_test.rb
# frozen-string-literal: true require 'test_helper' require 'ostruct' class CommitTest < ActiveSupport::TestCase def extract_contributor_names_from_text(commit, text) commit.send(:extract_contributor_names_from_text, text) end def extract_changelog(commit) commit.send(:extract_changelog) end def only_modifies_changelogs?(commit) commit.send(:only_modifies_changelogs?) end def imported_from_svn?(commit) commit.send(:imported_from_svn?) end def test_import tcomm = Time.current tauth = 1.day.ago message = +<<-MSG.strip_heredoc \u{1f4a3} We are relying on hash inequality in tests MSG [[], [1], [1, 2]].each.with_index do |parents, i| sha1 = "b5ed79468289c15a685a82694dcf1adf773c91d#{i}" rugged_commit = OpenStruct.new rugged_commit.oid = sha1 rugged_commit.author = {name: +'Juanjo', email: +'juanjo@example.com', time: tauth} rugged_commit.committer = {name: +'David', email: +'david@example.com', time: tcomm} rugged_commit.message = message rugged_commit.parents = parents commit = Commit.import!(rugged_commit) assert_equal sha1, commit.sha1 assert_equal 'Juanjo', commit.author_name assert_equal 'juanjo@example.com', commit.author_email assert_equal tauth, commit.author_date assert_equal 'David', commit.committer_name assert_equal 'david@example.com', commit.committer_email assert_equal tcomm, commit.committer_date assert_equal message, commit.message if parents.size > 1 assert commit.merge? else assert !commit.merge? end end end def test_short_sha1 commit = Commit.new(sha1: 'c0f3dc9728d8810e710d52e05bc61395297be787') assert_equal 'c0f3dc9', commit.short_sha1 assert_equal 'c0f3dc9728', commit.short_sha1(10) end def test_github_url commit = Commit.new(sha1: 'c0f3dc9728d8810e710d52e05bc61395297be787') assert_equal 'https://github.com/rails/rails/commit/c0f3dc9728d8810e710d52e05bc61395297be787', commit.github_url end def test_imported_from_svn commit = Commit.new(message: <<-MSG.strip_heredoc) Added stable branch to prepare for 1.0 release git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@2980 5ecf4fe2-1ee6-0310-87b1-e25e094e27de MSG assert imported_from_svn?(commit) commit = Commit.new(message: 'Consistent use of single and double quotes') assert !imported_from_svn?(commit) end def test_short_message assert_nil Commit.new.short_message assert_equal 'foo', Commit.new(message: 'foo').short_message assert_equal 'foo', Commit.new(message: "foo\n").short_message assert_equal 'foo bar', Commit.new(message: "foo bar\nbar\nzoo\n").short_message end def test_extract_changelog commit = Commit.new(diff: read_fixture('diff_more_than_changelogs_69edebf.log')) assert_equal <<-CHANGELOG.strip_heredoc, extract_changelog(commit) +*2.0.2* (December 16th, 2007) +* Included in Rails 2.0.2 +*2.0.2* (December 16th, 2007) +*2.0.2* (December 16th, 2007) +*2.0.2* (December 16th, 2007) +*2.0.2* (December 16th, 2007) CHANGELOG end def test_only_modifies_changelogs commit = Commit.new(diff: read_fixture('diff_only_changelogs_e3a39ca.log')) assert only_modifies_changelogs?(commit) commit = Commit.new(diff: read_fixture('diff_more_than_changelogs_69edebf.log')) assert !only_modifies_changelogs?(commit) end def test_basic_name_extraction commit = Commit.new assert_equal [], extract_contributor_names_from_text(commit, '') assert_equal [], extract_contributor_names_from_text(commit, 'nothing here to extract') assert_equal ['miloops'], extract_contributor_names_from_text(commit, 'Fix case-sensitive validates_uniqueness_of. Closes #11366 [miloops]') assert_equal ['Adam Milligan', 'Pratik'], extract_contributor_names_from_text(commit, 'Ensure methods called on association proxies respect access control. [#1083 state:resolved] [Adam Milligan, Pratik]') assert_equal ['jbarnette'], extract_contributor_names_from_text(commit, 'Correct documentation for dom_id [jbarnette] Closes #10775') assert_equal ['Sam'], extract_contributor_names_from_text(commit, 'Models with no attributes should just have empty hash fixtures [Sam] (Closes #3563)') assert_equal ['Kevin Clark', 'Jeremy Hopple'], extract_contributor_names_from_text(commit, <<-MESSAGE) * Fix pagination problems when using include * Introduce Unit Tests for pagination * Allow count to work with :include by using count distinct. [Kevin Clark & Jeremy Hopple] MESSAGE end # Message from c221b5b448569771678279216360460e066095a7. def test_extracts_co_authored_by_names commit = Commit.new( author_name: 'Joel Hawksley', message: <<~MESSAGE `RenderingHelper` supports rendering objects that `respond_to?` `:render_in` Co-authored-by: Natasha Umer <natashau@github.com> Co-authored-by: Aaron Patterson <tenderlove@github.com> Co-authored-by: Shawn Allen <shawnbot@github.com> Co-authored-by: Emily Plummer <emplums@github.com> Co-authored-by: Diana Mounter <broccolini@github.com> Co-authored-by: John Hawthorn <jhawthorn@github.com> Co-authored-by: Nathan Herald <myobie@github.com> Co-authored-by: Zaid Zawaideh <zawaideh@github.com> Co-authored-by: Zach Ahn <engineering@zachahn.com> MESSAGE ) expected_contributor_names = [ 'Joel Hawksley', 'Natasha Umer', 'Aaron Patterson', 'Shawn Allen', 'Emily Plummer', 'Diana Mounter', 'John Hawthorn', 'Nathan Herald', 'Zaid Zawaideh', 'Zach Ahn', ] assert_equal expected_contributor_names, commit.extract_contributor_names(Repo.new) end def test_extracts_co_authored_by_names_when_titlecase commit = Commit.new( author_name: 'Joel Hawksley', message: <<~MESSAGE `RenderingHelper` supports rendering objects that `respond_to?` `:render_in` Co-Authored-By: Natasha Umer <natashau@github.com> MESSAGE ) expected_contributor_names = [ 'Joel Hawksley', 'Natasha Umer' ] assert_equal expected_contributor_names, commit.extract_contributor_names(Repo.new) end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/lib/bot_killer.rb
lib/bot_killer.rb
class BotKiller BLACKLISTED_BOTS = %r{ FAST | MauiBot }xi def initialize(app) @app = app end def call(env) request = Rack::Request.new(env) if request.user_agent =~ BLACKLISTED_BOTS [404, {}, ["Not found"]] else @app.call(env) end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/lib/application_utils.rb
lib/application_utils.rb
require 'fileutils' module ApplicationUtils def self.acquiring_lock_file(basename) abs_name = File.join(tmpdir, basename) lock_file = File.open(abs_name, File::CREAT | File::EXCL | File::WRONLY) Rails.logger.info("acquired lock file #{basename}") lock_file.write("#{$$}\n") begin yield ensure Rails.logger.info("releasing lock file #{basename}") lock_file.close FileUtils.rm_f(abs_name) end rescue Errno::EEXIST Rails.logger.info("couldn't acquire lock file #{basename}") end # Returns the name of the tmp directory under <tt>Rails.root</tt>. It creates # it if needed. def self.tmpdir tmpdir = File.join(Rails.root, 'tmp') Dir.mkdir(tmpdir) unless File.exist?(tmpdir) tmpdir end # Expires the page caches in the public directory. # # We move the cache directory first out to a temporary place, and then # recursively delete that one. It is done that way because if we rm -rf # directly and at the same time requests come and create new cache files a # black hole can be created and handling that is beyond the legendary # robustness of this website. # # On the other hand, moving is atomic. Atomic is good. def self.expire_cache cache_dir = Rails.application.config.action_controller.page_cache_directory if Dir.exist?(cache_dir) expired_cache = "#{tmpdir}/expired_cache.#{Time.now.to_f}" FileUtils.mv(cache_dir, expired_cache, force: true) FileUtils.rm_rf(expired_cache) end end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false
rails/rails-contributors
https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/lib/nfc_attribute_normalizer.rb
lib/nfc_attribute_normalizer.rb
# Not very clever, but will do for what we need. module NFCAttributeNormalizer def nfc(*attribute_names) include Module.new { attribute_names.each do |name| module_eval <<-EOS def #{name}=(value) value = value.to_s.scrub.nfc unless value.nil? write_attribute(#{name.inspect}, value) end EOS end } end end
ruby
MIT
dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9
2026-01-04T17:44:10.559232Z
false