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
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet_spec.rb
Ruby
mit
7,313
main
5,796
# frozen_string_literal: true require 'spec_helper' describe Bullet do subject { Bullet } describe '#enable' do context 'enable Bullet' do before do # Bullet.enable # Do nothing. Bullet has already been enabled for the whole test suite. end it 'should be enabled' do ...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/spec_helper.rb
Ruby
mit
7,313
main
2,295
# frozen_string_literal: true require 'rspec' require 'logger' begin require 'active_record' rescue LoadError end begin require 'mongoid' rescue LoadError end module Rails class << self def root File.expand_path(__FILE__).split('/')[0..-3].join('/') end def env 'test' end end end ...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/support/rack_double.rb
Ruby
mit
7,313
main
716
# frozen_string_literal: true module Support class AppDouble def call(_env) env = @env [status, headers, response] end attr_writer :status attr_writer :headers def headers @headers ||= { 'Content-Type' => 'text/html' } @headers end attr_writer :response pr...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/support/sqlite_seed.rb
Ruby
mit
7,313
main
8,828
# frozen_string_literal: true module Support module SqliteSeed module_function def seed_db newspaper1 = Newspaper.create(name: 'First Newspaper') newspaper2 = Newspaper.create(name: 'Second Newspaper') writer1 = Writer.create(name: 'first', newspaper: newspaper1) writer2 = Writer.cr...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/support/mongo_seed.rb
Ruby
mit
7,313
main
2,365
# frozen_string_literal: true module Support module MongoSeed module_function def seed_db category1 = Mongoid::Category.create(name: 'first') category2 = Mongoid::Category.create(name: 'second') post1 = category1.posts.create(name: 'first') post1a = category1.posts.create(name: 'lik...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/support/bullet_ext.rb
Ruby
mit
7,313
main
2,122
# frozen_string_literal: true using Bullet::Ext::Object module Bullet def self.collected_notifications_of_class(notification_class) Bullet.notification_collector.collection.select { |notification| notification.is_a? notification_class } end def self.collected_counter_cache_notifications collected_notif...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/integration/counter_cache_spec.rb
Ruby
mit
7,313
main
3,292
# frozen_string_literal: true require 'spec_helper' if !mongoid? && active_record? describe Bullet::Detector::CounterCache do before(:each) { Bullet.start_request } after(:each) { Bullet.end_request } it 'should need counter cache with all cities' do Country.all.each { |country| country.cities.s...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/integration/mongoid/association_spec.rb
Ruby
mit
7,313
main
11,596
# frozen_string_literal: true require 'spec_helper' if mongoid? describe Bullet::Detector::Association do context 'embeds_many' do context 'posts => users' do it 'should detect nothing' do Mongoid::Post.all.each { |post| post.users.map(&:name) } Bullet::Detector::UnusedEagerLoa...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/integration/active_record/association_spec.rb
Ruby
mit
7,313
main
41,269
# frozen_string_literal: true require 'spec_helper' if active_record? def post_comments_empty_call_site(post) post.comments.empty? end describe Bullet::Detector::Association, 'has_many' do context 'post => comments' do it 'should detect non preload post => comments' do Post.all.each { |po...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/notification_collector_spec.rb
Ruby
mit
7,313
main
821
# frozen_string_literal: true require 'spec_helper' module Bullet describe NotificationCollector do subject { NotificationCollector.new.tap { |collector| collector.add('value') } } context '#add' do it 'should add a value' do subject.add('value1') expect(subject.collection).to be_incl...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/stack_trace_filter_spec.rb
Ruby
mit
7,313
main
769
# frozen_string_literal: true require 'spec_helper' module Bullet RSpec.describe StackTraceFilter do let(:dummy_class) { Class.new { extend StackTraceFilter } } let(:root_path) { Dir.pwd } let(:bundler_path) { Bundler.bundle_path } describe '#caller_in_project' do it 'gets the caller in the p...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/rack_spec.rb
Ruby
mit
7,313
main
18,688
# frozen_string_literal: true require 'spec_helper' module Bullet describe Rack do let(:middleware) { Bullet::Rack.new app } let(:app) { Support::AppDouble.new } context '#html_request?' do it 'should be true if Content-Type is text/html and http body contains html tag' do headers = { 'Co...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/detector/n_plus_one_query_spec.rb
Ruby
mit
7,313
main
8,211
# frozen_string_literal: true require 'spec_helper' require 'ostruct' using Bullet::Ext::Object module Bullet module Detector describe NPlusOneQuery do before(:all) do @post = Post.first @post2 = Post.last end context '.call_association' do it 'should add call_object_...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/detector/unused_eager_loading_spec.rb
Ruby
mit
7,313
main
6,343
# frozen_string_literal: true require 'spec_helper' using Bullet::Ext::Object module Bullet module Detector describe UnusedEagerLoading do before(:all) do @post = Post.first @post2 = Post.all[1] @post3 = Post.last end context '.call_associations' do it 'should...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/detector/counter_cache_spec.rb
Ruby
mit
7,313
main
2,162
# frozen_string_literal: true require 'spec_helper' using Bullet::Ext::Object module Bullet module Detector describe CounterCache do before :all do @post1 = Post.first @post2 = Post.last end context '.add_counter_cache' do it 'should create notification if conditions ...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/detector/association_spec.rb
Ruby
mit
7,313
main
852
# frozen_string_literal: true require 'spec_helper' using Bullet::Ext::Object module Bullet module Detector describe Association do before :all do @post1 = Post.first @post2 = Post.last end context '.add_object_association' do it 'should add object, associations pair'...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/notification/unused_eager_loading_spec.rb
Ruby
mit
7,313
main
465
# frozen_string_literal: true require 'spec_helper' module Bullet module Notification describe UnusedEagerLoading do subject { UnusedEagerLoading.new([''], Post, %i[comments votes], 'path') } it do expect(subject.body).to eq( " Post => [:comments, :votes]\n Remove from your quer...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/notification/base_spec.rb
Ruby
mit
7,313
main
3,753
# frozen_string_literal: true require 'spec_helper' module Bullet module Notification describe Base do subject { Base.new(Post, %i[comments votes]) } context '#title' do it 'should raise NoMethodError' do expect { subject.title } .to raise_error(NoMethodError) ...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/notification/counter_cache_spec.rb
Ruby
mit
7,313
main
359
# frozen_string_literal: true require 'spec_helper' module Bullet module Notification describe CounterCache do subject { CounterCache.new(Post, %i[comments votes]) } it { expect(subject.body).to eq(' Post => [:comments, :votes]') } it { expect(subject.title).to eq('Need Counter Cache with Ac...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/notification/n_plus_one_query_spec.rb
Ruby
mit
7,313
main
1,055
# frozen_string_literal: true require 'spec_helper' module Bullet module Notification describe NPlusOneQuery do subject { NPlusOneQuery.new([%w[caller1 caller2]], Post, %i[comments votes], 'path') } it do expect(subject.body_with_caller).to eq( " Post => [:comments, :votes]\n Ad...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/ext/string_spec.rb
Ruby
mit
7,313
main
391
# frozen_string_literal: true require 'spec_helper' using Bullet::Ext::String describe String do context 'bullet_class_name' do it 'should only return class name' do expect('Post:1'.bullet_class_name).to eq('Post') end it 'should return class name with namespace' do expect('Mongoid::Post:1...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/ext/object_spec.rb
Ruby
mit
7,313
main
1,949
# frozen_string_literal: true require 'spec_helper' using Bullet::Ext::Object describe Object do context 'bullet_key' do it 'should return class and id composition' do post = Post.first expect(post.bullet_key).to eq("Post:#{post.id}") end if mongoid? it 'should return class with name...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/registry/base_spec.rb
Ruby
mit
7,313
main
1,157
# frozen_string_literal: true require 'spec_helper' module Bullet module Registry describe Base do subject { Base.new.tap { |base| base.add('key', 'value') } } context '#[]' do it 'should get value by key' do expect(subject['key']).to eq(Set.new(%w[value])) end end ...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/registry/association_spec.rb
Ruby
mit
7,313
main
790
# frozen_string_literal: true require 'spec_helper' module Bullet module Registry describe Association do subject { Association.new.tap { |association| association.add(%w[key1 key2], 'value') } } context '#merge' do it 'should merge key/value' do subject.merge('key0', 'value0') ...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/bullet/registry/object_spec.rb
Ruby
mit
7,313
main
646
# frozen_string_literal: true require 'spec_helper' using Bullet::Ext::Object module Bullet module Registry describe Object do let(:post) { Post.first } let(:another_post) { Post.last } subject { Object.new.tap { |object| object.add(post.bullet_key) } } context '#include?' do i...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/models/document.rb
Ruby
mit
7,313
main
234
# frozen_string_literal: true class Document < ActiveRecord::Base has_many :children, class_name: 'Document', foreign_key: 'parent_id' belongs_to :parent, class_name: 'Document', foreign_key: 'parent_id' belongs_to :author end
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/models/post.rb
Ruby
mit
7,313
main
935
# frozen_string_literal: true class Post < ActiveRecord::Base belongs_to :category, inverse_of: :posts belongs_to :writer has_many :comments, inverse_of: :post has_and_belongs_to_many :deals validates :category, presence: true scope :preload_comments, -> { includes(:comments) } scope :in_category_name,...
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/models/user.rb
Ruby
mit
7,313
main
247
# frozen_string_literal: true class User < ActiveRecord::Base has_one :submission has_one :submission_attachment, through: :submission, source: :attachment, class_name: 'Attachment' belongs_to :category has_and_belongs_to_many :roles end
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/models/category.rb
Ruby
mit
7,313
main
207
# frozen_string_literal: true class Category < ActiveRecord::Base has_many :posts, inverse_of: :category has_many :entries has_many :users def draft_post posts.draft.first_or_create end end
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/models/mongoid/post.rb
Ruby
mit
7,313
main
314
# frozen_string_literal: true class Mongoid::Post include Mongoid::Document field :name has_many :comments, class_name: 'Mongoid::Comment' belongs_to :category, class_name: 'Mongoid::Category' embeds_many :users, class_name: 'Mongoid::User' scope :preload_comments, -> { includes(:comments) } end
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
spec/models/mongoid/category.rb
Ruby
mit
7,313
main
200
# frozen_string_literal: true class Mongoid::Category include Mongoid::Document field :name has_many :posts, class_name: 'Mongoid::Post' has_many :entries, class_name: 'Mongoid::Entry' end
github
flyerhzm/bullet
https://github.com/flyerhzm/bullet
perf/benchmark.rb
Ruby
mit
7,313
main
3,231
# frozen_string_literal: true $LOAD_PATH << 'lib' require 'benchmark' require 'rails' require 'active_record' require 'activerecord-import' require 'bullet' begin require 'perftools' rescue LoadError puts "Could not load perftools.rb, profiling won't be possible" end class Post < ActiveRecord::Base belongs_to ...
github
middleman/middleman
https://github.com/middleman/middleman
Rakefile
Ruby
mit
7,110
main
1,382
require 'rake' require_relative './middleman-core/lib/middleman-core/version' ROOT = __dir__ GEM_NAME = 'middleman'.freeze middleman_gems = %w[middleman-core middleman-cli middleman] GEM_PATHS = middleman_gems.freeze GEMS_WITH_TESTS = middleman_gems - %w[middleman].freeze def sh_rake(command) sh "#{Gem.ruby} -S rak...
github
middleman/middleman
https://github.com/middleman/middleman
gem_rake_helper.rb
Ruby
mit
7,110
main
1,067
require 'rake' require 'yard' require 'bundler/gem_tasks' require 'cucumber/rake/task' Cucumber::Rake::Task.new do |t| exempt_tags = ["--tags 'not @wip'"] exempt_tags << "--tags 'not @nojava'" if RUBY_PLATFORM == 'java' exempt_tags << "--tags 'not @encoding'" unless Object.const_defined?(:Encoding) exempt_tag...
github
middleman/middleman
https://github.com/middleman/middleman
Gemfile
Ruby
mit
7,110
main
874
source 'https://rubygems.org' # Build and doc tools gem 'rake', '~> 13.3', require: false gem 'yard', '~> 0.9.38', require: false # Test tools gem 'aruba', require: false gem 'capybara', require: false gem 'cucumber', require: false gem 'rspec', require: false # Debug tools gem 'byebug' gem 'pry' gem 'pry-rescue' #...
github
middleman/middleman
https://github.com/middleman/middleman
middleman/middleman.gemspec
Ruby
mit
7,110
main
919
require_relative '../middleman-core/lib/middleman-core/version' Gem::Specification.new do |s| s.name = 'middleman' s.version = Middleman::VERSION s.platform = Gem::Platform::RUBY s.license = 'MIT' s.authors = ['Thomas Reynolds', 'Ben Hollis', 'Karl Freeman'] s.email = ['me@tdrey...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/middleman-cli.gemspec
Ruby
mit
7,110
main
958
require_relative '../middleman-core/lib/middleman-core/version' Gem::Specification.new do |s| s.name = 'middleman-cli' s.version = Middleman::VERSION s.platform = Gem::Platform::RUBY s.license = 'MIT' s.authors = ['Thomas Reynolds', 'Ben Hollis'] s.email = ['me@tdreyno.com', 'be...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli.rb
Ruby
mit
7,110
main
488
# Setup our load paths libdir = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) # Require Thor since that's what the whole CLI is built around require 'thor' # CLI Module module Middleman::Cli # The base task from which everything else extends class Base < ::...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/extension.rb
Ruby
mit
7,110
main
1,464
# CLI Module module Middleman::Cli # A thor task for creating new projects class Extension < Thor::Group include Thor::Actions check_unknown_options! # Required path for the new project to be generated argument :name, type: :string # Template files are relative to this file # @return [Str...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/console.rb
Ruby
mit
7,110
main
1,457
# CLI Module module Middleman::Cli # The CLI Console class class Console < Thor::Group include Thor::Actions check_unknown_options! class_option :environment, aliases: '-e', default: ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development', desc: 'The enviro...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/server.rb
Ruby
mit
7,110
main
1,710
# CLI Module module Middleman::Cli # Server thor task class Server < Thor::Group check_unknown_options! class_option :environment, aliases: '-e' class_option :port, aliases: '-p' class_option :server_name, aliases: '-s' class_option :bind_addre...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/build.rb
Ruby
mit
7,110
main
4,544
require 'middleman-core/application' # CLI Module module Middleman::Cli # The CLI Build class class Build < Thor::Group include Thor::Actions check_unknown_options! class_option :environment, aliases: '-e', default: ENV['MM_ENV'] || ENV['RACK_ENV'] || :production ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/config.rb
Ruby
mit
7,110
main
1,106
# CLI Module module Middleman::Cli # The CLI Config class class Config < Thor::Group include Thor::Actions check_unknown_options! class_option :environment, aliases: '-e', default: ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development', desc: 'The environm...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/init.rb
Ruby
mit
7,110
main
3,652
# CLI Module module Middleman::Cli # A thor task for creating new projects class Init < Thor::Group include Thor::Actions GIT_CMD = 'git'.freeze check_unknown_options! argument :target, type: :string, default: '.' class_option 'template', aliases: '-T', defa...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/templates/extension/Gemfile
Ruby
mit
7,110
main
320
# If you do not have OpenSSL installed, update # the following line to use "http://" instead source 'https://rubygems.org' # Specify your gem's dependencies in <%= name %>.gemspec gemspec group :development do gem 'rake' gem 'rdoc' gem 'yard' end group :test do gem 'cucumber' gem 'aruba' gem 'rspec' end
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/templates/extension/Rakefile
Ruby
mit
7,110
main
287
require 'bundler' Bundler::GemHelper.install_tasks require 'cucumber/rake/task' Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t| t.cucumber_opts = "--color --tags 'not @wip' --strict" end require 'rake/clean' task test: ['cucumber'] task default: :test
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/lib/middleman-cli/templates/extension/lib/lib/extension.rb
Ruby
mit
7,110
main
611
# Require core library require 'middleman-core' # Extension namespace class MyExtension < ::Middleman::Extension option :my_option, 'default', 'An example option' def initialize(app, options_hash={}, &block) # Call super to build options from the options_hash super # Require libraries only when activ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-cli/features/support/env.rb
Ruby
mit
7,110
main
391
ENV["TEST"] = "true" require 'sassc' require 'simplecov' SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..')) SimpleCov.start PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__))) require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-cli') require File.join(File.dirname(PROJECT_ROOT...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/middleman-core.gemspec
Ruby
mit
7,110
main
2,073
require_relative './lib/middleman-core/version' Gem::Specification.new do |s| s.name = 'middleman-core' s.version = Middleman::VERSION s.platform = Gem::Platform::RUBY s.license = 'MIT' s.authors = ['Thomas Reynolds', 'Ben Hollis', 'Karl Freeman'] s.email = ['me@tdreyno.com', 'b...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/features/support/env.rb
Ruby
mit
7,110
main
513
ENV["TEST"] = "true" require 'sassc' require 'simplecov' SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..')) SimpleCov.start require "rspec" RSpec.configure do |config| config.expect_with :rspec do |expectations| expectations.max_formatted_output_length = nil end end PROJECT_ROOT_PATH = Fi...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core.rb
Ruby
mit
7,110
main
343
# Setup our load paths libdir = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) # Top-level Middleman namespace module Middleman autoload :Application, 'middleman-core/application' end require 'middleman-core/version' require 'middleman-core/util' require 'midd...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/rack.rb
Ruby
mit
7,110
main
4,628
require 'rack' require 'rack/files' require 'rack/lint' require 'rack/head' require 'rack/utils' require 'addressable/uri' require 'middleman-core/util' require 'middleman-core/logger' require 'middleman-core/template_renderer' # CSSPIE HTC File ::Rack::Mime::MIME_TYPES['.htc'] = 'text/x-component' # Let's serve all...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/template_renderer.rb
Ruby
mit
7,110
main
8,374
require 'tilt' require 'active_support/core_ext/string/output_safety' require 'middleman-core/template_context' require 'middleman-core/file_renderer' require 'middleman-core/contracts' module Middleman class TemplateRenderer extend Forwardable include Contracts class Cache def initialize ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/configuration.rb
Ruby
mit
7,110
main
5,066
module Middleman module Configuration # A class that manages a collection of documented settings. # Can be used by extensions as well as the main Middleman # application. Extensions should probably finalize their instance # after defining all the settings they want to expose. class ConfigurationMa...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/contracts.rb
Ruby
mit
7,110
main
1,512
if ENV['CONTRACTS'] != 'false' require 'contracts' require 'hamster' module Contracts class IsA def self.[](val) @lookup ||= {} @lookup[val] ||= new(val) end def initialize(val) @val = val end def valid?(val) val.is_a? @val.constantize end...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/sources.rb
Ruby
mit
7,110
main
11,866
require 'hamster' require 'middleman-core/contracts' module Middleman # The standard "record" that contains information about a file on disk. SourceFile = Struct.new(:relative_path, :full_path, :directory, :types, :version) do def read ::Middleman::Sources.file_cache[full_path] ||= {} ::Middleman::...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/template_context.rb
Ruby
mit
7,110
main
7,415
require 'pathname' require 'middleman-core/file_renderer' require 'middleman-core/template_renderer' require 'middleman-core/contracts' module Middleman # The TemplateContext Class # # A clean context, separate from Application, in which templates can be executed. # All helper methods and values available in a...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/file_renderer.rb
Ruby
mit
7,110
main
3,896
require 'tilt' require 'active_support/core_ext/string/output_safety' require 'active_support/core_ext/module/delegation' require 'middleman-core/contracts' ::Tilt.default_mapping.lazy_map.delete('html') ::Tilt.default_mapping.lazy_map.delete('csv') module Middleman class FileRenderer extend Forwardable inc...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/extension_manager.rb
Ruby
mit
7,110
main
2,845
module Middleman class ExtensionManager extend Forwardable def_delegator :@app, :logger def_delegators :@activated, :[], :each def initialize(app) @app = app @activated = {} ::Middleman::Extensions.load_settings(@app) manager = self { before_sitemap: :before_...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/application.rb
Ruby
mit
7,110
main
15,550
require 'active_support/core_ext/integer/inflections' require 'middleman-core/contracts' require 'middleman-core/callback_manager' require 'middleman-core/logger' require 'middleman-core/sitemap/store' require 'middleman-core/configuration' require 'middleman-core/extension_manager' require 'middleman-core/core_extens...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/extensions.rb
Ruby
mit
7,110
main
5,819
require 'middleman-core/extension' module Middleman # The Extensions module is used to handle global registration and loading of Middleman Extensions. # # The application-facing extension API ({Middleman::CoreExtensions::Extensions#activate activate}, etc) is in {Middleman::CoreExtensions::Extensions} in # `mi...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/util.rb
Ruby
mit
7,110
main
820
if RUBY_VERSION < "3.2" require "active_support/version" require "logger" if ActiveSupport.version < Gem::Version.new("8.0.0") end require 'active_support/all' require 'middleman-core/application' require 'middleman-core/sources' require 'middleman-core/sitemap/resource' require 'middleman-core/util/binary' requ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/profiling.rb
Ruby
mit
7,110
main
1,279
module Middleman module Profiling class << self # The profiler instance. There can only be one! attr_writer :profiler def profiler @profiler ||= NullProfiler.new end # Start the profiler def start profiler.start end # Stop the profiler and generate...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/extension.rb
Ruby
mit
7,110
main
21,257
require 'forwardable' require 'memoist' require 'active_support/core_ext/class/attribute' require 'middleman-core/configuration' require 'middleman-core/contracts' module Middleman # Middleman's Extension API provides the ability to add functionality to Middleman # and to customize existing features. Internally, m...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions.rb
Ruby
mit
7,110
main
5,244
require 'middleman-core/extensions' # File Change Notifier Middleman::Extensions.register :file_watcher, auto_activate: :before_sitemap do require 'middleman-core/core_extensions/file_watcher' Middleman::CoreExtensions::FileWatcher end # Parse YAML from templates Middleman::Extensions.register :front_matter, auto...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/preview_server.rb
Ruby
mit
7,110
main
11,628
require 'webrick' require 'webrick/https' require 'openssl' require 'middleman-core/meta_pages' require 'middleman-core/logger' require 'middleman-core/rack' require 'middleman-core/preview_server/server_information' require 'middleman-core/preview_server/server_url' require 'middleman-core/preview_server/server_inform...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/meta_pages.rb
Ruby
mit
7,110
main
3,480
require 'rack/builder' require 'rack/static' require 'tilt' require 'middleman-core/meta_pages/sitemap_tree' require 'middleman-core/meta_pages/config_setting' module Middleman module MetaPages # Metadata pages to be served in preview, in order to present information about the Middleman # application and its...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/load_paths.rb
Ruby
mit
7,110
main
1,364
# Core Pathname library used for traversal require 'pathname' module Middleman class << self def setup_load_paths @_is_setup ||= begin # Only look for config.rb if MM_ROOT isn't set if !ENV['MM_ROOT'] && (found_path = findup('config.rb')) ENV['MM_ROOT'] = found_path end ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/step_definitions.rb
Ruby
mit
7,110
main
757
require 'aruba/cucumber' require 'middleman-core/step_definitions/middleman_steps' require 'middleman-core/step_definitions/builder_steps' require 'middleman-core/step_definitions/server_steps' require 'middleman-core/step_definitions/commandline_steps' # Monkeypatch for windows support module ArubaMonkeypatch def d...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/dns_resolver.rb
Ruby
mit
7,110
main
1,986
require 'resolv' require 'middleman-core/dns_resolver/network_resolver' require 'middleman-core/dns_resolver/hosts_resolver' module Middleman # This resolves IP address to names and vice versa class DnsResolver private attr_reader :resolvers public # Create resolver # # First the local r...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/config_context.rb
Ruby
mit
7,110
main
1,881
require 'rack/mime' require 'middleman-core/callback_manager' module Middleman class ConfigContext extend Forwardable attr_reader :app # Whitelist methods that can reach out. def_delegators :@app, :config, :logger, :use, :map, :mime_type, :files, :root, :build?, :server?, :environment?, :extensions...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/logger.rb
Ruby
mit
7,110
main
1,244
# Use the Ruby/Rails logger require 'active_support/notifications' require 'active_support/logger' require 'thread' module Middleman # The Middleman Logger class Logger < ActiveSupport::Logger def self.singleton(*args) if !@_logger || !args || !args.empty? if args.length == 1 && (args.first.is_a?...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/builder.rb
Ruby
mit
7,110
main
9,201
require 'addressable/uri' require 'pathname' require 'fileutils' require 'tempfile' require 'parallel' require 'middleman-core/rack' require 'middleman-core/callback_manager' require 'middleman-core/contracts' module Middleman class Builder extend Forwardable include Contracts # Make app & events availa...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/callback_manager.rb
Ruby
mit
7,110
main
2,240
require 'hamster' require 'middleman-core/contracts' # Immutable Callback Management, complete with Contracts validation. module Middleman class CallbackManager include Contracts Contract Any def initialize @callbacks = ::Hamster::Hash.empty @subscribers = ::Hamster::Vector.empty end ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/sass.rb
Ruby
mit
7,110
main
3,525
require 'sassc' module Middleman module Renderers # Sass renderer class Sass < ::Middleman::Extension opts = { output_style: :nested } opts[:line_comments] = false if ENV['TEST'] define_setting :sass, opts, 'Sass engine options' define_setting :sass_assets_paths, [], 'Paths to extra S...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/haml.rb
Ruby
mit
7,110
main
3,332
# Require gem require 'haml' # Require padrino-helpers now so that we get a chance to replace their renderer with ours in Tilt. require 'padrino-helpers' module SafeTemplate def render(*) super.html_safe end end class Tilt::HamlTemplate include SafeTemplate end module Middleman module Renderers # Ha...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/markdown.rb
Ruby
mit
7,110
main
1,905
module Middleman module Renderers # Markdown renderer class Markdown < ::Middleman::Extension define_setting :markdown_engine, :kramdown, 'Preferred markdown engine' define_setting :markdown_engine_prefix, ::Tilt, 'The parent module for markdown template engines' # Once configuration is par...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/liquid.rb
Ruby
mit
7,110
main
1,511
# Require Gem require 'liquid' module Middleman module Renderers # Liquid Renderer class Liquid < Middleman::Extension # After config, setup liquid partial paths def after_configuration ::Liquid::Template.file_system = self end # Called by Liquid to retrieve a template file ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/coffee_script.rb
Ruby
mit
7,110
main
999
# Require gem require 'coffee_script' module Middleman module Renderers # CoffeeScript Renderer class CoffeeScript < ::Middleman::Extension # Setup extension def initialize(app, options={}, &block) super # Tell Tilt to use it as well (for inline scss blocks) ::Tilt.regist...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/kramdown.rb
Ruby
mit
7,110
main
1,494
require 'kramdown' module Middleman module Renderers # Our own Kramdown Tilt template that simply uses our custom renderer. class KramdownTemplate < ::Tilt::KramdownTemplate private def _prepare_output @context = @options[:context] MiddlemanKramdownHTML.scope = @context ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/erb.rb
Ruby
mit
7,110
main
852
# ERb renderer module Middleman module Renderers class ERb < ::Middleman::Extension def after_configuration ::Tilt.prefer(Template, :erb) end class Template < ::Tilt::ErubiTemplate def initialize(*args, &block) super @context = @options[:context] end...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/sass_functions.rb
Ruby
mit
7,110
main
3,928
module Middleman module Sass module Functions def asset_path(_source, _options) # current_resource end # Using Middleman::Util#asset_path, return the full path # for the given +source+ as a Sass String. This supports keyword # arguments that mirror the +options+. # ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/redcarpet.rb
Ruby
mit
7,110
main
2,826
require 'redcarpet' require 'active_support/core_ext/module/attribute_accessors' module Middleman module Renderers class RedcarpetTemplate < ::Tilt::RedcarpetTemplate # because tilt has decided to convert these # in the wrong direction ALIASES = { escape_html: :filter_html }.freez...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/less.rb
Ruby
mit
7,110
main
665
module Middleman module Renderers # Sass renderer class Less < ::Middleman::Extension # A SassTemplate for Tilt which outputs debug messages class DummyLessTemplate < ::Tilt::Template def evaluate(scope, locals, &block) raise <<~ERROR The builtin less renderer has bee...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/renderers/slim.rb
Ruby
mit
7,110
main
1,283
# Load gem require 'slim' module SafeTemplate def render(*) super.html_safe end end class ::Slim::Template include SafeTemplate def initialize(file, line, opts, &block) if opts.key?(:context) ::Slim::Embedded::SassEngine.disable_option_validator! %w(sass scss markdown).each do |engine| ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/data.rb
Ruby
mit
7,110
main
7,329
require 'middleman-core/contracts' require 'middleman-core/util/data' module Middleman module CoreExtensions # The data extension parses YAML and JSON files in the `data/` directory # and makes them available to `config.rb`, templates and extensions class Data < Extension attr_reader :data_store ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/default_helpers.rb
Ruby
mit
7,110
main
10,417
require 'padrino-helpers' require 'padrino-helpers/output_helpers' require 'padrino-helpers/asset_tag_helpers' require 'padrino-helpers/form_helpers' require 'padrino-helpers/format_helpers' require 'padrino-helpers/number_helpers' require 'padrino-helpers/output_helpers' require 'padrino-helpers/render_helpers' requir...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/front_matter.rb
Ruby
mit
7,110
main
2,741
# Core Pathname library used for traversal require 'pathname' # DbC require 'middleman-core/contracts' require 'active_support/core_ext/hash/keys' require 'middleman-core/util/data' # Extensions namespace module Middleman::CoreExtensions class FrontMatter < ::Middleman::Extension # Try to run after routing bu...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/file_watcher.rb
Ruby
mit
7,110
main
2,160
require 'middleman-core/contracts' require 'middleman-core/sources' module Middleman module CoreExtensions # API for watching file change events class FileWatcher < Extension # All defined sources. Contract IsA['Middleman::Sources'] attr_reader :sources # Make the internal `sources` ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/external_helpers.rb
Ruby
mit
7,110
main
1,190
module Middleman module CoreExtensions # Load helpers in `helpers/` class ExternalHelpers < Extension define_setting :helpers_dir, 'helpers', 'Directory to autoload helper modules from' define_setting :helpers_filename_glob, '**.rb', 'Glob pattern for matching helper ruby files' define_setti...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb
Ruby
mit
7,110
main
386
require 'rack/show_exceptions' # Support rack/showexceptions during development module Middleman::CoreExtensions class ShowExceptions < ::Middleman::Extension define_setting :show_exceptions, ENV['TEST'] ? false : true, 'Whether to catch and display exceptions' def ready app.use ::Rack::ShowExceptions...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/routing.rb
Ruby
mit
7,110
main
2,989
# Routing extension module Middleman module CoreExtensions class Routing < ConfigExtension # This should always run late, but not as late as :directory_indexes, # so it can add metadata to any pages generated by other extensions self.resource_list_manipulator_priority = [10, 130] # Expose...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/i18n.rb
Ruby
mit
7,110
main
12,274
class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension option :no_fallbacks, false, 'Disable I18n fallbacks' option :locales, nil, 'List of locales, will autodiscover by default' option :langs, nil, 'Backwards compatibility if old option name. Use `locales` instead.' option :locale_map, ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/rendering.rb
Ruby
mit
7,110
main
1,513
require 'middleman-core/template_context' # ERb Support Middleman::Extensions.register :erb_renderer, auto_activate: :before_configuration do require 'middleman-core/renderers/erb' Middleman::Renderers::ERb end # CoffeeScript Support Middleman::Extensions.register :coffee_renderer, auto_activate: :before_configur...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/collections.rb
Ruby
mit
7,110
main
3,222
require 'monitor' require 'middleman-core/core_extensions/collections/pagination' require 'middleman-core/core_extensions/collections/step_context' require 'middleman-core/core_extensions/collections/lazy_root' require 'middleman-core/core_extensions/collections/lazy_step' # Super "class-y" injection of array helpers ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/inline_url_rewriter.rb
Ruby
mit
7,110
main
4,492
require 'rack' require 'rack/response' require 'memoist' require 'middleman-core/util' require 'middleman-core/contracts' module Middleman module CoreExtensions class InlineURLRewriter < ::Middleman::Extension include Contracts expose_to_application rewrite_inline_urls: :add REWRITER_DESCRIPT...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/collections/lazy_step.rb
Ruby
mit
7,110
main
1,063
module Middleman module CoreExtensions module Collections class LazyCollectorStep DELEGATE = [:hash, :eql?].freeze def initialize(name, args, block, parent=nil) @name = name @args = args @block = block @parent = parent @result = nil ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb
Ruby
mit
7,110
main
1,808
require 'active_support/core_ext/object/deep_dup' require 'middleman-core/util' module Middleman module Pagination module ArrayHelpers def per_page(per_page) return to_enum(__method__, per_page) unless block_given? parts = if per_page.respond_to? :call per_page.call(dup) ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb
Ruby
mit
7,110
main
573
require 'middleman-core/core_extensions/collections/lazy_step' module Middleman module CoreExtensions module Collections class LazyCollectorRoot def initialize(parent) @data = nil @parent = parent end def realize!(data) @data = data end ...
github
middleman/middleman
https://github.com/middleman/middleman
middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb
Ruby
mit
7,110
main
791
module Middleman module CoreExtensions module Collections class StepContext class << self attr_accessor :current def add_to_context(name, &func) send(:define_method, :"_internal_#{name}", &func) end end attr_reader :descriptors def...