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/app/models/revision.rb
app/models/revision.rb
class Revision < ActiveRecord::Base belongs_to :branch has_one :diff, :class_name => "RevisionDiff", :foreign_key => :after_revision_id has_many :builds has_many :code_object_references, :dependent => :destroy has_many :code_objects, :through => :code_object_references validates :uid, :presence => 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/app/models/code_object.rb
app/models/code_object.rb
class CodeObject < ActiveRecord::Base self.inheritance_column = 'zoink' # we use the type column ourselve belongs_to :project has_many :code_object_roles, :dependent => :destroy accepts_nested_attributes_for :code_object_roles validate :fullname, :presence => true, :uniqueness => {:scope => :revision} before_save :remove_emojis_before_save private def remove_emojis_before_save self.docstring = self.class.remove_emojis(self.docstring) end def self.remove_emojis(string) string.gsub(/[\u{1F600}-\u{1F6FF}]/, "") 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/app/models/build.rb
app/models/build.rb
class Build < ActiveRecord::Base has_one :project, :through => :branch belongs_to :branch belongs_to :revision has_one :revision_diff, :primary_key => "revision_id", :foreign_key => "after_revision_id" validates :branch, :presence => true validates :status, :presence => 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/app/models/code_object_role.rb
app/models/code_object_role.rb
class CodeObjectRole < ActiveRecord::Base belongs_to :code_object belongs_to :code_object_role_name 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/app/models/statistics.rb
app/models/statistics.rb
class Statistics < ActiveRecord::Base private def no_same_name_for_same_date if self.class.where(:date => date, :name => name).count > 0 errors.add(:name, "name/date combination already exist") end end validate :no_same_name_for_same_date validates :date, :presence => true validates :name, :presence => 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/app/models/code_object_reference.rb
app/models/code_object_reference.rb
class CodeObjectReference < ActiveRecord::Base belongs_to :revision belongs_to :code_object validates :revision, :presence => true validates :code_object, :presence => 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/app/models/revision_diff.rb
app/models/revision_diff.rb
class RevisionDiff < ActiveRecord::Base belongs_to :branch belongs_to :before_revision, :class_name => 'Revision' belongs_to :after_revision, :class_name => 'Revision' has_many :code_object_diffs, :dependent => :destroy validate :branch, :presence => true validate :before_revision, :presence => true validate :after_revision, :presence => 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/app/models/code_object_role_name.rb
app/models/code_object_role_name.rb
class CodeObjectRoleName < ActiveRecord::Base validates :name, :presence => true, :uniqueness => 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/app/models/code_object_diff.rb
app/models/code_object_diff.rb
class CodeObjectDiff < ActiveRecord::Base belongs_to :revision_diff belongs_to :before_object, :class_name => 'CodeObject' belongs_to :after_object, :class_name => 'CodeObject' validate :revision_diff, :presence => true validate :before_object, :presence => true validate :after_object, :presence => 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/app/models/branch.rb
app/models/branch.rb
class Branch < ActiveRecord::Base belongs_to :project has_many :revisions, -> { order 'created_at DESC' }, :dependent => :destroy has_many :revision_diffs, -> { order 'id DESC' }, :dependent => :destroy has_many :builds, -> { order 'number DESC' }, :dependent => :destroy belongs_to :latest_revision, :class_name => 'Revision' validate :name, :presence => true, :uniqueness => {:scope => :project} 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/app/models/user.rb
app/models/user.rb
class User < ActiveRecord::Base serialize :follows serialize :organizations def projects all_user_names = (organizations || []) + [user_name] uids = all_user_names.map do |username| uid = InchCI::ProjectUID.new({ :service => provider, :user => username, :repo => '%' }).project_uid end like_condition = (['uid LIKE ?'] * uids.size).join(' OR ') Project.includes(:default_branch).where(like_condition, *uids) end def self.create_with_omniauth(auth) create! do |user| user.provider = auth["provider"] user.uid = auth["uid"] user.display_name = auth["info"]["name"] user.user_name = auth["info"]["nickname"] user.email = auth["info"]["email"] end end def self.find_or_create_with_omniauth(auth) find_with_omniauth(auth) || create_with_omniauth(auth) end def self.find_with_omniauth(auth) find_by_provider_and_uid(auth["provider"], auth["uid"]) end # validates :provider, :uid, :name, :presence => 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/db/seeds.rb
db/seeds.rb
require 'open-uri' content = open('https://raw.githubusercontent.com/rrrene/inch-pages/master/_projects.yml').read project_names = YAML.load(content) COUNT = ENV['COUNT'] || 5 project_names[0...COUNT.to_i].each do |name| uid = "github:#{name}" repo_url = "https://github.com/#{name}.git" puts uid.inspect InchCI::Store::FindProject.call(uid) || InchCI::Store::CreateProject.call(uid, repo_url) InchCI::Worker::Project::UpdateInfo.new.perform(uid) project = InchCI::Store::FindProject.call(uid) branch = InchCI::Store::FindDefaultBranch.call(project) InchCI::Worker::Project::Build.enqueue(repo_url, branch.name) end puts "Projects: #{Project.count}"
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/db/schema.rb
db/schema.rb
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20160222085815) do create_table "branches", force: true do |t| t.integer "project_id" t.string "name" t.integer "latest_revision_id" t.datetime "created_at" t.datetime "updated_at" end add_index "branches", ["project_id", "name"], name: "index_branches_on_project_id_and_name", using: :btree create_table "builds", force: true do |t| t.integer "branch_id" t.integer "revision_id" t.datetime "started_at" t.datetime "finished_at" t.string "status" t.string "trigger" t.integer "number" t.datetime "created_at" t.datetime "updated_at" t.string "inch_version" t.text "stderr" end add_index "builds", ["branch_id"], name: "index_builds_on_branch_id", using: :btree create_table "code_object_diffs", force: true do |t| t.integer "revision_diff_id" t.integer "before_object_id" t.integer "after_object_id" t.string "change" t.datetime "created_at" t.datetime "updated_at" end add_index "code_object_diffs", ["revision_diff_id"], name: "index_code_object_diffs_on_revision_diff_id", using: :btree create_table "code_object_references", force: true do |t| t.integer "revision_id" t.integer "code_object_id" t.datetime "created_at" t.datetime "updated_at" end add_index "code_object_references", ["code_object_id", "revision_id"], name: "index_code_object_references_on_code_object_id_and_revision_id", unique: true, using: :btree add_index "code_object_references", ["revision_id"], name: "index_code_object_references_on_revision_id", using: :btree add_index "code_object_references", ["revision_id"], name: "index_foo", using: :btree create_table "code_object_role_names", force: true do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" end create_table "code_object_roles", force: true do |t| t.integer "code_object_id" t.integer "code_object_role_name_id" t.string "ref_name" t.integer "priority" t.integer "score" t.integer "potential_score" t.integer "min_score" t.integer "max_score" t.datetime "created_at" t.datetime "updated_at" end add_index "code_object_roles", ["code_object_id"], name: "index_code_object_roles_on_code_object_id", using: :btree create_table "code_objects", force: true do |t| t.integer "project_id" t.string "type" t.text "fullname" t.text "docstring" t.integer "score" t.string "grade", limit: 1 t.integer "priority" t.string "location" t.string "digest", limit: 28 t.datetime "created_at" t.datetime "updated_at" end add_index "code_objects", ["digest"], name: "index_code_objects_on_digest", using: :btree create_table "projects", force: true do |t| t.string "uid" t.string "name" t.text "description" t.string "homepage_url" t.string "source_code_url" t.string "repo_url" t.string "documentation_url" t.integer "default_branch_id" t.datetime "created_at" t.datetime "updated_at" t.string "language" t.string "origin" t.text "languages" t.boolean "fork" t.integer "github_hook_id" t.boolean "github_hook_active", default: false t.boolean "badge_generated", default: false t.integer "badge_filled_in_percent" t.boolean "badge_in_readme", default: false t.datetime "badge_in_readme_added_at" t.datetime "badge_in_readme_removed_at" end add_index "projects", ["uid"], name: "index_projects_on_uid", using: :btree create_table "revision_diffs", force: true do |t| t.integer "branch_id" t.integer "before_revision_id" t.integer "after_revision_id" t.datetime "created_at" t.datetime "updated_at" end add_index "revision_diffs", ["branch_id"], name: "index_revision_diffs_on_branch_id", using: :btree create_table "revisions", force: true do |t| t.integer "branch_id" t.string "uid" t.string "tag_uid" t.text "message" t.string "author_name" t.string "author_email" t.datetime "authored_at" t.datetime "created_at" t.datetime "updated_at" t.boolean "badge_in_readme", default: false end create_table "statistics", force: true do |t| t.datetime "date" t.string "name" t.integer "value" t.datetime "created_at" t.datetime "updated_at" end create_table "users", force: true do |t| t.string "provider" t.string "uid" t.string "github_access_token" t.string "display_name" t.string "user_name" t.string "email" t.text "follows" t.datetime "last_signin_at" t.datetime "last_synced_projects_at" t.datetime "created_at" t.datetime "updated_at" t.text "organizations" end add_index "users", ["provider", "user_name"], name: "index_users_on_provider_and_user_name", unique: true, using: :btree 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/db/migrate/20141221105013_create_users.rb
db/migrate/20141221105013_create_users.rb
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :provider t.string :uid t.string :github_access_token t.string :display_name t.string :user_name t.string :email t.text :follows t.datetime :last_signin_at t.datetime :last_synced_projects_at t.timestamps end add_index :users, [:provider, :user_name], unique: 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/db/migrate/20140410230225_create_code_object_diffs.rb
db/migrate/20140410230225_create_code_object_diffs.rb
class CreateCodeObjectDiffs < ActiveRecord::Migration def change create_table :code_object_diffs do |t| t.references :revision_diff t.references :before_object t.references :after_object t.string :change t.timestamps 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/db/migrate/20141219090021_add_index_on_code_object_references.rb
db/migrate/20141219090021_add_index_on_code_object_references.rb
class AddIndexOnCodeObjectReferences < ActiveRecord::Migration def change add_index :code_object_references, [:code_object_id, :revision_id], unique: 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/db/migrate/20140409211108_create_code_object_references.rb
db/migrate/20140409211108_create_code_object_references.rb
class CreateCodeObjectReferences < ActiveRecord::Migration def change create_table :code_object_references do |t| t.references :revision t.references :code_object t.timestamps 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/db/migrate/20150103111834_add_index_on_build_table.rb
db/migrate/20150103111834_add_index_on_build_table.rb
class AddIndexOnBuildTable < ActiveRecord::Migration def change add_index :builds, [:branch_id] 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/db/migrate/20140324230757_create_projects.rb
db/migrate/20140324230757_create_projects.rb
class CreateProjects < ActiveRecord::Migration def change create_table :projects do |t| t.string :uid t.string :name t.string :description t.string :homepage_url t.string :source_code_url t.string :repo_url t.string :documentation_url t.references :default_branch t.timestamps end add_index :projects, :uid 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/db/migrate/20151223114527_add_index_on_code_objects_references.rb
db/migrate/20151223114527_add_index_on_code_objects_references.rb
class AddIndexOnCodeObjectsReferences < ActiveRecord::Migration def change add_index :code_object_references, [:revision_id] 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/db/migrate/20140327230743_create_code_objects.rb
db/migrate/20140327230743_create_code_objects.rb
class CreateCodeObjects < ActiveRecord::Migration def change create_table :code_objects do |t| t.references :project t.string :type t.text :fullname t.text :docstring t.integer :score t.string :grade, :limit => 1 t.integer :priority t.string :location t.string :digest, :limit => 28 t.timestamps end add_index :code_objects, :digest 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/db/migrate/20150101142423_add_hook_active_to_projects.rb
db/migrate/20150101142423_add_hook_active_to_projects.rb
class AddHookActiveToProjects < ActiveRecord::Migration def change add_column :projects, :github_hook_active, :boolean, :default => false 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/db/migrate/20150201151745_add_badge_fields_to_projects.rb
db/migrate/20150201151745_add_badge_fields_to_projects.rb
class AddBadgeFieldsToProjects < ActiveRecord::Migration def change add_column :projects, :badge_generated, :boolean, :default => false add_column :projects, :badge_filled_in_percent, :integer add_column :projects, :badge_in_readme, :boolean, :default => false add_column :projects, :badge_in_readme_added_at, :datetime add_column :projects, :badge_in_readme_removed_at, :datetime 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/db/migrate/20140922200938_add_language_to_projects.rb
db/migrate/20140922200938_add_language_to_projects.rb
class AddLanguageToProjects < ActiveRecord::Migration def change add_column :projects, :language, :string 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/db/migrate/20140826124416_create_statistics.rb
db/migrate/20140826124416_create_statistics.rb
class CreateStatistics < ActiveRecord::Migration def change create_table :statistics do |t| t.datetime :date t.string :name t.integer :value t.timestamps 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/db/migrate/20140927081335_add_origin_to_projects.rb
db/migrate/20140927081335_add_origin_to_projects.rb
class AddOriginToProjects < ActiveRecord::Migration def change add_column :projects, :origin, :string 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/db/migrate/20150212200619_add_stderr_to_builds.rb
db/migrate/20150212200619_add_stderr_to_builds.rb
class AddStderrToBuilds < ActiveRecord::Migration def change add_column :builds, :stderr, :text 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/db/migrate/20140408185039_create_code_object_role_names.rb
db/migrate/20140408185039_create_code_object_role_names.rb
class CreateCodeObjectRoleNames < ActiveRecord::Migration def change create_table :code_object_role_names do |t| t.string :name t.timestamps 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/db/migrate/20140327230804_create_code_object_roles.rb
db/migrate/20140327230804_create_code_object_roles.rb
class CreateCodeObjectRoles < ActiveRecord::Migration def change create_table :code_object_roles do |t| t.references :code_object t.references :code_object_role_name t.string :ref_name t.integer :priority t.integer :score t.integer :potential_score t.integer :min_score t.integer :max_score t.timestamps 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/db/migrate/20141003104039_change_description_in_projects_to_text.rb
db/migrate/20141003104039_change_description_in_projects_to_text.rb
class ChangeDescriptionInProjectsToText < ActiveRecord::Migration def change change_column :projects, :description, :text 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/db/migrate/20141219114822_add_index_on_code_object_roles.rb
db/migrate/20141219114822_add_index_on_code_object_roles.rb
class AddIndexOnCodeObjectRoles < ActiveRecord::Migration def change add_index :code_object_roles, :code_object_id 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/db/migrate/20140604182559_add_badge_in_readme_to_revisions.rb
db/migrate/20140604182559_add_badge_in_readme_to_revisions.rb
class AddBadgeInReadmeToRevisions < ActiveRecord::Migration def change add_column :revisions, :badge_in_readme, :boolean, :default => false 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/db/migrate/20140805200806_add_inch_version_to_builds.rb
db/migrate/20140805200806_add_inch_version_to_builds.rb
class AddInchVersionToBuilds < ActiveRecord::Migration def change add_column :builds, :inch_version, :string 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/db/migrate/20140331170945_create_builds.rb
db/migrate/20140331170945_create_builds.rb
class CreateBuilds < ActiveRecord::Migration def change create_table :builds do |t| t.references :branch t.references :revision t.datetime :started_at t.datetime :finished_at t.string :status t.string :trigger t.integer :number t.timestamps 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/db/migrate/20160222085815_alter_revision_message_to_text.rb
db/migrate/20160222085815_alter_revision_message_to_text.rb
class AlterRevisionMessageToText < ActiveRecord::Migration def change change_column :revisions, :message, :text 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/db/migrate/20141223134843_add_hook_id_to_projects.rb
db/migrate/20141223134843_add_hook_id_to_projects.rb
class AddHookIdToProjects < ActiveRecord::Migration def change add_column :projects, :github_hook_id, :integer 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/db/migrate/20150101181738_add_index_on_diff_tables.rb
db/migrate/20150101181738_add_index_on_diff_tables.rb
class AddIndexOnDiffTables < ActiveRecord::Migration def change add_index :revision_diffs, [:branch_id] add_index :code_object_diffs, [:revision_diff_id] 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/db/migrate/20140410230212_create_revision_diffs.rb
db/migrate/20140410230212_create_revision_diffs.rb
class CreateRevisionDiffs < ActiveRecord::Migration def change create_table :revision_diffs do |t| t.references :branch t.references :before_revision t.references :after_revision t.timestamps 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/db/migrate/20140327230732_create_revisions.rb
db/migrate/20140327230732_create_revisions.rb
class CreateRevisions < ActiveRecord::Migration def change create_table :revisions do |t| t.references :branch t.string :uid t.string :tag_uid t.string :message t.string :author_name t.string :author_email t.datetime :authored_at t.timestamps 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/db/migrate/20150327194017_add_organizations_to_users.rb
db/migrate/20150327194017_add_organizations_to_users.rb
class AddOrganizationsToUsers < ActiveRecord::Migration def change add_column :users, :organizations, :text 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/db/migrate/20140327230712_create_branches.rb
db/migrate/20140327230712_create_branches.rb
class CreateBranches < ActiveRecord::Migration def change create_table :branches do |t| t.references :project t.string :name t.references :latest_revision t.timestamps end add_index :branches, [:project_id, :name] 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/db/migrate/20141222100946_add_more_infos_to_projects.rb
db/migrate/20141222100946_add_more_infos_to_projects.rb
class AddMoreInfosToProjects < ActiveRecord::Migration def change add_column :projects, :languages, :text add_column :projects, :fork, :boolean 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/test/test_helper.rb
test/test_helper.rb
ENV["RAILS_ENV"] ||= "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' module TestHelper def assert_positive_difference(expression, message = nil, &block) expressions = Array(expression) exps = expressions.map { |e| e.respond_to?(:call) ? e : lambda { eval(e, block.binding) } } before = exps.map { |e| e.call } yield expressions.zip(exps).each_with_index do |(code, e), i| error = "#{code.inspect} didn't increase" error = "#{message}.\n#{error}" if message assert(e.call - before[i] > 0, error) end end def assert_badge(base) InchCI::Badge.each_image_combination do |format, style| file = File.join(base, "master.#{style}.#{format}") assert File.exist?(file), "File #{file} not found" end end # Logs a given +user+ in, executes the given block and logs the user out. def with_login(user = User.first, &block) session[:user_id] = user.id yield(user) session[:user_id] = nil end end require 'support/mini_test_spec' require 'support/worker_output_mock' require 'support/sidekiq' require 'support/omniauth' class ActiveSupport::TestCase ActiveRecord::Migration.check_pending! # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integration tests # -- they do not yet inherit this setting fixtures :all # Add more helper methods to be used by all tests here... include TestHelper 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/test/services/action/project/create_test.rb
test/services/action/project/create_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper') describe ::Action::Project::Create do let(:described_class) { ::Action::Project::Create } let(:repo_url) { "https://github.com/rrrene/repomen.git" } let(:repo_nwo) { "rrrene/repomen" } let(:invalid_input) { "invalid_input" } let(:origin) { 'homepage' } it "should work with git URL" do params = {:repo_url => repo_url} action = described_class.new(params, origin) assert action.success? project = action.project assert project.valid? assert_equal repo_url, project.repo_url assert_equal origin, project.origin end it "should work with GitHub nwo" do params = {:repo_url => repo_nwo} action = described_class.new(params, origin) assert action.success? project = action.project assert project.valid? assert_equal repo_url, project.repo_url assert_equal origin, project.origin end it "should not work with mumbo jumbo" do params = {:repo_url => invalid_input} action = described_class.new(params, origin) refute action.success? end it "should not work with verboten origin" do params = {:repo_url => repo_url} action = described_class.new(params) project = action.project assert project.valid? assert_equal repo_url, project.repo_url refute_equal origin, project.origin 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/test/support/mini_test_spec.rb
test/support/mini_test_spec.rb
require 'minitest/autorun' require 'active_support/testing/assertions' class MiniTest::Spec include ActiveSupport::Testing::Assertions include ActiveSupport::Testing::SetupAndTeardown include ActiveRecord::TestFixtures include TestHelper alias :method_name :name if defined? :name self.fixture_path = File.join(Rails.root, 'test', 'fixtures') 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/test/support/sidekiq.rb
test/support/sidekiq.rb
require 'sidekiq/testing' Sidekiq::Testing.inline! Sidekiq::Logging.logger = nil
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/test/support/worker_output_mock.rb
test/support/worker_output_mock.rb
class WorkerOutputMock MOCKS_FILE = File.join(Rails.root, 'test', 'worker_outputs.yml') MOCKS = YAML.load( File.read(MOCKS_FILE) ) # @return [Hash] a mocked worker output def self.[](key) if hash = MOCKS[key.to_s] hash else raise "WorkerOutputMock not found: #{key.inspect}" end end # @return [Hash] a mocked worker output def self.hash(key) self[key.to_s] end # @return [String] a mocked worker output def self.string(key) self[key.to_s].to_yaml 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/test/support/omniauth.rb
test/support/omniauth.rb
OmniAuth.config.test_mode = true omniauth_hash = { 'provider' => 'github', 'uid' => '12345', 'info' => { 'name' => 'marvin', 'email' => 'hi@marvintherobot.com', 'nickname' => 'MarvinTheRobot' }, 'extra' => { 'raw_info' => { 'location' => 'San Francisco', 'gravatar_id' => '123456789' } }, 'credentials' => {'token' =>'123456789'} } OmniAuth.config.add_mock(:github, omniauth_hash)
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/test/integration/worker/project/update_info_test.rb
test/integration/worker/project/update_info_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper') describe ::InchCI::Worker::Project::UpdateInfo do fixtures :all let(:described_class) { ::InchCI::Worker::Project::UpdateInfo } let(:project_uid) { "github:rrrene/sparkr" } it "should work using .enqueue" do described_class.enqueue(project_uid) 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/test/integration/worker/project/build_test.rb
test/integration/worker/project/build_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper') describe ::InchCI::Worker::Project::Build do let(:described_class) { ::InchCI::Worker::Project::Build } let(:repo_url) { "https://github.com/rrrene/repomen.git" } it "should work using .enqueue" do changes = %w(Build.count Revision.count CodeObject.count CodeObjectRole.count) assert_positive_difference(changes) do described_class.enqueue(repo_url) end build = Build.last refute_nil build.inch_version refute_empty build.inch_version end # this tests if we can use the async worker directly, utilizing its default # parameters, especially the non-existent preliminary build object it "should work using .perform_async" do changes = %w(Build.count Revision.count CodeObject.count CodeObjectRole.count) assert_positive_difference(changes) do described_class::ShellInvocation.perform_async(repo_url) 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/test/integration/worker/project/build_json_test.rb
test/integration/worker/project/build_json_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper') describe ::InchCI::Worker::Project::BuildJSON do let(:described_class) { ::InchCI::Worker::Project::BuildJSON } let(:filename) { File.expand_path(File.dirname(__FILE__) + '/../../../fixtures/dumps/elixir/inch_ex.json') } it "should work using .enqueue" do changes = %w(Build.count Revision.count CodeObject.count CodeObjectRole.count) assert_positive_difference(changes) do described_class.enqueue(filename) end build = Build.last refute_nil build.inch_version refute_empty build.inch_version 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/test/inch_ci/project_uid_test.rb
test/inch_ci/project_uid_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') require 'inch_ci/project_uid' describe ::InchCI::ProjectUID do fixtures :all let(:described_class) { ::InchCI::ProjectUID } it "should return project_uid for params" do params = {:service => 'github', :user => 'user_name', :repo => 'with-numbers-1232'} info = described_class.new(params) assert_equal 'github:user_name/with-numbers-1232', info.project_uid assert_equal 'https://github.com/user_name/with-numbers-1232.git', info.repo_url end it "should not return project_uid for malformed params" do params = {:service => 'github', :user_name => 'user_name'} info = described_class.new(params) assert_nil info.project_uid assert_nil info.repo_url end it "should return project_uid for a uid" do info = described_class.new('github:user_name/with-numbers-1232') assert_equal 'github:user_name/with-numbers-1232', info.project_uid assert_equal 'https://github.com/user_name/with-numbers-1232.git', info.repo_url end it "should not return project_uid for malformed uid" do info = described_class.new('github:user_name/') assert_nil info.project_uid assert_nil info.repo_url 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/test/inch_ci/access_token_test.rb
test/inch_ci/access_token_test.rb
require 'test_helper' describe ::InchCI::AccessToken do let(:file) { File.join("tmp/access_token.yml") } let(:access_token) { ::InchCI::AccessToken.new(file) } before { FileUtils.rm_f(file) } describe "with contents" do before do File.open(file, "w") { |fh| fh.write("github: bar\n") } end it "has access token" do assert_equal "bar", access_token["github"] end it "stringifies key" do assert_equal access_token["github"], access_token[:github] end end describe "with empty file" do before { FileUtils.touch(file) } it "has no access tokens" do assert File.exist?(file) assert_nil access_token[:github] end end describe "w/o a file" do it "has no access tokens" do refute File.exist?(file) assert_nil access_token[:github] 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/test/inch_ci/badge_test.rb
test/inch_ci/badge_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') describe ::InchCI::Badge do fixtures :all let(:described_class) { ::InchCI::Badge } it "should only create code objects when they change" do project = Project.find_by_uid("github:rrrene/sparkr") branch = project.default_branch counts = [0,1,2,3] described_class.create(project, branch, counts) base = File.join(Rails.root, "tmp", "github", "rrrene", "sparkr") assert_badge(base) 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/test/inch_ci/repo_url_test.rb
test/inch_ci/repo_url_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') describe ::InchCI::RepoURL do fixtures :all let(:described_class) { ::InchCI::RepoURL } it "should return project_uid for GitHub web-url" do info = described_class.new('https://github.com/user_name/with-numbers-1232') assert_equal 'github:user_name/with-numbers-1232', info.project_uid end it "should return project_uid for slightly malformed GitHub web-url" do info = described_class.new('https://github.com/rrrene/inch/') assert_equal 'github:rrrene/inch', info.project_uid end it "should return project_uid for slightly malformed GitHub web repo-url" do info = described_class.new('https://github.com/rrrene/inch.git') assert_equal 'github:rrrene/inch', info.project_uid end it "should return project_uid for malformed values" do info = described_class.new('com/rrrene/inch/') assert_nil info.project_uid 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/test/inch_ci/worker/project/build/generate_badge_test.rb
test/inch_ci/worker/project/build/generate_badge_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper') describe ::InchCI::Worker::Project::Build::GenerateBadge do fixtures :all let(:described_class) { ::InchCI::Worker::Project::Build::GenerateBadge } it "should only create code objects when they change" do project = Project.find_by_uid("github:rrrene/sparkr") branch = project.default_branch code_objects = branch.latest_revision.code_objects described_class.new(project, branch, code_objects) base = File.join(Rails.root, "tmp", "github", "rrrene", "sparkr") assert_badge(base) 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/test/inch_ci/worker/project/build/save_build_data_test.rb
test/inch_ci/worker/project/build/save_build_data_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper') describe ::InchCI::Worker::Project::Build::SaveBuildData do fixtures :all let(:described_class) { ::InchCI::Worker::Project::Build::SaveBuildData } let(:build) { Build.create!(:started_at => Time.now, :branch => Branch.first, :status => 'testing') } it "should only create code objects when they change" do build data = WorkerOutputMock.hash(:codebase_3_objects) assert_difference(%w(Build.count), 0) do assert_difference(%w(Revision.count RevisionDiff.count), 1) do assert_difference(%w(CodeObjectReference.count CodeObject.count CodeObjectDiff.count), 3) do described_class.new(build, data['build']) assert Revision.last.badge_in_readme? end end end # running the output again should not create new objects, since we already # the revision "in store". assert_difference(%w(Build.count), 0) do assert_difference(%w(Revision.count RevisionDiff.count), 0) do assert_difference(%w(CodeObjectReference.count CodeObject.count CodeObjectDiff.count), 0) do described_class.new(build, data['build']) end end end data['build']['trigger'] = 'travis' # but running the output again after we modified it to show a build # triggered by a CI system, it should create new object references # (not new code objects since the docs have not changed)! #assert_difference(%w(Build.count), 0) do # assert_difference(%w(Revision.count RevisionDiff.count), 0) do # assert_difference(%w(CodeObjectReference.count), 3) do # described_class.new(build, data['build']) # end # end #end # the changed data (after a supposed commit) now should only create # one new CodeObject since only one has changed. The others should only # be referenced in the new Revision. data = WorkerOutputMock.hash(:codebase_3_objects_1_changed) assert_difference(%w(Build.count), 0) do assert_difference(%w(Revision.count RevisionDiff.count), 1) do assert_difference(%w(CodeObjectReference.count), 3) do assert_difference(%w(CodeObject.count CodeObjectDiff.count), 1) do described_class.new(build, data['build']) refute Revision.last.badge_in_readme? end end end end end it "should handle retrieve_failed" do data = WorkerOutputMock.hash(:retrieve_failed) described_class.new(build, data['build']) end it "should handle change_branch_failed" do data = WorkerOutputMock.hash(:change_branch_failed) described_class.new(build, data['build']) end it "should handle checkout_revision_failed" do data = WorkerOutputMock.hash(:checkout_revision_failed) described_class.new(build, data['build']) 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/test/inch_ci/worker/project/build/handler_worker_output_test.rb
test/inch_ci/worker/project/build/handler_worker_output_test.rb
require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper') describe ::InchCI::Worker::Project::Build::HandleWorkerOutput do fixtures :builds let(:described_class) { ::InchCI::Worker::Project::Build::HandleWorkerOutput } let(:repo_url) { 'https://github.com/rrrene/sparkr.git' } let(:branch_name) { 'master' } let(:trigger) { 'manual' } let(:build) { Build.first } FakeSaveBuildData = -> (build, data, stderr) { } it 'should work with a valid build' do output = WorkerOutputMock.string(:codebase_3_objects) stderr = '' described_class.new(output, stderr, build, FakeSaveBuildData) end it 'should work with an empty output' do output = '' stderr = '' assert_raises RuntimeError do described_class.new(output, stderr, build, FakeSaveBuildData) end end it 'should work with output littered with YARD warnings' do output = <<-STDOUT [error]: NameError: uninitialized constant YARD::Handlers::Ruby::PrivateClassMethodHandler::NamespaceMissingError [error]: Stack trace: /home/user/.rvm/gems/ruby-2.1.2@inch_ci/gems/yard-0.8.7.4/lib/yard/handlers/ruby/private_class_method_handler.rb:32:in `rescue in privatize_class_method' /home/user/.rvm/gems/ruby-2.1.2@inch_ci/gems/yard-0.8.7.4/lib/yard/handlers/ruby/private_class_method_handler.rb:25:in `privatize_class_method' /home/user/.rvm/gems/ruby-2.1.2@inch_ci/gems/yard-0.8.7.4/lib/yard/handlers/ruby/private_class_method_handler.rb:11:in `block (2 levels) in <class:PrivateClassMethodHandler>' /home/user/.rvm/gems/ruby-2.1.2@inch_ci/gems/yard-0.8.7.4/lib/yard/handlers/ruby/private_class_method_handler.rb:8:in `each' /home/user/.rvm/gems/ruby-2.1.2@inch_ci/gems/yard-0.8.7.4/lib/yard/handlers/ruby/private_class_method_handler.rb:8:in `block in <class:PrivateClassMethodHandler>' /home/user/.rvm/gems/ruby-2.1.2@inch_ci/gems/yard-0.8.7.4/lib/yard/handlers/processor.rb:114:in `block (2 levels) in process' [warn]: YARD will recover from this error and continue to parse but you *may* have problems [warn]: with your generated documentation. You should probably fix this. [warn]: - --- build: status: success repo_url: https://github.com/puppetlabs/puppet.git branch_name: master started_at: &1 2014-09-14 22:49:58.645222890 +02:00 finished_at: *1 latest_revision: true service_name: github user_name: puppetlabs repo_name: puppet badge_in_readme: true inch_version: 0.5.0.rc6 revision_uid: ab15dc8812b22069d035116842b1cd0360671997 revision_message: "(PUP-3144) Skip the openbsd service specs on windows" revision_author_name: Kylo Ginsberg revision_author_email: kylo@puppetlabs.com revision_authored_at: Fri Sep 12 17:34:17 2014 -0700 objects: [] STDOUT stderr = '' described_class.new(output, stderr, build, FakeSaveBuildData) 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/test/helpers/page_helper_test.rb
test/helpers/page_helper_test.rb
require 'test_helper' class PageHelperTest < ActionView::TestCase 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/test/helpers/api_helper_test.rb
test/helpers/api_helper_test.rb
require 'test_helper' class ApiHelperTest < ActionView::TestCase 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/test/helpers/help_helper_test.rb
test/helpers/help_helper_test.rb
require 'test_helper' class HelpHelperTest < ActionView::TestCase 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/test/helpers/users_helper_test.rb
test/helpers/users_helper_test.rb
require 'test_helper' class UsersHelperTest < ActionView::TestCase 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/test/helpers/admin/builds_helper_test.rb
test/helpers/admin/builds_helper_test.rb
require 'test_helper' class Admin::BuildsHelperTest < ActionView::TestCase 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/test/helpers/admin/projects_helper_test.rb
test/helpers/admin/projects_helper_test.rb
require 'test_helper' class Admin::ProjectsHelperTest < ActionView::TestCase 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/test/helpers/admin/overview_helper_test.rb
test/helpers/admin/overview_helper_test.rb
require 'test_helper' class Admin::OverviewHelperTest < ActionView::TestCase 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/test/helpers/admin/cli_helper_test.rb
test/helpers/admin/cli_helper_test.rb
require 'test_helper' class Admin::CliHelperTest < ActionView::TestCase 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/test/helpers/api/builds_helper_test.rb
test/helpers/api/builds_helper_test.rb
require 'test_helper' class Api::BuildsHelperTest < ActionView::TestCase 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/test/controllers/sessions_controller_test.rb
test/controllers/sessions_controller_test.rb
require 'test_helper' class SessionsControllerTest < ActionController::TestCase setup do request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:github] end test "should get :create" do skip # this fails since we do not yet have mocked the /following API call assert_difference(%w(User.count), 0) do assert_nil session[:user_id] get :create, :provider => 'github' refute_nil session[:user_id] assert_response :redirect end end test "should get :destroy" do with_login do |current_user| refute_nil session[:user_id] get :destroy assert_nil session[:user_id] assert_response :redirect 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/test/controllers/code_objects_controller_test.rb
test/controllers/code_objects_controller_test.rb
require 'test_helper' class CodeObjectsControllerTest < ActionController::TestCase fixtures :all test "should get :show with existing revision" do rev = '8849af2b7ad96c6aa650a6fd5490ef83629faf2a' short_rev = rev[0..6] [rev, short_rev].each do |revision_uid| %w(html js).each do |format| params = { :service => 'github', :user => 'rrrene', :repo => 'sparkr', :branch => 'master', :revision => revision_uid, :code_object => '1', :format => format } get :show, params assert_response :success refute_match /translation\ missing/, response.body 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/test/controllers/users_controller_test.rb
test/controllers/users_controller_test.rb
require 'test_helper' class UsersControllerTest < ActionController::TestCase UNAUTHORIZED = 401 test "should get :init_projects" do with_login do |current_user| post :init_projects, :format => 'js' assert_response :success end end test "should get :sync_projects" do with_login do |current_user| assert_positive_difference(%w(Project.count Branch.count)) do post :sync_projects assert_response :redirect end end end # # SHOW # test "should not get :show" do get :show, :service => 'github', :user => 'rrrene' assert_response UNAUTHORIZED end test "should get :show" do with_login do |current_user| get :show, :service => 'github', :user => 'rrrene' assert_response :success end end # # WELCOME # test "should get :welcome" do with_login do |current_user| get :welcome assert_response :success end end test "should not get :welcome" do get :welcome assert_response UNAUTHORIZED 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/test/controllers/projects_controller_test.rb
test/controllers/projects_controller_test.rb
require 'test_helper' class ProjectsControllerTest < ActionController::TestCase fixtures :all # # BADGE # def fake_badge(service, user, repo) project = Project.find_by_uid("#{service}:#{user}/#{repo}") project.branches.each do |branch| InchCI::Badge.create(project, branch, [0,0,0,0]) end end test "should get :badge as PNG" do fake_badge(:github, :rrrene, :sparkr) get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :format => :png assert_response :success end test "should get :badge as SVG" do fake_badge(:github, :rrrene, :sparkr) get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :format => :svg assert_response :success end test "should get :badge as SVG as 'flat'" do fake_badge(:github, :rrrene, :sparkr) get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :format => :svg, :style => 'flat' assert_response :success end test "should get :badge as SVG as 'flat-square'" do fake_badge(:github, :rrrene, :sparkr) get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :format => :svg, :style => 'flat-square' assert_response :success end test "should get :badge as SVG as unsupported style" do fake_badge(:github, :rrrene, :sparkr) get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :format => :svg, :style => 'something' assert_response :success end test "should get :badge with existing branch" do fake_badge(:github, :rrrene, :sparkr) get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :branch => 'master', :format => :png assert_response :success end test "should get 404 on :badge for non-existing project" do assert_difference(%w(Build.count), 0) do get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr123', :format => :png end assert_response :not_found end test "should get and build :badge for missing project" do project_uid = "github:rrrene/sparkr" Project.find_by_uid(project_uid).destroy assert_equal 0, Project.where(:uid => project_uid).count assert_difference(%w(Build.count Project.count), 1) do get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :format => :png end assert_response :success project = Project.where(:uid => project_uid).first refute project.nil? assert_equal 'badge_request', project.origin end test "should get and build :badge for missing branch" do get :badge, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :branch => 'master123', :format => :png assert_response :not_found end # # CREATE # test "should create a project via github web-url" do assert_difference(%w(Build.count Project.count), 1) do post :create, :repo_url => "https://github.com/rrrene/inch" assert_response :redirect end project = Project.where(:uid => 'github:rrrene/inch').first refute project.nil? assert_equal 'homepage', project.origin end test "should create a project via a slightly malformed github web-url" do assert_difference(%w(Build.count Project.count), 1) do post :create, :repo_url => "https://github.com/rrrene/inch/" assert_response :redirect end end test "should create a project via github ssh-url" do assert_difference(%w(Build.count Project.count), 1) do post :create, :repo_url => "https://github.com/rrrene/inch.git" assert_response :redirect end end test "should create a project via github nwo" do assert_difference(%w(Build.count Project.count), 1) do post :create, :repo_url => "rrrene/inch" assert_response :redirect end end test "should not create a project via git-url that doesnot exist on GitHub" do post :create, :repo_url => "https://github.com/rrrene/not-here.git" assert_response :success assert_template :welcome end test "should not create a project via mumbo-jumbo that doesnot exist on GitHub" do post :create, :repo_url => "some mumbo-jumbo" assert_response :success assert_template :welcome end # # REBUILD # test "should rebuild a project" do post :rebuild, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :branch => 'master' assert_response :redirect end test "should get 404 on :rebuild for missing project" do post :rebuild, :service => 'github', :user => 'rrrene', :repo => 'sparkr123', :branch => 'master' assert_response :not_found end # # REBUILD VIA HOOK # test "should rebuild a project via web hook" do post :rebuild_via_hook, :payload => '{"ref": "refs/heads/master","repository":{"url":"https://github.com/rrrene/sparkr"}}' assert_response :success end test "should not rebuild a missing project via web hook" do Project.find_by_uid("github:rrrene/sparkr").destroy assert_equal 0, Project.where(:uid => "github:rrrene/sparkr").count post :rebuild_via_hook, :payload => '{"ref": "refs/heads/master","repository":{"url":"https://github.com/rrrene/sparkr"}}' assert_response :success assert_equal 1, Project.where(:uid => "github:rrrene/sparkr").count end # # SHOW # test "should get :show" do get :show, :service => 'github', :user => 'rrrene', :repo => 'sparkr' assert_response :success end test "should get :show if the repo name contains a fullstop" do p = Project.create(:uid => 'github:just-testing/web2.0', :repo_url => 'not really there') p.default_branch = p.branches.create(:name => 'master') p.save! get :show, :service => 'github', :user => 'just-testing', :repo => 'web2.0' assert_response :success end test "should get :show with existing branch" do get :show, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :branch => 'master' assert_response :success end test "should get :show with existing revision" do get :show, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :branch => 'master', :revision => '8849af2b7ad96c6aa650a6fd5490ef83629faf2a' assert_response :success end test "should get 404 on :show for missing project" do get :show, :service => 'github', :user => 'rrrene', :repo => 'sparkr123' assert_response :not_found end test "should get 404 on :show for missing branch" do get :show, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :branch => 'master123' assert_response :not_found end test "should get 404 on :show for missing revision" do # there is no revision when a project is first created # so we can't render 404 when the build is pending skip # for now get :show, :service => 'github', :user => 'rrrene', :repo => 'sparkr', :branch => 'master', :revision => '123missing' assert_response :not_found 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/test/controllers/help_controller_test.rb
test/controllers/help_controller_test.rb
require 'test_helper' class HelpControllerTest < ActionController::TestCase # test "the truth" do # assert 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/test/controllers/admin/builds_controller_test.rb
test/controllers/admin/builds_controller_test.rb
require 'test_helper' class Admin::BuildsControllerTest < ActionController::TestCase # test "the truth" do # assert 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/test/controllers/admin/badges_controller_test.rb
test/controllers/admin/badges_controller_test.rb
require 'test_helper' class Admin::BadgesControllerTest < ActionController::TestCase # test "the truth" do # assert 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/test/controllers/admin/statistics_controller_test.rb
test/controllers/admin/statistics_controller_test.rb
require 'test_helper' class Admin::StatisticsControllerTest < ActionController::TestCase # test "the truth" do # assert 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/test/controllers/admin/users_controller_test.rb
test/controllers/admin/users_controller_test.rb
require 'test_helper' class Admin::UsersControllerTest < ActionController::TestCase # test "the truth" do # assert 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/test/controllers/admin/overview_controller_test.rb
test/controllers/admin/overview_controller_test.rb
require 'test_helper' class Admin::OverviewControllerTest < ActionController::TestCase # test "the truth" do # assert 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/test/controllers/admin/projects_controller_test.rb
test/controllers/admin/projects_controller_test.rb
require 'test_helper' class Admin::ProjectsControllerTest < ActionController::TestCase # test "the truth" do # assert 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/test/controllers/admin/cli_controller_test.rb
test/controllers/admin/cli_controller_test.rb
require 'test_helper' class Admin::CliControllerTest < ActionController::TestCase # test "the truth" do # assert 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/test/controllers/api/builds_controller_test.rb
test/controllers/api/builds_controller_test.rb
require 'test_helper' class Api::BuildsControllerTest < ActionController::TestCase def setup @controller = Api::BuildsController.new end def params {"language"=>"elixir", "git_repo_url"=>"git://github.com/rrrene/inch_ex.git", "travis" => true, "travis_repo_slug" => "rrrene/inch_ex", "args"=>nil, "objects"=>[{"object_type"=>"ModuleObject", "id"=>"InchEx", "module"=>"Elixir.InchEx", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Config", "module"=>"Elixir.InchEx.Config", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Formatter", "module"=>"Elixir.InchEx.Docs.Formatter", "moduledoc"=>"Provide JSON-formatted documentation\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever", "module"=>"Elixir.InchEx.Docs.Retriever", "moduledoc"=>"Functions to extract documentation information from modules.\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever.Error", "module"=>"Elixir.InchEx.Docs.Retriever.Error", "moduledoc"=>nil, "source"=>nil, "type"=>"exception", "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.FunctionObject", "module"=>"Elixir.InchEx.FunctionObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.ModuleObject", "module"=>"Elixir.InchEx.ModuleObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Local", "module"=>"Elixir.InchEx.Reporter.Local", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Remote", "module"=>"Elixir.InchEx.Reporter.Remote", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.TypeObject", "module"=>"Elixir.InchEx.TypeObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"Mix.Tasks.Inch", "module"=>"Elixir.Mix.Tasks.Inch", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"Mix.Tasks.Inch.Report", "module"=>"Elixir.Mix.Tasks.Inch.Report", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx", "arity"=>4, "doc"=>false, "id"=>"generate_docs/4", "name"=>"generate_docs", "signature"=>[["project", [], nil], ["version", [], nil], ["args", [], nil], ["options", [], nil]], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Formatter", "arity"=>3, "doc"=>"Generate JSON documentation for the given modules\n", "id"=>"run/3", "name"=>"run", "signature"=>[["modules", [], nil], ["args", [], nil], ["config", [], nil]], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified directory\n", "id"=>"docs_from_dir/2", "name"=>"docs_from_dir", "signature"=>[["dir", [], nil], ["config", [], nil]], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified list of files\n", "id"=>"docs_from_files/2", "name"=>"docs_from_files", "signature"=>[["files", [], nil], ["config", [], nil]], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the list `modules`\n", "id"=>"docs_from_modules/2", "name"=>"docs_from_modules", "signature"=>[["modules", [], nil], ["config", [], nil]], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.exception/1`.", "id"=>"exception/1", "name"=>"exception", "signature"=>[["args", [], nil]], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["exception", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Keyword", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.message/1`.", "id"=>"message/1", "name"=>"message", "signature"=>[["exception", [], nil]], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["message", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.String", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Local", "arity"=>2, "doc"=>" Runs inch locally, if installed. If you want to force usage of a particular\n inch installation, set INCH_PATH environment variable:\n\n export INCH_PATH=/home/rrrene/projects/inch\n\n Otherwise, InchEx will take whatever `inch` command it finds. If it does\n not find any, it sends the data to the open API at inch-ci.org (or the\n endpoint defined in the INCH_CLI_API environment variable) to perform\n the analysis and reports the findings back.\n", "id"=>"run/2", "name"=>"run", "signature"=>[["filename", [], nil], ["\\\\", [], [["args", [], nil], []]]], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Remote", "arity"=>2, "doc"=>" Runs inch remotely, if already invented.\n", "id"=>"run/2", "name"=>"run", "signature"=>[["filename", [], nil], ["", [], "Elixir"]], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"Mix.Tasks.Inch", "arity"=>4, "doc"=>false, "id"=>"run/4", "name"=>"run", "signature"=>[["args", [], nil], ["\\\\", [], [["config", [], nil], [[".", {"line"=>10}, ["Elixir.Mix.Project", "config"]], {"line"=>10}, []]]], ["\\\\", [], [["generator", [], nil], [[".", [], ["erlang", "make_fun"]], {"line"=>10}, ["Elixir.InchEx", "generate_docs", 4]]]], ["\\\\", [], [["reporter", [], nil], "Elixir.InchEx.Reporter.Local"]]], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"Mix.Tasks.Inch.Report", "arity"=>4, "doc"=>false, "id"=>"run/4", "name"=>"run", "signature"=>[["", [], "Elixir"], ["\\\\", [], [["config", [], nil], [[".", {"line"=>8}, ["Elixir.Mix.Project", "config"]], {"line"=>8}, []]]], ["\\\\", [], [["generator", [], nil], [[".", [], ["erlang", "make_fun"]], {"line"=>8}, ["Elixir.InchEx", "generate_docs", 4]]]], ["\\\\", [], [["reporter", [], nil], "Elixir.InchEx.Reporter.Remote"]]], "source"=>nil, "specs"=>nil, "type"=>"def"}], "controller"=>"api/builds", "action"=>"run", "build"=>{}} end test "should not error on GET" do get :run assert_response :success end test "should run with valid params" do post :run, params assert_response :success 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/test/controllers/api/cli_controller_test.rb
test/controllers/api/cli_controller_test.rb
require 'test_helper' class ApiCliControllerTest < ActionController::TestCase def setup @controller = Api::CliController.new end test "should not error on GET" do get :run assert_response :success end test "should run with valid params" do params = {"language" => "elixir", "objects"=>[{"object_type"=>"ModuleObject", "id"=>"InchEx", "module"=>"Elixir.InchEx", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Config", "module"=>"Elixir.InchEx.Config", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Formatter", "module"=>"Elixir.InchEx.Docs.Formatter", "moduledoc"=>"Provide JSON-formatted documentation\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever", "module"=>"Elixir.InchEx.Docs.Retriever", "moduledoc"=>"Functions to extract documentation information from modules.\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever.Error", "module"=>"Elixir.InchEx.Docs.Retriever.Error", "moduledoc"=>nil, "source"=>nil, "type"=>"exception", "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.FunctionObject", "module"=>"Elixir.InchEx.FunctionObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.ModuleObject", "module"=>"Elixir.InchEx.ModuleObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Local", "module"=>"Elixir.InchEx.Reporter.Local", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Remote", "module"=>"Elixir.InchEx.Reporter.Remote", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.TypeObject", "module"=>"Elixir.InchEx.TypeObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"Mix.Tasks.Inch", "module"=>"Elixir.Mix.Tasks.Inch", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx", "arity"=>3, "doc"=>false, "id"=>"generate_docs/3", "name"=>"generate_docs", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Formatter", "arity"=>2, "doc"=>"Generate JSON documentation for the given modules\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified directory\n", "id"=>"docs_from_dir/2", "name"=>"docs_from_dir", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified list of files\n", "id"=>"docs_from_files/2", "name"=>"docs_from_files", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the list `modules`\n", "id"=>"docs_from_modules/2", "name"=>"docs_from_modules", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.exception/1`.", "id"=>"exception/1", "name"=>"exception", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["exception", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Keyword", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.message/1`.", "id"=>"message/1", "name"=>"message", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["message", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.String", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Local", "arity"=>1, "doc"=>" Runs inch locally, if installed. If you want to force usage of a particular\n inch installation, set INCH_PATH environment variable to it.\n\n export INCH_PATH=/home/rrrene/projects/inch\n", "id"=>"run/1", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Remote", "arity"=>2, "doc"=>" Runs inch remotely, if already invented.\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"Mix.Tasks.Inch", "arity"=>4, "doc"=>false, "id"=>"run/4", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}], "controller"=>"api", "action"=>"cli", "api"=>{"objects"=>[{"object_type"=>"ModuleObject", "id"=>"InchEx", "module"=>"Elixir.InchEx", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Config", "module"=>"Elixir.InchEx.Config", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Formatter", "module"=>"Elixir.InchEx.Docs.Formatter", "moduledoc"=>"Provide JSON-formatted documentation\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever", "module"=>"Elixir.InchEx.Docs.Retriever", "moduledoc"=>"Functions to extract documentation information from modules.\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever.Error", "module"=>"Elixir.InchEx.Docs.Retriever.Error", "moduledoc"=>nil, "source"=>nil, "type"=>"exception", "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.FunctionObject", "module"=>"Elixir.InchEx.FunctionObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.ModuleObject", "module"=>"Elixir.InchEx.ModuleObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Local", "module"=>"Elixir.InchEx.Reporter.Local", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Remote", "module"=>"Elixir.InchEx.Reporter.Remote", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.TypeObject", "module"=>"Elixir.InchEx.TypeObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"Mix.Tasks.Inch", "module"=>"Elixir.Mix.Tasks.Inch", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx", "arity"=>3, "doc"=>false, "id"=>"generate_docs/3", "name"=>"generate_docs", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Formatter", "arity"=>2, "doc"=>"Generate JSON documentation for the given modules\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified directory\n", "id"=>"docs_from_dir/2", "name"=>"docs_from_dir", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified list of files\n", "id"=>"docs_from_files/2", "name"=>"docs_from_files", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the list `modules`\n", "id"=>"docs_from_modules/2", "name"=>"docs_from_modules", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.exception/1`.", "id"=>"exception/1", "name"=>"exception", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["exception", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Keyword", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.message/1`.", "id"=>"message/1", "name"=>"message", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["message", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.String", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Local", "arity"=>1, "doc"=>" Runs inch locally, if installed. If you want to force usage of a particular\n inch installation, set INCH_PATH environment variable to it.\n\n export INCH_PATH=/home/rrrene/projects/inch\n", "id"=>"run/1", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Remote", "arity"=>2, "doc"=>" Runs inch remotely, if already invented.\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"Mix.Tasks.Inch", "arity"=>4, "doc"=>false, "id"=>"run/4", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}]}} post :run, params assert_response :success assert_match /Grade distribution \(undocumented, C, B, A\)\:/, response.body end test "should run suggest" do params = {"language" => "elixir", args: ["suggest"], "objects"=>[{"object_type"=>"ModuleObject", "id"=>"InchEx", "module"=>"Elixir.InchEx", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Config", "module"=>"Elixir.InchEx.Config", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Formatter", "module"=>"Elixir.InchEx.Docs.Formatter", "moduledoc"=>"Provide JSON-formatted documentation\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever", "module"=>"Elixir.InchEx.Docs.Retriever", "moduledoc"=>"Functions to extract documentation information from modules.\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever.Error", "module"=>"Elixir.InchEx.Docs.Retriever.Error", "moduledoc"=>nil, "source"=>nil, "type"=>"exception", "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.FunctionObject", "module"=>"Elixir.InchEx.FunctionObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.ModuleObject", "module"=>"Elixir.InchEx.ModuleObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Local", "module"=>"Elixir.InchEx.Reporter.Local", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Remote", "module"=>"Elixir.InchEx.Reporter.Remote", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.TypeObject", "module"=>"Elixir.InchEx.TypeObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"Mix.Tasks.Inch", "module"=>"Elixir.Mix.Tasks.Inch", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx", "arity"=>3, "doc"=>false, "id"=>"generate_docs/3", "name"=>"generate_docs", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Formatter", "arity"=>2, "doc"=>"Generate JSON documentation for the given modules\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified directory\n", "id"=>"docs_from_dir/2", "name"=>"docs_from_dir", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified list of files\n", "id"=>"docs_from_files/2", "name"=>"docs_from_files", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the list `modules`\n", "id"=>"docs_from_modules/2", "name"=>"docs_from_modules", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.exception/1`.", "id"=>"exception/1", "name"=>"exception", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["exception", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Keyword", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.message/1`.", "id"=>"message/1", "name"=>"message", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["message", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.String", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Local", "arity"=>1, "doc"=>" Runs inch locally, if installed. If you want to force usage of a particular\n inch installation, set INCH_PATH environment variable to it.\n\n export INCH_PATH=/home/rrrene/projects/inch\n", "id"=>"run/1", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Remote", "arity"=>2, "doc"=>" Runs inch remotely, if already invented.\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"Mix.Tasks.Inch", "arity"=>4, "doc"=>false, "id"=>"run/4", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}], "controller"=>"api", "action"=>"cli", "api"=>{"objects"=>[{"object_type"=>"ModuleObject", "id"=>"InchEx", "module"=>"Elixir.InchEx", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Config", "module"=>"Elixir.InchEx.Config", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Formatter", "module"=>"Elixir.InchEx.Docs.Formatter", "moduledoc"=>"Provide JSON-formatted documentation\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever", "module"=>"Elixir.InchEx.Docs.Retriever", "moduledoc"=>"Functions to extract documentation information from modules.\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever.Error", "module"=>"Elixir.InchEx.Docs.Retriever.Error", "moduledoc"=>nil, "source"=>nil, "type"=>"exception", "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.FunctionObject", "module"=>"Elixir.InchEx.FunctionObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.ModuleObject", "module"=>"Elixir.InchEx.ModuleObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Local", "module"=>"Elixir.InchEx.Reporter.Local", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Remote", "module"=>"Elixir.InchEx.Reporter.Remote", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.TypeObject", "module"=>"Elixir.InchEx.TypeObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"Mix.Tasks.Inch", "module"=>"Elixir.Mix.Tasks.Inch", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx", "arity"=>3, "doc"=>false, "id"=>"generate_docs/3", "name"=>"generate_docs", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Formatter", "arity"=>2, "doc"=>"Generate JSON documentation for the given modules\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified directory\n", "id"=>"docs_from_dir/2", "name"=>"docs_from_dir", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified list of files\n", "id"=>"docs_from_files/2", "name"=>"docs_from_files", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the list `modules`\n", "id"=>"docs_from_modules/2", "name"=>"docs_from_modules", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.exception/1`.", "id"=>"exception/1", "name"=>"exception", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["exception", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Keyword", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.message/1`.", "id"=>"message/1", "name"=>"message", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["message", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.String", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Local", "arity"=>1, "doc"=>" Runs inch locally, if installed. If you want to force usage of a particular\n inch installation, set INCH_PATH environment variable to it.\n\n export INCH_PATH=/home/rrrene/projects/inch\n", "id"=>"run/1", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Remote", "arity"=>2, "doc"=>" Runs inch remotely, if already invented.\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"Mix.Tasks.Inch", "arity"=>4, "doc"=>false, "id"=>"run/4", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}]}} post :run, params assert_response :success assert_match /Grade distribution \(undocumented, C, B, A\)\:/, response.body end test "should run list" do params = {"language" => "elixir", args: ["list"], "objects"=>[{"object_type"=>"ModuleObject", "id"=>"InchEx", "module"=>"Elixir.InchEx", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Config", "module"=>"Elixir.InchEx.Config", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Formatter", "module"=>"Elixir.InchEx.Docs.Formatter", "moduledoc"=>"Provide JSON-formatted documentation\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever", "module"=>"Elixir.InchEx.Docs.Retriever", "moduledoc"=>"Functions to extract documentation information from modules.\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever.Error", "module"=>"Elixir.InchEx.Docs.Retriever.Error", "moduledoc"=>nil, "source"=>nil, "type"=>"exception", "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.FunctionObject", "module"=>"Elixir.InchEx.FunctionObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.ModuleObject", "module"=>"Elixir.InchEx.ModuleObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Local", "module"=>"Elixir.InchEx.Reporter.Local", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Remote", "module"=>"Elixir.InchEx.Reporter.Remote", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.TypeObject", "module"=>"Elixir.InchEx.TypeObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"Mix.Tasks.Inch", "module"=>"Elixir.Mix.Tasks.Inch", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx", "arity"=>3, "doc"=>false, "id"=>"generate_docs/3", "name"=>"generate_docs", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Formatter", "arity"=>2, "doc"=>"Generate JSON documentation for the given modules\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified directory\n", "id"=>"docs_from_dir/2", "name"=>"docs_from_dir", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified list of files\n", "id"=>"docs_from_files/2", "name"=>"docs_from_files", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the list `modules`\n", "id"=>"docs_from_modules/2", "name"=>"docs_from_modules", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.exception/1`.", "id"=>"exception/1", "name"=>"exception", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["exception", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Keyword", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.message/1`.", "id"=>"message/1", "name"=>"message", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["message", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.String", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Local", "arity"=>1, "doc"=>" Runs inch locally, if installed. If you want to force usage of a particular\n inch installation, set INCH_PATH environment variable to it.\n\n export INCH_PATH=/home/rrrene/projects/inch\n", "id"=>"run/1", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Remote", "arity"=>2, "doc"=>" Runs inch remotely, if already invented.\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"Mix.Tasks.Inch", "arity"=>4, "doc"=>false, "id"=>"run/4", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}], "controller"=>"api", "action"=>"cli", "api"=>{"objects"=>[{"object_type"=>"ModuleObject", "id"=>"InchEx", "module"=>"Elixir.InchEx", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Config", "module"=>"Elixir.InchEx.Config", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Formatter", "module"=>"Elixir.InchEx.Docs.Formatter", "moduledoc"=>"Provide JSON-formatted documentation\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever", "module"=>"Elixir.InchEx.Docs.Retriever", "moduledoc"=>"Functions to extract documentation information from modules.\n", "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Docs.Retriever.Error", "module"=>"Elixir.InchEx.Docs.Retriever.Error", "moduledoc"=>nil, "source"=>nil, "type"=>"exception", "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.FunctionObject", "module"=>"Elixir.InchEx.FunctionObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.ModuleObject", "module"=>"Elixir.InchEx.ModuleObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Local", "module"=>"Elixir.InchEx.Reporter.Local", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.Reporter.Remote", "module"=>"Elixir.InchEx.Reporter.Remote", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"InchEx.TypeObject", "module"=>"Elixir.InchEx.TypeObject", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"ModuleObject", "id"=>"Mix.Tasks.Inch", "module"=>"Elixir.Mix.Tasks.Inch", "moduledoc"=>nil, "source"=>nil, "type"=>nil, "typespecs"=>nil}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx", "arity"=>3, "doc"=>false, "id"=>"generate_docs/3", "name"=>"generate_docs", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Formatter", "arity"=>2, "doc"=>"Generate JSON documentation for the given modules\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified directory\n", "id"=>"docs_from_dir/2", "name"=>"docs_from_dir", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the specified list of files\n", "id"=>"docs_from_files/2", "name"=>"docs_from_files", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever", "arity"=>2, "doc"=>"Extract documentation from all modules in the list `modules`\n", "id"=>"docs_from_modules/2", "name"=>"docs_from_modules", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.exception/1`.", "id"=>"exception/1", "name"=>"exception", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["exception", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Keyword", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Docs.Retriever.Error", "arity"=>1, "doc"=>"Callback implementation of `Exception.message/1`.", "id"=>"message/1", "name"=>"message", "signature"=>[], "source"=>nil, "specs"=>[["::", {"line"=>19}, [["message", {"line"=>19}, [[[".", {"line"=>19}, ["Elixir.Exception", "t"]], {"line"=>19}, []]]], [[".", {"line"=>19}, ["Elixir.String", "t"]], {"line"=>19}, []]]]], "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Local", "arity"=>1, "doc"=>" Runs inch locally, if installed. If you want to force usage of a particular\n inch installation, set INCH_PATH environment variable to it.\n\n export INCH_PATH=/home/rrrene/projects/inch\n", "id"=>"run/1", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"InchEx.Reporter.Remote", "arity"=>2, "doc"=>" Runs inch remotely, if already invented.\n", "id"=>"run/2", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}, {"object_type"=>"FunctionObject", "module_id"=>"Mix.Tasks.Inch", "arity"=>4, "doc"=>false, "id"=>"run/4", "name"=>"run", "signature"=>[], "source"=>nil, "specs"=>nil, "type"=>"def"}]}} post :run, params assert_response :success refute_match /Grade distribution \(undocumented, C, B, A\)\:/, response.body assert_match /Seems really good/, response.body end test "should run nothing with invalid args" do %w(console diff inspect).each do |arg| params = {"language" => "elixir", args: [arg], "objects" => []} post :run, params assert_response :success assert_match /error/i, response.body, "should error for arg: #{arg}" end end test "should run with invalid params" do params = {"language" => ""} post :run, params assert_response :success assert_match /error/i, response.body 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/test/models/user_test.rb
test/models/user_test.rb
require 'test_helper' class UserTest < ActiveSupport::TestCase # test "the truth" do # assert 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/test/models/statistics_test.rb
test/models/statistics_test.rb
require 'test_helper' describe Statistics do let(:date) { Time.now } it "should not save for the same date twice" do attributes = { :date => date, :name => "some-key", :value => 1 } record = Statistics.new(attributes) assert record.save attributes = { :date => date, :name => "some-other-key", :value => 2 } record2 = Statistics.new(attributes) assert record2.save bad_attributes = { :date => date, :name => "some-key", :value => 0 } record3 = Statistics.new(bad_attributes) refute record.save 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/test/models/project_test.rb
test/models/project_test.rb
require 'test_helper' class ProjectTest < ActiveSupport::TestCase test "should not save record with malformed UID" do bad_attributes = { :uid => "github:rrrene/sparkr/", :repo_url => "https://github.com/rrrene/sparkr.git" } record = Project.new(bad_attributes) refute record.save end test "should save record with well-formed UID" do good_attributes = { :uid => "github:alakra/weather-forecasts", :repo_url => "https://github.com/rrrene/repomen.git" } record = Project.new(good_attributes) assert record.save 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/project_uid.rb
lib/inch_ci/project_uid.rb
module InchCI class ProjectUID attr_reader :service, :user_name, :repo_name def initialize(params_or_uid) if params_or_uid.is_a?(Hash) @service = params_or_uid[:service] @user_name = params_or_uid[:user] @repo_name = params_or_uid[:repo] else service_and_nwo = params_or_uid.split(':') @service = service_and_nwo.first nwo = service_and_nwo.last.split('/') if nwo.size == 2 @user_name = nwo.first @repo_name = nwo.last end end end def blank? service.to_s.empty? || user_name.to_s.empty? || repo_name.to_s.empty? end def project_uid return if blank? "#{service}:#{user_name}/#{repo_name}" end def repo_url return if blank? if service == 'github' "https://github.com/#{user_name}/#{repo_name}.git" else raise "Unknown service: #{service}" 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/gossip.rb
lib/inch_ci/gossip.rb
require 'net/http' require 'uri' module InchCI module Gossip def self.load_config filename = File.join(Rails.root, "config", "gossip.yml") if File.exist?(filename) YAML.load(File.read(filename)) else {} end end GOSSIP_HOST = load_config['server'] GOSSIP_ACTIVE = GOSSIP_HOST.to_s != "" GOSSIP_URL = "http://#{GOSSIP_HOST}/projects/:event_name" class << self def new_build(build, project, branch) return if inactive? post('new_build', build, project, branch) end def update_build(build, project, branch) return if inactive? post('update_build', build, project, branch) end private def inactive? !GOSSIP_ACTIVE end def post(event_name, build, project, branch) Net::HTTP.post_form url(event_name), payload(build, project, branch) rescue StandardError => e Rails.logger.warn "Gossip: #{e}" end def url(event_name) URI(GOSSIP_URL.gsub(':event_name', event_name)) end def payload(build, project, branch) { "build_number" => build.number, "build_id" => build.id, "build_status" => build.status, "build_url" => "/builds/#{build.id}.json", "build_started_at" => build.started_at, "project_uid" => project.uid, "branch_name" => branch.name } 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/diff.rb
lib/inch_ci/diff.rb
module InchCI class Diff def initialize(objects1, objects2) @objects1, @objects2 = objects1, objects2 end def comparisons __objects_names.map do |fullname| object1 = @objects1.detect { |o| o.fullname == fullname } object2 = @objects2.detect { |o| o.fullname == fullname } CompareCodeObjects.new(object1, object2) end end private def __objects_names fullnames = @objects1.map(&:fullname) + @objects2.map(&:fullname) fullnames.uniq end class CompareCodeObjects attr_reader :before, :after def initialize(object1, object2) @before, @after = object1, object2 if @before.object_id == @after.object_id raise "@before and @after are identical ruby objects. this is bad." end end def change return 'added' if added? return 'improved' if improved? return 'degraded' if degraded? return 'removed' if removed? end def changed? present? && !unchanged? end def added? @before.nil? && !@after.nil? end def degraded? changed? && @before.score > @after.score end def improved? changed? && @before.score < @after.score end def present? @before && @after end def removed? !@before.nil? && @after.nil? end def unchanged? present? && @before.score == @after.score 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/store.rb
lib/inch_ci/store.rb
module InchCI # ActiveRecordStore provides a thin layer on top of ActiveRecord so we do not # need to use it's API in our own code. module Store FindUser = -> (service_name, user_name) { User.where(:provider => service_name, :user_name => user_name).first } FindUserById = -> (id) { User.find(id) } UpdateLastProjectSync = -> (user, time = Time.now) { user.update_attribute(:last_synced_projects_at, time) } UpdateOrganizations = -> (user, organization_names) { user.update_attribute(:organizations, organization_names) } SaveUser = -> (user) { user.save! } FindProject = -> (uid) { Project.find_by_uid(uid) } FindAllProjects = -> (user = nil) { user.nil? ? Project.all : user.projects } CreateProject = -> (uid, repo_url, origin = nil) { Project.create!(:uid => uid, :repo_url => repo_url, :origin => origin.to_s) } SaveProject = -> (project) { project.save! } UpdateDefaultBranch = -> (project, branch) { project.update_attribute(:default_branch, branch) } # this does not belong here EnsureProject = -> (url, origin = nil) { info = RepoURL.new(url) if info.project_uid Store::FindProject.call(info.project_uid) || Store::CreateProject.call(info.project_uid, info.url, origin) end } # this does not belong here EnsureProjectAndBranch = -> (url, branch_name) { project = Store::EnsureProject.call(url) Store::FindBranch.call(project, branch_name) || Store::CreateBranch.call(project, branch_name) } FindBranch = -> (project, name) { project.branches.where(:name => name).first } CreateBranch = -> (project, name) { project.branches.create!(:name => name) } FindDefaultBranch = -> (project) { project.default_branch || project.branches.first } FindRevision = -> (branch, uid) { branch.revisions.where('uid LIKE ?', "#{uid}%").first } CreateRevision = -> (branch, uid, tag_uid, message, author_name, author_email, badge_in_readme, authored_at) { attributes = { :uid => uid, :tag_uid => tag_uid, :badge_in_readme => badge_in_readme, :message => message, :author_name => author_name, :author_email => author_email, :authored_at => authored_at, } branch.revisions.create!(attributes) } FindLatestRevision = -> (branch) { branch.latest_revision } UpdateLatestRevision = -> (branch, revision) { branch.update_attribute(:latest_revision, revision) } FindRevisionDiffs = -> (branch, count = 200) { branch.revision_diffs.includes(:code_object_diffs).includes(:after_revision).limit(count) } class CreateRevisionDiff attr_reader :revision_diff def self.call(*args) new(*args).revision_diff end def initialize(branch, before_revision, after_revision, diff) @revision_diff = create_revision_diff(branch, before_revision, after_revision) diff.comparisons.each do |comparer| unless comparer.unchanged? create_code_object_diff(comparer) end end end private def create_revision_diff(branch, before_revision, after_revision) attributes = { :before_revision => before_revision, :after_revision => after_revision } branch.revision_diffs.create!(attributes) end def create_code_object_diff(comparer) attributes = { :before_object => comparer.before, :after_object => comparer.after, :change => comparer.change } revision_diff.code_object_diffs.create!(attributes) end end STATUS_SCHEDULED = 'created' FindBuild = -> (id) { Build.find(id) } FindBuilds = -> (count = 200) { Build.order('id DESC').limit(count).includes(:revision).includes(:branch).includes(:project) } FindBuildsInProject = -> (project) { project.builds } FindBuildsInBranch = -> (branch, count = 200) { branch.to_model.builds.preload(:revision, :revision_diff).limit(count) } FindScheduledBuildsInBranch = -> (branch) { branch.to_model.builds.where(:status => STATUS_SCHEDULED) } FindLatestBuildInProject = -> (project) { project.builds.order('id DESC').first } CreateBuild = -> (branch, trigger, status = STATUS_SCHEDULED) do attributes = { :status => status, :trigger => trigger, :number => branch.project.builds.count + 1 } branch.builds.create!(attributes) end RemoveBuild = -> (build) { build.destroy } UpdateFinishedBuild = -> (build, revision, build_data) do attributes = { :revision => revision, :status => build_data.status, :stderr => build_data.stderr, :inch_version => build_data.inch_version, :finished_at => Time.now } build.update_attributes!(attributes) end UpdateBuildStatus = -> (build, status, started_at = nil) do attributes = {:status => status} attributes[:started_at] = started_at if started_at build.update_attributes!(attributes) end FindCodeObject = -> (id) { CodeObject.includes(:code_object_roles).find(id) } FindCodeObjects = -> (revision) { revision.code_objects } FindRelevantCodeObjects = -> (revision) do revision.code_objects.select { |object| object.priority >= Config::MIN_RELEVANT_PRIORITY } end class BuildCodeObject attr_reader :code_object def self.call(*args) new(*args).code_object end def initialize(revision, attributes) @code_object = build_code_object(revision, attributes) end private def build_code_object(revision, attributes) roles = attributes.delete('roles') || [] code_object = CodeObject.new(attributes) code_object.project = revision.branch.project roles.each do |attributes| build_code_object_role(code_object, attributes) end code_object end def build_code_object_role(code_object, attributes) name = attributes.delete('name') role_name = ensure_role_name(name) attributes.merge!(:code_object_role_name => role_name) code_object.code_object_roles.build(attributes) end def ensure_role_name(name) CodeObjectRoleName.find_by_name(name) || CodeObjectRoleName.create(:name => name) end end class CreateCodeObject attr_reader :code_object def self.call(*args) new(*args).code_object end def initialize(revision, attributes) @code_object = find_or_create_code_object(revision, attributes) create_code_object_reference(revision) end private def create_code_object_reference(revision) revision.code_object_references.create!(:code_object => @code_object) end def find_or_create_code_object(revision, attributes) code_object = BuildCodeObject.call(revision, attributes) digest = DigestCodeObject.call(code_object) if object = find_code_object(code_object.project, digest) object else code_object.digest = digest code_object.save! code_object end end def find_code_object(project, digest) CodeObject.where(:project_id => project.id, :digest => digest).first end end class DigestCodeObject attr_reader :digest def self.call(*args) new(*args).digest end def initialize(code_object) hash = attributes_for_code_object(code_object) @digest = Digest::SHA1.base64digest(hash.to_yaml) end def attributes_for_code_object(object) attributes = data_attributes(object) attributes['roles'] = object.code_object_roles.map do |role| attributes_for_code_object_role(role) end attributes end def attributes_for_code_object_role(role) attributes = data_attributes(role) attributes['name'] = role.code_object_role_name.name attributes end # Returns all attributes except # id, digest, created_at, updated_at and all attributes ending in *_id # def data_attributes(object) object.attributes.delete_if do |k,v| k =~ /^(created_at|updated_at|digest|id)$/ || k =~ /_id$/ end end end def self.transaction(&block) ActiveRecord::Base.transaction(&block) end CreateStats = -> (name, value, date = Time.now.midnight) { Statistics.create!(:date => date, :name => name, :value => value) } CreateOrUpdateStats = -> (name, value, date = Time.now.midnight) { existing = Statistics.where(:date => date, :name => name).first if existing existing.update_attribute(:value, value) else Statistics.create!(:date => date, :name => name, :value => value) end } IncreaseStats = -> (name, date = Time.now.midnight, init_value = 0) { stat = Statistics.where(:date => date, :name => name).first if stat stat.update_attribute(:value, stat.value + 1) stat else Statistics.create!(:date => date, :name => name, :value => init_value + 1) 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/git_hub_info.rb
lib/inch_ci/git_hub_info.rb
require 'open-uri' require 'inch_ci/access_token' module InchCI # Retrieves project specific information via the GitHub API. module GitHubInfo def self.client @client ||= begin options = if AccessToken[:github_client_id] && AccessToken[:github_secret] {:client_id => AccessToken[:github_client_id], :client_secret => AccessToken[:github_secret]} else {:access_token => AccessToken[:github]} end Octokit::Client.new(options.merge(:per_page => 100)) end end def self.repo(nwo) Repo.new(client.repository(nwo)) end def self.user(user_name) User.new(user_name) end class User attr_reader :repos def initialize(user_name) @client = GitHubInfo.client @user_name = user_name @repos = [] retrieve_repos end private def retrieve_repos(page = 1) @repos.concat @client.repos(@user_name, :page => page) retrieve_repos(page + 1) if @client.last_response.rels[:next] end end class Repo # @param nwo [String] name with owner (e.g. "rrrene/inch") def initialize(repo) @repo = repo @nwo = repo.full_name end def branches list = GitHubInfo.client.branches(@nwo) list.map { |branch| branch[:name] } end def default_branch @repo[:default_branch] end def fork? @repo[:fork] end def homepage_url @repo[:homepage] end def hooks @client.hooks(@nwo) end def language @repo[:language] end def languages @languages ||= [] # retrieve_languages end def name @repo[:full_name] end def description @repo[:description] end def source_code_url @repo[:html_url] end def documentation_url if language.to_s.downcase == "ruby" "http://rubydoc.info/github/#{@nwo}/master/frames" end end # Used to check if the project is already known. def url RepoURL.new(@repo[:html_url]).repo_url end private def retrieve_languages io = open(@repo.languages_url) hash = JSON.load(io) hash.keys rescue OpenURI::HTTPError p :ERROR => @repo.languages_url [] 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/badge.rb
lib/inch_ci/badge.rb
module InchCI module BadgeMethods IMAGE_FORMATS = %w(png svg) IMAGE_STYLES = %w(default shields flat flat-square) DEFAULT_IMAGE_FORMAT = IMAGE_FORMATS.first DEFAULT_IMAGE_STYLE = IMAGE_STYLES.first def self.included(base) base.extend ClassMethods end def filename(format = DEFAULT_IMAGE_FORMAT, style = DEFAULT_IMAGE_STYLE) unless IMAGE_STYLES.include?(style) style = DEFAULT_IMAGE_STYLE end File.join(*project_triple, "#{branch_name}.#{style}.#{format}") end def local_filename(format = DEFAULT_IMAGE_FORMAT, style = DEFAULT_IMAGE_STYLE) File.join(Rails.root, public_dir, filename(format, style)) end private def public_dir Rails.env.test? ? 'tmp' : 'public' end def project_triple raise "Implement me" end module ClassMethods def each_image_combination IMAGE_FORMATS.each do |format| IMAGE_STYLES.each do |style| yield format, style end end end end end class Badge < Struct.new(:project, :branch) include BadgeMethods def self.create(project, branch, counts) badge = new(project, branch) each_image_combination do |format, style| filename = badge.local_filename(format, style) FileUtils.mkdir_p File.dirname(filename) Inch::Badge::Image.create(filename, counts, {:style => style}) end end private def branch_name branch.name end def project_triple [project.service_name, project.user_name, project.repo_name] end end class BadgeRequest < Struct.new(:service_name, :user_name, :repo_name, :branch_name) include BadgeMethods def project_triple [service_name, user_name, repo_name] 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/grade_list_collection.rb
lib/inch_ci/grade_list_collection.rb
module InchCI class GradeListCollection include Enumerable GRADES = %w(A B C U) def initialize(code_objects) @count = code_objects.count @grade_lists = create_grade_lists(code_objects) @grade_percentages = calculate_grade_percentages(@grade_lists) end def [](grade) @grade_lists[grade] end def each(&block) GRADES.each do |grade| block.call(@grade_lists[grade]) end end def percent(grade) @grade_percentages[grade.to_s] end private def create_grade_lists(code_objects) grade_lists = {} GRADES.each do |grade| grade_lists[grade] = GradeList.new(grade, code_objects) end grade_lists end def calculate_grade_percentages(grade_lists) grade_percentages = {} GRADES.each do |grade| v = @count == 0 ? 0 : (grade_lists[grade.to_s].count / @count.to_f) grade_percentages[grade.to_s] = (v * 100).to_i end residual = 100 - grade_percentages.values.inject(:+) GRADES.reverse.each do |grade| if grade_percentages[grade.to_s] > 0 grade_percentages[grade.to_s] += residual break end end grade_percentages end end class GradeList attr_reader :code_objects, :count, :grade def initialize(grade, code_objects) code_objects ||= [] @grade = grade @code_objects = code_objects.select { |o| o.grade == grade } @count = @code_objects.count 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/controller.rb
lib/inch_ci/controller.rb
module InchCI module Controller def expose(view) view.exposures.each do |name| value = view.send(name) instance_variable_set("@#{name}", value) 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/config.rb
lib/inch_ci/config.rb
module InchCI module Config LANGUAGES_BUILD_LOCALLY = %w(Ruby JavaScript) LANGUAGES_BUILD_EXTERNALLY = %w(Elixir) LANGUAGES = LANGUAGES_BUILD_LOCALLY + LANGUAGES_BUILD_EXTERNALLY MIN_RELEVANT_PRIORITY = 0 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/repo_url.rb
lib/inch_ci/repo_url.rb
module InchCI class RepoURL attr_reader :service, :url def initialize(url) @url = url.to_s.gsub(/(\/)\Z/, '') [@url, @url + '.git'].each do |_url| @service ||= Repomen::Repo::Service.for(_url) end end def project_uid return if service.nil? "#{service.name}:#{service.user_name}/#{service.repo_name}" end def repo_url return if service.nil? if service.name.to_s == 'github' "https://github.com/#{service.user_name}/#{service.repo_name}.git" else url 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/access_token.rb
lib/inch_ci/access_token.rb
module InchCI # Manages access tokens for GitHub et al. class AccessToken def initialize(path) @hash = load_yaml(path) || {} end def [](key) @hash[key.to_s] end private def load_yaml(path) YAML.load_file(path) rescue Errno::ENOENT nil end class << self # Returns an access token for the given +service+ def [](service) all[service.to_s] end # @return [Hash] all access tokens def all @all ||= new(File.join("config", "access_tokens.yml")) 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/action.rb
lib/inch_ci/action.rb
require 'inch_ci/project_uid' module InchCI module Action def self.included(other) other.extend(ClassMethods) end def exposures self.class.exposures end module ClassMethods attr_accessor :exposure_map def exposes(*names) exposures.concat names attr_reader *names end def exposures self.exposure_map ||= {} self.exposure_map[self.to_s] ||= [] end end class FindProjectAndBranch attr_reader :project, :branch def self.call(*args) new(*args) end def initialize(params) uid = ProjectUID.new(params).project_uid @project = InchCI::Store::FindProject.call(uid) @branch = find_branch(params[:branch]) if !@project.nil? end private def find_branch(branch_name) if branch_name InchCI::Store::FindBranch.call(project, branch_name) else InchCI::Store::FindDefaultBranch.call(project) end end end class EnsureProjectAndBranch attr_reader :project, :branch def self.call(*args) new(*args).branch end def initialize(url_or_params, branch_name, origin = nil) @project = InchCI::Store::EnsureProject.call(project_url(url_or_params), origin) @project = update_project(@project) if !@project.default_branch if branch_name.nil? @branch = InchCI::Store::FindDefaultBranch.call(@project) else @branch = InchCI::Store::EnsureProjectAndBranch.call(project_url(url_or_params), branch_name) end end private def project_url(url_or_params) if url_or_params.is_a?(Hash) ProjectUID.new(url_or_params).repo_url else RepoURL.new(url_or_params).repo_url end end def update_project(project) worker = InchCI::Worker::Project::UpdateInfo.new worker.perform(project.uid) InchCI::Store::FindProject.call(project.uid) 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.rb
lib/inch_ci/worker/project.rb
require 'inch_ci/worker/project/build' require 'inch_ci/worker/project/build_json' require 'inch_ci/worker/project/build_tags' require 'inch_ci/worker/project/update_hook' require 'inch_ci/worker/project/update_info' module InchCI module Worker module Project EXTERNALLY_BUILD = ['elixir'] # @return [Boolean] # whether or not the given +language+ can be built locally on Inch CI def self.build_on_inch_ci?(language) !EXTERNALLY_BUILD.include?(language.to_s.downcase) 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/user.rb
lib/inch_ci/worker/user.rb
require 'inch_ci/worker/user/update_projects' module InchCI module Worker module User 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/user/update_projects.rb
lib/inch_ci/worker/user/update_projects.rb
require 'inch_ci/git_hub_info' module InchCI module Worker module User # The UpdateProjects worker is responsible for updating a user's # projects. class UpdateProjects include Sidekiq::Worker ORIGIN = 'github_sync' TRIGGER = 'github_sync' # @param id [Fixnum] the user's ID # @return [void] def self.enqueue(id) perform_async(id) end # @api private def perform(id) user = Store::FindUserById.call(id) service_name = user.provider if service_name == "github" update_via_github(user) end end private def update_via_github(user) update_organizations_via_github(user) update_projects_via_github(user) Store::UpdateLastProjectSync.call(user) end def update_projects_via_github(user) github = GitHubInfo.user(user.user_name) github.repos.each do |_repo| repo = GitHubInfo::Repo.new(_repo) unless repo.fork? project = ensure_project_and_branch(repo.url, repo.default_branch) update_project(project, repo, user) #build(project) if project.language == 'Ruby' && project.builds.count == 0 end end end def update_organizations_via_github(user) client = Octokit::Client.new(access_token: user.github_access_token) list = client.organizations || [] unless list.empty? names = list.map { |hash| hash['login'] } Store::UpdateOrganizations.call(user, names) end end def ensure_project_and_branch(url, branch_name) project = Store::EnsureProject.call(url, ORIGIN) Store::FindBranch.call(project, branch_name) || Store::CreateBranch.call(project, branch_name) project end def update_project(project, repo, user) Worker::Project::UpdateInfo.new.perform(project.uid, repo) end def build(project) InchCI::Worker::Project::Build.enqueue project.repo_url, project.default_branch.name, nil, TRIGGER 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.rb
lib/inch_ci/worker/project/build.rb
require 'inch_ci/worker/project/build/handle_worker_output' require 'inch_ci/gossip' require 'open3' module InchCI module Worker module Project STATUS_SCHEDULED = Store::STATUS_SCHEDULED STATUS_CANCELLED = 'cancelled' STATUS_RUNNING = 'running' # The Build worker is responsible for "building" projects, # i.e. cloning and analysing repos, by utilizing a gem called # "inch_ci-worker". module Build # @param url [String] # @param branch_name [String] # @param revision_uid [String] # @param trigger [String] # @return [Build] def self.enqueue(url, branch_name = 'master', revision_uid = nil, trigger = 'manual') branch = Store::EnsureProjectAndBranch.call(url, branch_name) project = branch.project 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(url, branch_name, revision_uid, trigger, build.id, project.language) build 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" # @api private def perform(url, branch_name = 'master', revision_uid = nil, trigger = 'manual', build_id = nil, language = nil) build = ensure_running_build(url, branch_name, trigger, build_id) if build.status == STATUS_RUNNING cmd = "#{BIN} #{url.inspect} #{branch_name} #{revision_uid}" cmd << " --language=#{language}" if language stdout_str, stderr_str, status = Open3.capture3(cmd) 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, STATUS_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