source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/parser_file.rb | Ruby | mit | 7,519 | master | 3,083 | # frozen_string_literal: true
module GitHubChangelogGenerator
ParserError = Class.new(StandardError)
# ParserFile is a configuration file reader which sets options in the
# given Hash.
#
# In your project's root, you can put a file named
# <tt>.github_changelog_generator</tt> to override defaults.
#
#... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/helper.rb | Ruby | mit | 7,519 | master | 911 | # frozen_string_literal: true
require "logger"
require "rainbow"
module GitHubChangelogGenerator
module Helper
# @return true if the currently running program is a unit test
def self.test?
defined? SpecHelper
end
# :nocov:
@log ||= if test?
Logger.new(nil) # don't show any ... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/entry.rb | Ruby | mit | 7,519 | master | 8,850 | # frozen_string_literal: true
require_relative "section"
module GitHubChangelogGenerator
# This class generates the content for a single changelog entry. An entry is
# generally either for a specific tagged release or the collection of
# unreleased changes.
#
# An entry is comprised of header text followed ... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/generator.rb | Ruby | mit | 7,519 | master | 6,717 | # frozen_string_literal: true
require_relative "../octo_fetcher"
require_relative "generator_fetcher"
require_relative "generator_processor"
require_relative "generator_tags"
require_relative "entry"
require_relative "section"
module GitHubChangelogGenerator
# Default error for ChangelogGenerator
class ChangelogG... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/generator_tags.rb | Ruby | mit | 7,519 | master | 7,119 | # frozen_string_literal: true
module GitHubChangelogGenerator
class Generator
# fetch, filter tags, fetch dates and sort them in time order
def fetch_and_filter_tags
since_tag
due_tag
all_tags = @fetcher.fetch_all_tags
fetch_tags_dates(all_tags) # Creates a Hash @tag_times_hash
... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/section.rb | Ruby | mit | 7,519 | master | 4,103 | # frozen_string_literal: true
module GitHubChangelogGenerator
# This class generates the content for a single section of a changelog entry.
# It turns the tagged issues and PRs into a well-formatted list of changes to
# be later incorporated into a changelog entry.
#
# @see GitHubChangelogGenerator::Entry
... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/generator_processor.rb | Ruby | mit | 7,519 | master | 7,967 | # frozen_string_literal: true
module GitHubChangelogGenerator
class Generator
# delete all issues with labels from options[:exclude_labels] array
# @param [Array] issues
# @return [Array] filtered array
def exclude_issues_by_labels(issues)
return issues if !options[:exclude_labels] || options[:... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/generator_fetcher.rb | Ruby | mit | 7,519 | master | 8,114 | # frozen_string_literal: true
module GitHubChangelogGenerator
class Generator
# Fetch event for issues and pull requests
# @return [Array] array of fetched issues
def fetch_events_for_issues_and_pr
print "Fetching events for issues and PR: 0/#{@issues.count + @pull_requests.count}\r" if options[:ve... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/spec_helper.rb | Ruby | mit | 7,519 | master | 1,985 | # frozen_string_literal: true
#
# Author:: Enrico Stahn <mail@enricostahn.com>
#
# Copyright 2014, Zanui, <engineering@zanui.com.au>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/github_changelog_generator_spec.rb | Ruby | mit | 7,519 | master | 1,059 | # frozen_string_literal: true
RSpec.describe GitHubChangelogGenerator::ChangelogGenerator do
describe "#run" do
let(:arguments) { [] }
let(:instance) { described_class.new(arguments) }
let(:output_path) { File.join(__dir__, "tmp", "test.output") }
after { FileUtils.rm_rf(output_path) }
let(:ge... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/reader_spec.rb | Ruby | mit | 7,519 | master | 4,861 | # frozen_string_literal: true
#
# Author:: Enrico Stahn <mail@enricostahn.com>
#
# Copyright 2014, Zanui, <engineering@zanui.com.au>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/octo_fetcher_spec.rb | Ruby | mit | 7,519 | master | 31,469 | # frozen_string_literal: true
VALID_TOKEN = "0123456789abcdef"
INVALID_TOKEN = "0000000000000000"
describe GitHubChangelogGenerator::OctoFetcher do
let(:options) do
{
user: "github-changelog-generator",
project: "changelog_test"
}
end
let(:fetcher) { GitHubChangelogGenerator::OctoFetcher.ne... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/options_spec.rb | Ruby | mit | 7,519 | master | 1,524 | # frozen_string_literal: true
RSpec.describe GitHubChangelogGenerator::Options do
describe "#initialize" do
context "with known options" do
it "instantiates successfully" do
expect(described_class.new(user: "olle")[:user]).to eq("olle")
end
end
context "with unknown options" do
... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/parser_spec.rb | Ruby | mit | 7,519 | master | 1,989 | # frozen_string_literal: true
describe GitHubChangelogGenerator::Parser do
let(:argv) { [] }
before do
# Calling abort will abort the test run, allow calls to abort to not accidentaly get positive falses
allow(Kernel).to receive(:abort)
end
describe ".parse_options" do
context "when required argu... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/parser_file_spec.rb | Ruby | mit | 7,519 | master | 2,944 | # frozen_string_literal: true
describe GitHubChangelogGenerator::ParserFile do
describe ".github_changelog_generator" do
let(:options) { {} }
let(:parser) { described_class.new(options, StringIO.new(file)) }
context "when the well-known default file does not exist" do
let(:parser) { described_clas... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/generator/generator_tags_spec.rb | Ruby | mit | 7,519 | master | 11,653 | # frozen_string_literal: true
describe GitHubChangelogGenerator::Generator do
def tag_with_name(tag)
{
"name" => tag
}
end
def tags_from_strings(tags_strings)
tags_strings.map do |tag|
tag_with_name(tag)
end
end
describe "#detect_link_tag_time" do
let(:newer_tag) { nil }
... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/generator/generator_spec.rb | Ruby | mit | 7,519 | master | 7,402 | # frozen_string_literal: true
require "github_changelog_generator/generator/generator"
RSpec.describe GitHubChangelogGenerator::Generator do
let(:header) { "# Changelog" }
let(:generator) { described_class.new({ header: header }) }
let(:content) do
<<~'BASE'
## [1.3.10](https://github.com/xxx/yyy/tree... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/generator/generator_processor_spec.rb | Ruby | mit | 7,519 | master | 6,719 | # frozen_string_literal: true
module GitHubChangelogGenerator
describe Generator do
let(:default_options) { GitHubChangelogGenerator::Parser.default_options.merge(verbose: false) }
let(:options) { {} }
let(:generator) { described_class.new(default_options.merge(options)) }
let(:bad_label) { { "name" ... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/generator/entry_spec.rb | Ruby | mit | 7,519 | master | 37,188 | # frozen_string_literal: true
module GitHubChangelogGenerator
RSpec.describe Entry do
def label(name)
{ "name" => name }
end
def issue(title, labels, body = "", number = "1", user = { "login" => "user" })
{
"title" => "issue #{title}",
"labels" => labels.map { |l| label(l) },... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | spec/unit/generator/section_spec.rb | Ruby | mit | 7,519 | master | 1,321 | # frozen_string_literal: true
module GitHubChangelogGenerator
RSpec.describe Section do
let(:options) { {} }
subject(:section) { described_class.new(options) }
describe "#encapsulate_string" do
let(:string) { "" }
context "with the empty string" do
it "returns the string" do
... |
github | realm/jazzy | https://github.com/realm/jazzy | Rakefile | Ruby | mit | 7,381 | master | 4,678 | # frozen_string_literal: true
#-- Bootstrap --------------------------------------------------------------#
desc 'Initializes your working copy to run the specs'
task :bootstrap do
if system('which bundle')
title 'Installing gems'
sh 'bundle install'
title 'Updating submodules'
sh 'git submodule up... |
github | realm/jazzy | https://github.com/realm/jazzy | Gemfile | Ruby | mit | 7,381 | master | 381 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec
group :development do
# Code style
gem 'rubocop', '~> 1.18'
# Tests
gem 'bacon'
gem 'mocha'
gem 'mocha-on-bacon'
gem 'prettybacon'
gem 'webmock'
# Integration tests
gem 'clintegracon', git: 'https://github.com/mrackwitz/CLInteg... |
github | realm/jazzy | https://github.com/realm/jazzy | Dangerfile | Ruby | mit | 7,381 | master | 1,222 | # frozen_string_literal: true
# Warn when there is a big PR
warn('Big PR') if git.lines_of_code > 500
# Don't let testing shortcuts get into master by accident
(git.modified_files + git.added_files - %w[Dangerfile]).each do |file|
next unless File.file?(file)
contents = File.read(file)
if file.start_with?('spe... |
github | realm/jazzy | https://github.com/realm/jazzy | jazzy.gemspec | Ruby | mit | 7,381 | master | 1,431 | # coding: utf-8
# frozen_string_literal: true
require File.expand_path('lib/jazzy/gem_version.rb', File.dirname(__FILE__))
Gem::Specification.new do |spec|
spec.name = 'jazzy'
spec.version = Jazzy::VERSION
spec.authors = ['JP Simard', 'Tim Anglade', 'Samuel Giddins', 'John Fairhurst']
spe... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/search_builder.rb | Ruby | mit | 7,381 | master | 582 | # frozen_string_literal: true
module Jazzy
module SearchBuilder
def self.build(source_module, output_dir)
decls = source_module.all_declarations.select do |d|
d.type && d.name && !d.name.empty?
end
index = decls.to_h do |d|
[d.url,
{
name: d.name,
... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/highlighter.rb | Ruby | mit | 7,381 | master | 743 | # frozen_string_literal: true
require 'rouge'
module Jazzy
# This module helps highlight code
module Highlighter
SWIFT = 'swift'
OBJC = 'objective_c'
class Formatter < Rouge::Formatters::HTML
def initialize(language)
@language = language
super()
end
def stream(token... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/source_declaration.rb | Ruby | mit | 7,381 | master | 8,615 | # frozen_string_literal: true
require 'jazzy/source_declaration/access_control_level'
require 'jazzy/source_declaration/type'
module Jazzy
# rubocop:disable Metrics/ClassLength
class SourceDeclaration
# kind of declaration (e.g. class, variable, function)
attr_accessor :type
# static type of declared ... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/grouper.rb | Ruby | mit | 7,381 | master | 4,682 | # frozen_string_literal: true
module Jazzy
# This module deals with arranging top-level declarations and guides into
# groups automatically and/or using a custom list.
module Grouper
extend Config::Mixin
# Group root-level docs by custom categories (if any) and type or module
def self.group_docs(doc... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/jazzy_markdown.rb | Ruby | mit | 7,381 | master | 8,977 | # frozen_string_literal: true
require 'redcarpet'
require 'rouge'
require 'rouge/plugins/redcarpet'
module Jazzy
module Markdown
# Publish if generated HTML needs math support
class << self; attr_accessor :has_math; end
module Footnotes
# Global unique footnote ID
def self.next_footnote
... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/source_host.rb | Ruby | mit | 7,381 | master | 2,510 | # frozen_string_literal: true
module Jazzy
# Deal with different source code repositories
module SourceHost
# Factory to create the right source host
def self.create(options)
return unless options.source_host_url || options.source_host_files_url
case options.source_host
when :github then... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/stats.rb | Ruby | mit | 7,381 | master | 2,079 | # frozen_string_literal: true
module Jazzy
# Collect + report metadata about a processed module
class Stats
include Config::Mixin
attr_reader :documented, :acl_skipped, :spi_skipped, :undocumented_decls
def add_documented
@documented += 1
end
def add_acl_skipped
@acl_skipped += 1... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/doc_builder.rb | Ruby | mit | 7,381 | master | 17,090 | # frozen_string_literal: true
require 'fileutils'
require 'mustache'
require 'pathname'
require 'sassc'
require 'jazzy/config'
require 'jazzy/doc'
require 'jazzy/docset_builder'
require 'jazzy/documentation_generator'
require 'jazzy/search_builder'
require 'jazzy/jazzy_markdown'
require 'jazzy/podspec_documenter'
req... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/executable.rb | Ruby | mit | 7,381 | master | 1,142 | # frozen_string_literal: true
module Jazzy
module Executable
class IO < Array
def initialize(io = nil)
super()
@io = io
end
def <<(value)
super
ensure
@io << value.to_s if @io
end
def to_s
join("\n")
end
end
class << sel... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/source_module.rb | Ruby | mit | 7,381 | master | 1,309 | # frozen_string_literal: true
require 'uri'
require 'jazzy/config'
require 'jazzy/source_declaration'
require 'jazzy/source_host'
module Jazzy
# A cache of info that is common across all page templating, gathered
# from other parts of the program.
class SourceModule
include Config::Mixin
attr_accessor... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/source_mark.rb | Ruby | mit | 7,381 | master | 1,323 | # frozen_string_literal: true
module Jazzy
class SourceMark
attr_accessor :name
attr_accessor :has_start_dash
attr_accessor :has_end_dash
def initialize(mark_string = nil)
return unless mark_string
# Format: 'MARK: - NAME -' with dashes optional
mark_content = mark_string.sub(/^MA... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/podspec_documenter.rb | Ruby | mit | 7,381 | master | 5,693 | # frozen_string_literal: true
require 'tmpdir'
require 'json'
module Jazzy
# rubocop:disable Metrics/ClassLength
class PodspecDocumenter
attr_reader :podspec
def initialize(podspec)
@podspec = podspec
end
# Build documentation from the given options
# @param [Config] options
def so... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/documentation_generator.rb | Ruby | mit | 7,381 | master | 795 | # frozen_string_literal: true
require 'pathname'
require 'jazzy/jazzy_markdown'
require 'jazzy/source_document'
module Jazzy
module DocumentationGenerator
extend Config::Mixin
def self.source_docs
documentation_entries.map do |file_path|
SourceDocument.new.tap do |sd|
sd.name = Fil... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/sourcekitten.rb | Ruby | mit | 7,381 | master | 39,090 | # frozen_string_literal: true
require 'json'
require 'pathname'
require 'shellwords'
require 'xcinvoke'
require 'cgi'
require 'rexml/document'
require 'jazzy/config'
require 'jazzy/executable'
require 'jazzy/highlighter'
require 'jazzy/source_declaration'
require 'jazzy/source_mark'
require 'jazzy/stats'
require 'jaz... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/doc_index.rb | Ruby | mit | 7,381 | master | 6,342 | # frozen_string_literal: true
module Jazzy
# This class stores an index of symbol names for doing name lookup
# when resolving custom categories and autolinks.
class DocIndex
# A node in the index tree. The root has no decl; its children are
# per-module indexed by module names. The second level, where... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/symbol_graph.rb | Ruby | mit | 7,381 | master | 3,788 | # frozen_string_literal: true
require 'set'
require 'jazzy/symbol_graph/graph'
require 'jazzy/symbol_graph/constraint'
require 'jazzy/symbol_graph/symbol'
require 'jazzy/symbol_graph/relationship'
require 'jazzy/symbol_graph/sym_node'
require 'jazzy/symbol_graph/ext_node'
require 'jazzy/symbol_graph/ext_key'
# This i... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/doc.rb | Ruby | mit | 7,381 | master | 1,522 | # frozen_string_literal: true
require 'date'
require 'pathname'
require 'mustache'
require 'jazzy/config'
require 'jazzy/gem_version'
require 'jazzy/jazzy_markdown'
module Jazzy
class Doc < Mustache
include Config::Mixin
self.template_name = 'doc'
def copyright
copyright = config.copyright || (... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/config.rb | Ruby | mit | 7,381 | master | 28,177 | # frozen_string_literal: true
require 'optparse'
require 'pathname'
require 'uri'
require 'jazzy/podspec_documenter'
require 'jazzy/source_declaration/access_control_level'
module Jazzy
# rubocop:disable Metrics/ClassLength
class Config
# rubocop:disable Naming/AccessorMethodName
class Attribute
at... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/docset_builder.rb | Ruby | mit | 7,381 | master | 4,161 | # frozen_string_literal: true
require 'mustache'
require 'sqlite3'
module Jazzy
module DocBuilder
# Follows the instructions found at https://kapeli.com/docsets#dashDocset.
class DocsetBuilder
include Config::Mixin
attr_reader :output_dir
attr_reader :generated_docs_dir
attr_reader ... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/source_document.rb | Ruby | mit | 7,381 | master | 1,975 | # frozen_string_literal: true
require 'pathname'
require 'jazzy/jazzy_markdown'
module Jazzy
# Standalone markdown docs including index.html
class SourceDocument < SourceDeclaration
attr_accessor :overview
attr_accessor :readme_path
def initialize
super
self.children = []
self.para... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/symbol_graph/sym_node.rb | Ruby | mit | 7,381 | master | 4,516 | # frozen_string_literal: true
module Jazzy
module SymbolGraph
# The rebuilt syntax tree is made of nodes that either match
# symbols or that we fabricate for extensions. This is the common
# treeishness.
class BaseNode
attr_accessor :children # array, can be empty
attr_accessor :parent #... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/symbol_graph/graph.rb | Ruby | mit | 7,381 | master | 7,124 | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
module Jazzy
module SymbolGraph
# A Graph is the coordinator to import a symbolgraph json file.
# Deserialize it to Symbols and Relationships, then rebuild
# the AST shape using SymNodes and ExtNodes and extract SourceKit json.
class... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/symbol_graph/constraint.rb | Ruby | mit | 7,381 | master | 2,576 | # frozen_string_literal: true
module Jazzy
module SymbolGraph
# Constraint is a tidied-up JSON object, used by both Symbol and
# Relationship, and key to reconstructing extensions.
class Constraint
attr_accessor :kind
attr_accessor :lhs
attr_accessor :rhs
private
def initi... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/symbol_graph/relationship.rb | Ruby | mit | 7,381 | master | 1,916 | # frozen_string_literal: true
module Jazzy
module SymbolGraph
# A Relationship is a tidied-up SymbolGraph JSON object
class Relationship
attr_accessor :kind
attr_accessor :source_usr
attr_accessor :target_usr
attr_accessor :target_fallback # can be nil
attr_accessor :constraints... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/symbol_graph/ext_node.rb | Ruby | mit | 7,381 | master | 3,994 | # frozen_string_literal: true
require 'set'
module Jazzy
module SymbolGraph
# For extensions we need to track constraints of the extended type
# and the constraints introduced by the extension.
class ExtConstraints
attr_accessor :type # array
attr_accessor :ext # array
# all constrain... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/symbol_graph/symbol.rb | Ruby | mit | 7,381 | master | 8,818 | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
module Jazzy
module SymbolGraph
# A Symbol is a tidied-up SymbolGraph JSON object
class Symbol
attr_accessor :usr
attr_accessor :path_components
attr_accessor :declaration
attr_accessor :kind
attr_accessor :acl
... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/symbol_graph/ext_key.rb | Ruby | mit | 7,381 | master | 882 | # frozen_string_literal: true
module Jazzy
module SymbolGraph
# An ExtKey identifies an extension of a type, made up of the USR of
# the type and the constraints of the extension. With Swift 5.9 extension
# symbols, the USR is the 'fake' USR invented by symbolgraph to solve the
# same problem as thi... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/source_declaration/access_control_level.rb | Ruby | mit | 7,381 | master | 2,733 | # frozen_string_literal: true
module Jazzy
class SourceDeclaration
class AccessControlLevel
include Comparable
# Order matters
LEVELS = %i[private fileprivate internal package public open].freeze
LEVELS_INDEX = LEVELS.to_h { |i| [i, LEVELS.index(i)] }.freeze
attr_reader :level
... |
github | realm/jazzy | https://github.com/realm/jazzy | lib/jazzy/source_declaration/type.rb | Ruby | mit | 7,381 | master | 13,281 | # frozen_string_literal: true
require 'logger'
require 'active_support'
require 'active_support/inflector'
module Jazzy
class SourceDeclaration
# rubocop:disable Metrics/ClassLength
class Type
def self.all
TYPES.keys.map { |k| new(k) }.reject { |t| t.name.nil? }
end
attr_reader :k... |
github | realm/jazzy | https://github.com/realm/jazzy | spec/integration_spec.rb | Ruby | mit | 7,381 | master | 11,866 | # frozen_string_literal: true
# ------------------------------------ #
# Jazzy Integration tests #
# ------------------------------------ #
#-----------------------------------------------------------------------------#
# The following integrations tests are based on file comparison.
#
# 1. For each te... |
github | realm/jazzy | https://github.com/realm/jazzy | spec/spec_helper.rb | Ruby | mit | 7,381 | master | 651 | # frozen_string_literal: true
require 'rubygems'
require 'bundler/setup'
require 'bacon'
require 'mocha-on-bacon'
require 'pretty_bacon'
require 'pathname'
ROOT = Pathname.new(File.expand_path('..', __dir__))
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
require 'jazzy'
require 's... |
github | realm/jazzy | https://github.com/realm/jazzy | spec/spec_helper/pre_flight.rb | Ruby | mit | 7,381 | master | 623 | # frozen_string_literal: true
# Restores the config to the default state before each requirement
module Bacon
class Context
old_run_requirement = instance_method(:run_requirement)
define_method(:run_requirement) do |description, spec|
temporary_directory = SpecHelper.temporary_directory
::Jazz... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | Rakefile | Ruby | mit | 7,313 | main | 1,186 | $LOAD_PATH.unshift File.expand_path('lib', __dir__)
require 'bundler'
Bundler.setup
require 'rake'
require 'rspec'
require 'rspec/core/rake_task'
require 'bullet/version'
task :build do
system 'gem build bullet.gemspec'
end
task install: :build do
system "sudo gem install bullet-#{Bullet::VERSION}.gem"
end
tas... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | bullet.gemspec | Ruby | mit | 7,313 | main | 1,227 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
require 'bullet/version'
Gem::Specification.new do |s|
s.name = 'bullet'
s.version = Bullet::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Richard Huang']
s... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | Gemfile | Ruby | mit | 7,313 | main | 499 | source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end
gemspec
gem 'rails', github: 'rails'
gem 'sqlite3', platforms: [:ruby]
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
gem ... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | Guardfile | Ruby | mit | 7,313 | main | 334 | # A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'rspec', version: 2, all_after_pass: false, all_on_start: false, cli: '--color --format nested --fail-fast' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') {... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet.rb | Ruby | mit | 7,313 | main | 9,490 | # frozen_string_literal: true
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/module/delegation'
require 'set'
require 'uniform_notifier'
require 'bullet/ext/object'
require 'bullet/ext/string'
require 'bullet/dependency'
require 'bullet/stack_trace_filter'
module Bullet
extend... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/generators/bullet/install_generator.rb | Ruby | mit | 7,313 | main | 1,261 | # frozen_string_literal: true
module Bullet
module Generators
class InstallGenerator < ::Rails::Generators::Base
desc <<~DESC
Description:
Enable bullet in development/test for your application.
DESC
def enable_in_development
environment(nil, env: 'development') do
... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/dependency.rb | Ruby | mit | 7,313 | main | 3,898 | # frozen_string_literal: true
module Bullet
module Dependency
def mongoid?
@mongoid ||= defined?(::Mongoid)
end
def active_record?
@active_record ||= defined?(::ActiveRecord)
end
def active_record_version
@active_record_version ||=
begin
if active_record40?
... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/mongoid6x.rb | Ruby | mit | 7,313 | main | 1,859 | # frozen_string_literal: true
module Bullet
module Mongoid
def self.enable
require 'mongoid'
::Mongoid::Contextual::Mongo.class_eval do
alias_method :origin_first, :first
alias_method :origin_last, :last
alias_method :origin_each, :each
alias_method :origin_eager_load,... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/mongoid8x.rb | Ruby | mit | 7,313 | main | 1,904 | module Bullet
module Mongoid
def self.enable
require 'mongoid'
::Mongoid::Contextual::Mongo.class_eval do
alias_method :origin_first, :first
alias_method :origin_last, :last
alias_method :origin_each, :each
alias_method :origin_eager_load, :eager_load
def first... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record81.rb | Ruby | mit | 7,313 | main | 12,157 | # frozen_string_literal: true
module Bullet
module SaveWithBulletSupport
def _create_record(*)
super do
Bullet::Detector::NPlusOneQuery.update_inversed_object(self)
Bullet::Detector::NPlusOneQuery.add_impossible_object(self)
yield(self) if block_given?
end
end
end
mod... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record61.rb | Ruby | mit | 7,313 | main | 11,697 | # frozen_string_literal: true
module Bullet
module SaveWithBulletSupport
def _create_record(*)
super do
Bullet::Detector::NPlusOneQuery.update_inversed_object(self)
Bullet::Detector::NPlusOneQuery.add_impossible_object(self)
yield(self) if block_given?
end
end
end
mod... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record60.rb | Ruby | mit | 7,313 | main | 11,631 | # frozen_string_literal: true
module Bullet
module SaveWithBulletSupport
def _create_record(*)
super do
Bullet::Detector::NPlusOneQuery.update_inversed_object(self)
Bullet::Detector::NPlusOneQuery.add_impossible_object(self)
yield(self) if block_given?
end
end
end
mod... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/notification_collector.rb | Ruby | mit | 7,313 | main | 340 | # frozen_string_literal: true
require 'set'
module Bullet
class NotificationCollector
attr_reader :collection
def initialize
reset
end
def reset
@collection = Set.new
end
def add(value)
@collection << value
end
def notifications_present?
!@collection.empty... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record80.rb | Ruby | mit | 7,313 | main | 12,110 | # frozen_string_literal: true
module Bullet
module SaveWithBulletSupport
def _create_record(*)
super do
Bullet::Detector::NPlusOneQuery.update_inversed_object(self)
Bullet::Detector::NPlusOneQuery.add_impossible_object(self)
yield(self) if block_given?
end
end
end
mod... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/mongoid9x.rb | Ruby | mit | 7,313 | main | 2,352 | # frozen_string_literal: true
module Bullet
module Mongoid
def self.enable
require 'mongoid'
require 'rubygems'
::Mongoid::Contextual::Mongo.class_eval do
alias_method :origin_first, :first
alias_method :origin_last, :last
alias_method :origin_each, :each
alias_m... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/mongoid7x.rb | Ruby | mit | 7,313 | main | 2,351 | # frozen_string_literal: true
module Bullet
module Mongoid
def self.enable
require 'mongoid'
require 'rubygems'
::Mongoid::Contextual::Mongo.class_eval do
alias_method :origin_first, :first
alias_method :origin_last, :last
alias_method :origin_each, :each
alias_m... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/notification.rb | Ruby | mit | 7,313 | main | 390 | # frozen_string_literal: true
module Bullet
module Notification
autoload :Base, 'bullet/notification/base'
autoload :UnusedEagerLoading, 'bullet/notification/unused_eager_loading'
autoload :NPlusOneQuery, 'bullet/notification/n_plus_one_query'
autoload :CounterCache, 'bullet/notification/counter_cach... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record70.rb | Ruby | mit | 7,313 | main | 12,090 | # frozen_string_literal: true
module Bullet
module SaveWithBulletSupport
def _create_record(*)
super do
Bullet::Detector::NPlusOneQuery.update_inversed_object(self)
Bullet::Detector::NPlusOneQuery.add_impossible_object(self)
yield(self) if block_given?
end
end
end
mod... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record4.rb | Ruby | mit | 7,313 | main | 7,766 | # frozen_string_literal: true
module Bullet
module ActiveRecord
def self.enable
require 'active_record'
::ActiveRecord::Base.class_eval do
class << self
alias_method :origin_find_by_sql, :find_by_sql
def find_by_sql(sql, binds = [])
result = origin_find_by_sql(... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record5.rb | Ruby | mit | 7,313 | main | 10,953 | # frozen_string_literal: true
module Bullet
module SaveWithBulletSupport
def _create_record(*)
super do
Bullet::Detector::NPlusOneQuery.update_inversed_object(self)
Bullet::Detector::NPlusOneQuery.add_impossible_object(self)
yield(self) if block_given?
end
end
end
mod... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/registry.rb | Ruby | mit | 7,313 | main | 274 | # frozen_string_literal: true
module Bullet
module Registry
autoload :Base, 'bullet/registry/base'
autoload :Object, 'bullet/registry/object'
autoload :Association, 'bullet/registry/association'
autoload :CallStack, 'bullet/registry/call_stack'
end
end |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record41.rb | Ruby | mit | 7,313 | main | 7,494 | # frozen_string_literal: true
module Bullet
module ActiveRecord
def self.enable
require 'active_record'
::ActiveRecord::Base.class_eval do
class << self
alias_method :origin_find_by_sql, :find_by_sql
def find_by_sql(sql, binds = [])
result = origin_find_by_sql(... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_job.rb | Ruby | mit | 7,313 | main | 237 | # frozen_string_literal: true
module Bullet
module ActiveJob
def self.included(base)
base.class_eval do
around_perform do |_job, block|
Bullet.profile { block.call }
end
end
end
end
end |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/mongoid4x.rb | Ruby | mit | 7,313 | main | 1,829 | # frozen_string_literal: true
module Bullet
module Mongoid
def self.enable
require 'mongoid'
::Mongoid::Contextual::Mongo.class_eval do
alias_method :origin_first, :first
alias_method :origin_last, :last
alias_method :origin_each, :each
alias_method :origin_eager_load,... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/rack.rb | Ruby | mit | 7,313 | main | 6,342 | # frozen_string_literal: true
require 'rack/request'
require 'json'
require 'cgi'
module Bullet
class Rack
include Dependency
NONCE_MATCHER = /(script|style)-src .*'nonce-(?<nonce>[A-Za-z0-9+\/]+={0,2})'/
def initialize(app)
@app = app
end
def call(env)
return @app.call(env) unles... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record42.rb | Ruby | mit | 7,313 | main | 10,342 | # frozen_string_literal: true
module Bullet
module ActiveRecord
def self.enable
require 'active_record'
::ActiveRecord::Base.class_eval do
class << self
alias_method :origin_find, :find
def find(*args)
result = origin_find(*args)
if Bullet.start?
... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/detector.rb | Ruby | mit | 7,313 | main | 370 | # frozen_string_literal: true
module Bullet
module Detector
autoload :Base, 'bullet/detector/base'
autoload :Association, 'bullet/detector/association'
autoload :NPlusOneQuery, 'bullet/detector/n_plus_one_query'
autoload :UnusedEagerLoading, 'bullet/detector/unused_eager_loading'
autoload :Counte... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/active_record52.rb | Ruby | mit | 7,313 | main | 10,508 | # frozen_string_literal: true
module Bullet
module SaveWithBulletSupport
def _create_record(*)
super do
Bullet::Detector::NPlusOneQuery.update_inversed_object(self)
Bullet::Detector::NPlusOneQuery.add_impossible_object(self)
yield(self) if block_given?
end
end
end
mod... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/stack_trace_filter.rb | Ruby | mit | 7,313 | main | 1,955 | # frozen_string_literal: true
require "bundler"
using Bullet::Ext::Object
module Bullet
module StackTraceFilter
VENDOR_PATH = '/vendor'
# @param bullet_key[String] - use this to get stored call stack from call_stacks object.
def caller_in_project(bullet_key = nil)
vendor_root = Bullet.app_root +... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/detector/association.rb | Ruby | mit | 7,313 | main | 3,569 | # frozen_string_literal: true
using Bullet::Ext::Object
module Bullet
module Detector
class Association < Base
class << self
def add_object_associations(object, associations)
return unless Bullet.start?
return if !Bullet.n_plus_one_query_enable? && !Bullet.unused_eager_loading_... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/detector/unused_eager_loading.rb | Ruby | mit | 7,313 | main | 3,701 | # frozen_string_literal: true
using Bullet::Ext::Object
using Bullet::Ext::String
module Bullet
module Detector
class UnusedEagerLoading < Association
extend Dependency
extend StackTraceFilter
class << self
# check if there are unused preload associations.
# get related_obje... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/detector/counter_cache.rb | Ruby | mit | 7,313 | main | 2,333 | # frozen_string_literal: true
using Bullet::Ext::Object
module Bullet
module Detector
class CounterCache < Base
class << self
def add_counter_cache(object, associations)
return unless Bullet.start?
return unless Bullet.counter_cache_enable?
return unless object.bullet... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/detector/n_plus_one_query.rb | Ruby | mit | 7,313 | main | 4,972 | # frozen_string_literal: true
using Bullet::Ext::Object
module Bullet
module Detector
class NPlusOneQuery < Association
extend Dependency
extend StackTraceFilter
class << self
# executed when object.associations is called.
# first, it keeps this method call for object.associat... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/notification/unused_eager_loading.rb | Ruby | mit | 7,313 | main | 658 | # frozen_string_literal: true
module Bullet
module Notification
class UnusedEagerLoading < Base
def initialize(callers, base_class, associations, path = nil)
super(base_class, associations, path)
@callers = callers
end
def body
"#{klazz_associations_str}\n Remove from... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/notification/base.rb | Ruby | mit | 7,313 | main | 2,116 | # frozen_string_literal: true
module Bullet
module Notification
class Base
attr_accessor :notifier, :url
attr_reader :base_class, :associations, :path
def initialize(base_class, association_or_associations, path = nil)
@base_class = base_class
@associations =
associat... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/notification/n_plus_one_query.rb | Ruby | mit | 7,313 | main | 646 | # frozen_string_literal: true
module Bullet
module Notification
class NPlusOneQuery < Base
def initialize(callers, base_class, associations, path = nil)
super(base_class, associations, path)
@callers = callers
end
def body
"#{klazz_associations_str}\n Add to your quer... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/notification/counter_cache.rb | Ruby | mit | 7,313 | main | 251 | # frozen_string_literal: true
module Bullet
module Notification
class CounterCache < Base
def body
klazz_associations_str
end
def title
'Need Counter Cache with Active Record size'
end
end
end
end |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/ext/string.rb | Ruby | mit | 7,313 | main | 270 | # frozen_string_literal: true
module Bullet
module Ext
module String
refine ::String do
def bullet_class_name
last_colon = self.rindex(':')
last_colon ? self[0...last_colon].dup : self.dup
end
end
end
end
end |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/ext/object.rb | Ruby | mit | 7,313 | main | 1,024 | # frozen_string_literal: true
module Bullet
module Ext
module Object
refine ::Object do
attr_writer :bullet_key, :bullet_primary_key_value
def bullet_key
return "#{self.class}:" if respond_to?(:persisted?) && !persisted?
@bullet_key ||= "#{self.class}:#{bullet_primary_... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/registry/call_stack.rb | Ruby | mit | 7,313 | main | 419 | # frozen_string_literal: true
module Bullet
module Registry
class CallStack < Base
# remembers found association backtrace
# if backtrace is provided, it will be used and override any existing value
def add(key, backtrace = nil)
if backtrace
@registry[key] = backtrace
... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/registry/base.rb | Ruby | mit | 7,313 | main | 791 | # frozen_string_literal: true
module Bullet
module Registry
class Base
attr_reader :registry
def initialize
@registry = {}
end
def [](key)
@registry[key]
end
def each(&block)
@registry.each(&block)
end
def delete(base)
@registry.... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/registry/association.rb | Ruby | mit | 7,313 | main | 394 | # frozen_string_literal: true
module Bullet
module Registry
class Association < Base
def merge(base, associations)
@registry.merge!(base => associations)
end
def similarly_associated(base, associations)
@registry.select { |key, value| key.include?(base) && value == associations... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | lib/bullet/registry/object.rb | Ruby | mit | 7,313 | main | 348 | # frozen_string_literal: true
using Bullet::Ext::Object
using Bullet::Ext::String
module Bullet
module Registry
class Object < Base
def add(bullet_key)
super(bullet_key.bullet_class_name, bullet_key)
end
def include?(bullet_key)
super(bullet_key.bullet_class_name, bullet_key)
... |
github | flyerhzm/bullet | https://github.com/flyerhzm/bullet | tasks/bullet_tasks.rake | Ruby | mit | 7,313 | main | 221 | # frozen_string_literal: true
namespace :bullet do
namespace :log do
desc 'Truncates the bullet log file to zero bytes'
task :clear do
f = File.open('log/bullet.log', 'w')
f.close
end
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.