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
blendle/object-cache
https://github.com/blendle/object-cache
lib/object/cache.rb
Ruby
mit
49
master
3,730
# frozen_string_literal: true require 'digest/sha1' require 'object/cache/version' # Caching of objects in a Redis store class Cache @default_ttl = (7 * 24 * 60 * 60) # 1 week class << self attr_accessor :backend attr_accessor :default_ttl attr_accessor :default_key_prefix # new # # Find...
github
blambeau/quickl
https://github.com/blambeau/quickl
quickl.gemspec
Ruby
mit
49
master
6,130
# We require your library, mainly to have access to the VERSION number. # Feel free to set $version manually. $LOAD_PATH.unshift File.expand_path('../lib', __FILE__) require "quickl/version" $version = Quickl::Version.to_s # # This is your Gem specification. Default values are provided so that your library # should be...
github
blambeau/quickl
https://github.com/blambeau/quickl
Gemfile
Ruby
mit
49
master
275
source 'http://rubygems.org' group :test do gem "rake", "~> 0.9.2" gem "rspec", "~> 2.7.0" end group :release do gem "rake", "~> 0.9.2" gem "rspec", "~> 2.7.0" gem "wlang", "~> 0.10.2" end group :doc do gem "yard", "~> 0.7.2" gem "bluecloth", "~> 2.2.0" end
github
blambeau/quickl
https://github.com/blambeau/quickl
Rakefile
Ruby
mit
49
master
536
begin gem "bundler", "~> 1.0" require "bundler/setup" rescue LoadError => ex puts ex.message abort "Bundler failed to load, (did you run 'gem install bundler' ?)" end # Dynamically load the gem spec $gemspec_file = File.expand_path('../quickl.gemspec', __FILE__) $gemspec = Kernel.eval(File.read($gemspec_f...
github
blambeau/quickl
https://github.com/blambeau/quickl
tasks/gem.rake
Ruby
mit
49
master
1,867
# Installs rake tasks for gemming and packaging # # This file installs the 'rake package', 'rake gem' tasks and associates # (clobber_package, repackage, ...). It is automatically generated by Noe # from your .noespec file, and should therefore be configured there, under # the variables/rake_tasks/gem entry, as illustr...
github
blambeau/quickl
https://github.com/blambeau/quickl
tasks/unit_test.rake
Ruby
mit
49
master
2,397
# Installs a rake task for for running unit tests. # # This file installs the 'rake unit_test' and extends 'rake test' to run unit # tests, if any. It is automatically generated by Noe from your .noespec file, # and should therefore be configured there, under the variables/rake_tasks/unit_test # entry, as illustrated b...
github
blambeau/quickl
https://github.com/blambeau/quickl
tasks/spec_test.rake
Ruby
mit
49
master
2,159
# Installs a rake task for for running examples written using rspec. # # This file installs the 'rake spec_test' (aliased as 'rake spec') as well as # extends 'rake test' to run spec tests, if any. It is automatically generated # by Noe from your .noespec file, and should therefore be configured there, # under the vari...
github
blambeau/quickl
https://github.com/blambeau/quickl
tasks/debug_mail.rake
Ruby
mit
49
master
2,241
# Installs a rake task for debuging the announcement mail. # # This file installs the 'rake debug_mail' that flushes an announcement mail # for your library on the standard output. It is automatically generated # by Noe from your .noespec file, and should therefore be configured there, # under the variables/rake_tasks/...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/mini_client.rb
Ruby
mit
49
master
2,528
# # MiniClient main command # class MiniClient < Quickl::Delegator(__FILE__, __LINE__) # Is verbose? attr_accessor :verbose options do |opt| @verbose = false opt.on("-v", "--[no-]verbose") do |val| self.verbose = val end end # # Print help # # SYNOPSIS # #{MiniClient.command...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_overview.rb
Ruby
mit
49
master
325
require "spec_helper" describe "Quickl#overview" do subject{ Quickl.overview(cmd) } describe "on a command class" do let(:cmd){ MiniClient::Help } it{ should eq("Print help") } end describe "on a command instance" do let(:cmd){ MiniClient::Help.new } it{ should eq("Print help") } end ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_command_name.rb
Ruby
mit
49
master
335
require "spec_helper" describe "Quickl#command_name" do subject{ Quickl.command_name(cmd) } describe "on a command class" do let(:cmd){ MiniClient::Say::Hello } it{ should eq("hello") } end describe "on a command instance" do let(:cmd){ MiniClient::Say::Hello.new } it{ should eq("hello") ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_parse_commandline_args.rb
Ruby
mit
49
master
1,214
require 'spec_helper' describe "Quickl.parse_commandline_args" do subject{ Quickl.parse_commandline_args(args) } describe "on empty string" do let(:args){ "" } it { should eq([]) } end describe "on pseudo empty string" do let(:args){ " " } it { should eq([]) } end describe "on a si...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_usage.rb
Ruby
mit
49
master
353
require "spec_helper" describe "Quickl#usage" do subject{ Quickl.usage(cmd) } describe "on a command class" do let(:cmd){ MiniClient::Say::Hello } it{ should eq("mini-client say:hello") } end describe "on a command instance" do let(:cmd){ MiniClient::Say::Hello.new } it{ should eq("mini-c...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_super_command.rb
Ruby
mit
49
master
452
require 'spec_helper' describe "Quickl.super_command" do subject{ Quickl.super_command(cmd) } describe "on a command class" do let(:cmd){ MiniClient::Say::Hello } it{ should eq(MiniClient::Say) } end describe "on a command instance" do let(:cmd){ MiniClient::Say::Hello.new } it{ should eq...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_documentation.rb
Ruby
mit
49
master
658
$hello_doc = <<EOF Say hello to the user whose name is requested on the standard input SYNOPSIS mini-client say:hello DESCRIPTION And an explanation here on multiple lines with replacement: hello EOF require "spec_helper" describe "Quickl#documentation" do subject{ Quickl.documentation(cmd) } describe...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_sub_command.rb
Ruby
mit
49
master
1,301
require 'spec_helper' describe "Quickl.sub_command(!)" do describe "non bang version" do subject{ Quickl.sub_command(cmd, name) } describe "on a command class with existing sub" do let(:cmd){ MiniClient } let(:name){ "say:hello" } it{ should eq(MiniClient::Say::Hello) } end de...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_valid_read_file.rb
Ruby
mit
49
master
1,739
require 'spec_helper' module Quickl describe "Quickl.valid_read_file!" do let(:r){ Quickl } describe "with default options" do it "should raise a Quickl::IOAccessError with a friendly message" do begin r.valid_read_file!("nosuchone.nosuchextension") true.shoul...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/quickl/test_split_commandline_args.rb
Ruby
mit
49
master
1,209
require 'spec_helper' describe "Quickl.split_commandline_args" do subject{ Quickl.split_commandline_args(args) } describe "on an empty array" do let(:args){ %w{} } it { should eq([%w{}]) } end describe "without an option separator" do let(:args){ %w{hello world} } it { should eq([%w{hello wor...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/naming/test_module2command.rb
Ruby
mit
49
master
589
require 'spec_helper' module Quickl describe "Naming::module2command /" do include Naming it "should uncapitalize first char" do module2command("Say").should eq("say") module2command(:Say).should eq(:say) end it "should uncapitalize and introduce dashes" do module2command("SayH...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/naming/test_command2module.rb
Ruby
mit
49
master
451
require 'spec_helper' module Quickl describe "Naming::command2module /" do include Naming it "should capitalize first char" do command2module("say").should eq("Say") command2module(:say).should eq(:Say) end it "should capitalize support dashes" do command2module("say-hello").sh...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/ruby_tools/test_extract_file_rdoc.rb
Ruby
mit
49
master
781
require File.expand_path('../fixtures', __FILE__) module Quickl describe "RubyTools#extract_file_rdoc /" do let(:file){ File.expand_path('../fixtures.rb', __FILE__) } describe "when used without line and reverse options" do subject{ RubyTools::extract_file_rdoc(file) } it "should be ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/ruby_tools/fixtures.rb
Ruby
mit
49
master
535
require 'spec_helper' module Quickl module Fixtures # # This is a fixtures helper that matches documentation conventions. # # This is a second paragraph # That append on two lines # # # WARNING: # This kind of indentation should not be interpreted as code # # But this ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/ruby_tools/test_optional_args_block.rb
Ruby
mit
49
master
774
require File.expand_path('../fixtures', __FILE__) module Quickl describe "RubyTools#optional_args_block_call /" do subject{ RubyTools::optional_args_block_call(block, args) } describe "when block has no arguments /" do let(:block){ lambda { "ok" } } describe "when no args are ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/ruby_tools/test_class_unqualified_name.rb
Ruby
mit
49
master
736
require File.expand_path('../fixtures', __FILE__) module Quickl describe "RubyTools#class_unqualified_name /" do subject{ RubyTools::class_unqualified_name(clazz) } describe "when called on unqualified class" do let(:clazz){ ::String } it{ should == "String" } end describe "when c...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/ruby_tools/test_parent_module.rb
Ruby
mit
49
master
555
require File.expand_path('../fixtures', __FILE__) module Quickl describe "RubyTools#parent_module /" do subject{ RubyTools::parent_module(clazz) } describe "when called on unqualified class" do let(:clazz){ ::String } it{ should be_nil } end describe "when called on qualified clas...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_documentation.rb
Ruby
mit
49
master
460
$hello_doc = <<EOF Say hello to the user whose name is requested on the standard input SYNOPSIS mini-client say:hello DESCRIPTION And an explanation here on multiple lines with replacement: hello EOF require 'spec_helper' module Quickl describe "Command::documentation /" do it "should be correctly...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_command_name.rb
Ruby
mit
49
master
317
require 'spec_helper' module Quickl describe "Command::command_name /" do it "should be installed from inline rdoc" do MiniClient::Say::Hello.command_name.should == "hello" MiniClient::Say::Goodbye.command_name.should == "goodbye" end end # Command::command_name end # module Quickl
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_run.rb
Ruby
mit
49
master
1,292
require 'spec_helper' module Quickl describe "Command::run /" do specify "when invoked on a terminal command" do MiniClient::Say::Hello.run.should eql(:hello) MiniClient::Say::Goodbye.run.should eql(:goodbye) end specify "when invoked on a delegator command" do MiniClient.run(["hel...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_overview.rb
Ruby
mit
49
master
236
require 'spec_helper' module Quickl describe "Command::overview /" do it "should be installed from inline rdoc" do MiniClient::Help.overview.should == "Print help" end end # Command::overview end # module Quickl
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_usage.rb
Ruby
mit
49
master
323
require 'spec_helper' module Quickl describe "Command::usage /" do it "should be installed from inline rdoc" do MiniClient::Say::Hello.usage.should eq("mini-client say:hello") MiniClient::Say::Goodbye.usage.should eq("mini-client say:goodbye") end end # Command::usage end # module Quic...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_requester.rb
Ruby
mit
49
master
409
require 'spec_helper' module Quickl describe "Command::requester /" do it "should return nil if invoked immediately" do MiniClient::Requester.run([]).should be_nil end it "should return delegator if ran from delegator" do x = MiniClient.run(["requester"]) x.should_not be_nil ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_subcommand_by_name.rb
Ruby
mit
49
master
484
require 'spec_helper' module Quickl describe "Command::subcommand_by_name /" do specify "when called on single command names" do MiniClient.subcommand_by_name("help").should eq(MiniClient::Help) MiniClient.subcommand_by_name("noway").should be_nil end specify "when called on complex ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_subcommands.rb
Ruby
mit
49
master
654
require 'spec_helper' module Quickl describe "Command::subcommands /" do it "should return installed commands in an array" do MiniClient.subcommands.should eq([ MiniClient::Help, MiniClient::Say, MiniClient::Requester, ]) MiniClient::Say.subcommands.should eq([ ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_command_building.rb
Ruby
mit
49
master
789
require 'spec_helper' module Quickl describe "Command building /" do it "should execute callback methods" do MiniClient::Factored.run.should eq(:hello) end it "should install hierarchy correctly when command_parent= is used" do MiniClient::Factored.super_command.should eq(MiniClient:...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/test_parse_options.rb
Ruby
mit
49
master
3,084
require 'spec_helper' describe "Command#parse_options" do let(:cmd){ MiniClient::Say::Args.new } subject{ cmd.parse_options(argv, sep_support) } describe "when no separator support" do let(:sep_support){ :none } describe "on empty array" do let(:argv){ [] } it { should eq([]) } end ...
github
blambeau/quickl
https://github.com/blambeau/quickl
spec/command/delegator/test_split_argv.rb
Ruby
mit
49
master
1,355
require 'spec_helper' module Quickl module Command::Delegator describe "InstanceMethods#split_argv" do let(:cmd){ Object.new.extend(InstanceMethods) } subject{ cmd.send(:split_argv, argv) } describe "on an empty array" do let(:argv){ [] } it { should eql([[],[]]) } ...
github
blambeau/quickl
https://github.com/blambeau/quickl
examples/hello/test_hello.rb
Ruby
mit
49
master
1,436
require 'test/unit' require 'stringio' begin require 'quickl' rescue LoadError $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__) require 'quickl' end Kernel.load File.expand_path('../hello', __FILE__) class HelloTest < Test::Unit::TestCase def assert_exits(match, exit_code) yield as...
github
blambeau/quickl
https://github.com/blambeau/quickl
examples/delegator/test/test_delegator.rb
Ruby
mit
49
master
1,592
require 'test/unit' require 'stringio' begin require 'quickl' rescue LoadError $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__) require 'quickl' end $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'delegator' class DelegatorTest < Test::Unit::TestCase def assert_exits(match...
github
blambeau/quickl
https://github.com/blambeau/quickl
examples/delegator/lib/delegator.rb
Ruby
mit
49
master
921
# # Delegate execution to a sub command # # SYNOPSIS # #{program_name} [--version] [--help] [--output=...] COMMAND [cmd opts] ARGS... # # OPTIONS # #{summarized_options} # # COMMANDS # #{summarized_subcommands} # # DESCRIPTION # This example shows how to write a delegator command, that is, a # command which deleg...
github
blambeau/quickl
https://github.com/blambeau/quickl
examples/delegator/lib/hello_world.rb
Ruby
mit
49
master
932
class Delegator # # Say hello # # SYNOPSIS # #{program_name} #{command_name} [--capitalize] [WHO] # # OPTIONS # #{summarized_options} # # DESCRIPTION # Without any argument, says hello to the world. When a single argument # is given says hello to the user. # class HelloWorld < Quickl...
github
blambeau/quickl
https://github.com/blambeau/quickl
examples/delegator/lib/help.rb
Ruby
mit
49
master
527
class Delegator # # Show help about a specific command # # SYNOPSIS # #{program_name} #{command_name} help COMMAND # class Help < Quickl::Command(__FILE__, __LINE__) # Let NoSuchCommandError be passed to higher stage no_react_to Quickl::NoSuchCommand # Command execution def ex...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl.rb
Ruby
mit
49
master
4,898
require 'quickl/loader' require 'quickl/version' require 'quickl/ext/object' require 'quickl/errors' require 'quickl/ruby_tools' require 'quickl/naming' require 'quickl/command' module Quickl # Quickl's COPYRIGHT info COPYRIGHT = "(c) 2010-2011, Bernard Lambeau" # # Prints a deprecation message on STDERR i...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/naming.rb
Ruby
mit
49
master
1,301
module Quickl module Naming # # Converts a command name to a module name. Implements # the following conversions: # # hello -> Hello # hello-world -> HelloWorld # # This method is part of Quickl's private interface even # if its effect are considered public. # def ...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/command.rb
Ruby
mit
49
master
436
require 'optparse' require 'quickl/command/class_methods' require 'quickl/command/instance_methods' module Quickl class Command extend Naming # Tracks child classes def self.inherited(command) Quickl.build_command(command) end end # class Command end # module Quickl require 'quickl/c...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/ruby_tools.rb
Ruby
mit
49
master
1,528
module Quickl module RubyTools # Returns the parent module of a class def parent_module(clazz) name = clazz.name (name =~ /^(.*?)::([^:]+)$/) ? Kernel.eval($1) : nil end module_function :parent_module # Returns the unqualified name of a class def class_unqualified_name(clazz) ...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/errors.rb
Ruby
mit
49
master
5,105
module Quickl # # Main class of all Quickl's errors. # # Quickl's errors normally occur only in the context of a command # execution, command which can be obtained through the dedicated # accessor. # # Each Quickl error comes bundled with a default reaction implemented # by the _react!_ method. ...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/ext/object.rb
Ruby
mit
49
master
879
class Object # From active_support 2.3.4 unless defined? instance_exec # 1.9 module InstanceExecMethods #:nodoc: end include InstanceExecMethods # Evaluate the block with the given arguments within the context of # this object, so self is set to the method receiver. # # From Mauricio's ...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/command/single.rb
Ruby
mit
49
master
534
module Quickl # Instance method for being a single command module Command::Single # Run the command by delegation def run(argv = [], requester = nil) @requester = requester execute(parse_options(argv)) end end # module Command::Single # # Create a single command # d...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/command/class_methods.rb
Ruby
mit
49
master
3,058
require 'optparse' module Quickl class Command module ClassMethods # The super command, if any attr_accessor :super_command # Extractor for documentation attr_accessor :doc_extractor # Returns the array of defined subcommands def subcommands @subcom...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/command/instance_methods.rb
Ruby
mit
49
master
234
require 'optparse' module Quickl class Command module InstanceMethods # Who is requesting command execution? attr_reader :requester end # module InstanceMethods end # class Command end # module Quickl
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/command/builder.rb
Ruby
mit
49
master
2,225
module Quickl class Command class Builder # The super command, if any attr_accessor :super_command alias :"command_parent=" :"super_command=" # Extractor for documentation attr_accessor :doc_extractor # Sets place of the documentation def document(fil...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/command/options.rb
Ruby
mit
49
master
2,478
module Quickl module Command::Options module ClassMethods # Installed options builders attr_reader :option_builders # Builds an OptionParser instance def build_options(scope = self) OptionParser.new do |opt| opt.program_name = File.basename $0 if con...
github
blambeau/quickl
https://github.com/blambeau/quickl
lib/quickl/command/delegator.rb
Ruby
mit
49
master
1,639
module Quickl module Command::Delegator module InstanceMethods # Run the command by delegation def run(argv = [], requester = nil) @requester = requester my_argv, rest = split_argv(argv) parse_options(my_argv) execute(rest) end def execute(ar...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/Gemfile
Ruby
mit
49
master
1,364
source 'https://rubygems.org' module ::Kernel def rails_master? ENV["RAILS_MASTER"] == '1' end def skip_rails? ENV["SKIP_RAILS"] == '1' end def mysql2_prepared_statements? ENV["MYSQL2_PREPARED_STATEMENTS"] == '1' end def v_4_0_x? major, minor, micro = ENV["RAILS_VERSION"].to_s.split("....
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_scope_all_with_default_scope_over_select.rb
Ruby
mit
49
master
528
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_with_default_scope_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base default_scope { where(admin: true) ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_finders_first_over_select.rb
Ruby
mit
49
master
436
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_finders_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_adapter...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_scaffold_update.rb
Ruby
mit
49
master
2,655
require 'bundler/setup' require 'rails' require 'action_controller/railtie' require 'active_record' require_relative 'support/benchmark_rails' require_relative 'support/request_helper' class ScaffoldApp < Rails::Application config.secret_token = "s"*30 config.secret_key_base = 'foo' config.cache_classes = true ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_sprockets_javascript.rb
Ruby
mit
49
master
520
require 'bundler/setup' require 'sprockets' require_relative 'support/benchmark_rails' require 'rack/builder' app = Rack::Builder.new do map "/assets" do environment = Sprockets::Environment.new environment.append_path File.expand_path('../assets/javascripts', __FILE__) run environment end end request ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/actionpack_router.rb
Ruby
mit
49
master
2,537
require 'bundler/setup' require 'rails' require 'action_controller/railtie' require_relative 'support/benchmark_rails.rb' class NullLogger < Logger def initialize(*args) end def add(*args, &block) end end class BenchmarkApp < Rails::Application routes.append do namespace :editor do resources :p...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_finders_find_by_sql.rb
Ruby
mit
49
master
456
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_finders_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_adapter...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_finders_first.rb
Ruby
mit
49
master
446
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_finders_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_adapter...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_actioncontroller_api.rb
Ruby
mit
49
master
488
require 'bundler/setup' require 'action_controller' require_relative 'support/benchmark_rails' class ApiController < ActionController::API def show render json: "JSON", status: :ok end end app = ApiController.action(:show) request = Rack::MockRequest.new(app) Benchmark.rails("actioncontroller/api", time: 5) do...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_scaffold_show.rb
Ruby
mit
49
master
1,923
require 'bundler/setup' require 'rails' require 'action_controller/railtie' require 'active_record' require_relative 'support/benchmark_rails' require_relative 'support/request_helper' class ScaffoldApp < Rails::Application config.secret_token = "s"*30 config.secret_key_base = 'foo' config.cache_classes = true ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_scope_where_over_select.rb
Ruby
mit
49
master
597
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_scope_where_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_ada...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_scaffold_new.rb
Ruby
mit
49
master
1,426
require 'bundler/setup' require 'rails' require 'action_controller/railtie' require 'active_record' require_relative 'support/benchmark_rails' require_relative 'support/request_helper' class ScaffoldApp < Rails::Application config.secret_token = "s"*30 config.secret_key_base = 'foo' config.cache_classes = true ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_discourse.rb
Ruby
mit
49
master
1,984
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_discourse_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) class User < ActiveRecord::Base has_many :topic_users has_many :category_users has_many :topics end class Topic...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_pluck_with_scope.rb
Ruby
mit
49
master
430
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_finders_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end last_user_id = User.last.id Benchmark.rai...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/actionview_partials.rb
Ruby
mit
49
master
1,021
require 'bundler/setup' require 'ffaker' require 'rails' require 'action_controller/railtie' require_relative 'support/benchmark_rails.rb' class HeavyController < ActionController::Base def index end end class HeavyView < ActionView::Base end Post = Struct.new(:id) do def title Faker::Name.name end ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_pluck.rb
Ruby
mit
49
master
375
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_finders_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_adapter...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_finders_find_by_attributes.rb
Ruby
mit
49
master
486
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_finders_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_adapter...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_save.rb
Ruby
mit
49
master
546
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_save_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false attributes = { name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/actionpack_url_generation_url_for.rb
Ruby
mit
49
master
364
require_relative 'support/url_generation_base.rb' require_relative 'support/benchmark_rails.rb' Benchmark.rails("actionpack_url_generation_url_for", time: 10) do router = Router.new router.url_for(controller: 'prices', action: 'info') router.url_for(controller: 'coupons', action: 'some') router.url_for(contro...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_scope_where.rb
Ruby
mit
49
master
612
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_scope_where_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_ada...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/actionpack_url_generation_others.rb
Ruby
mit
49
master
331
require_relative 'support/url_generation_base.rb' require_relative 'support/benchmark_rails.rb' Benchmark.rails("actionpack_url_generation_others", time: 10) do router = Router.new router.listing_redirect_path(:any) router.residential_path(id: 2, addressing_slug: 'brooklyn') router.by_category_professionals_p...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_validations_invalid.rb
Ruby
mit
49
master
1,027
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_validations_invalid_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class Post < ActiveRecord::Base validates :title, presence: true, ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_validations_valid.rb
Ruby
mit
49
master
1,040
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_validations_valid_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class Post < ActiveRecord::Base validates :title, presence: true, co...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_finders_find_by_attributes_over_select.rb
Ruby
mit
49
master
476
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_finders_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_adapter...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_scaffold_index.rb
Ruby
mit
49
master
1,690
require 'bundler/setup' require 'rails' require 'action_controller/railtie' require 'active_record' require_relative 'support/benchmark_rails' require_relative 'support/request_helper' class ScaffoldApp < Rails::Application config.secret_token = "s"*30 config.secret_key_base = 'foo' config.cache_classes = true ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_scope_all_with_default_scope.rb
Ruby
mit
49
master
534
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_with_default_scope_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base default_scope { where(admin: true) ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/driver.rb
Ruby
mit
49
master
5,583
# # Rails Benchmark driver # require 'bundler/setup' require 'net/http' require 'json' require 'pathname' require 'optparse' require 'rails' require 'digest' RAW_URL = 'https://raw.githubusercontent.com/ruby-bench/ruby-bench-suite/master/rails/benchmarks/' DATABASE_URLS = { psql: "postgres://postgres@postgres:5432/...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/actionpack_url_generation_rest.rb
Ruby
mit
49
master
485
require_relative 'support/url_generation_base.rb' require_relative 'support/benchmark_rails.rb' Benchmark.rails("actionpack_url_generation_rest", time: 10) do router = Router.new router.topic_path(2) router.edit_topic_path(2) router.edit_topic_message_path(1, 2) router.new_topic_message_path(1, 2) router....
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_scaffold_create.rb
Ruby
mit
49
master
2,122
require 'bundler/setup' require 'rails' require 'action_controller/railtie' require 'active_record' require_relative 'support/benchmark_rails' require_relative 'support/request_helper' class ScaffoldApp < Rails::Application config.secret_token = "s"*30 config.secret_key_base = 'foo' config.cache_classes = true ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_preload.rb
Ruby
mit
49
master
456
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_preload_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class Topic < ActiveRecord::Base has_many :users end class User < ActiveRecor...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_destroy.rb
Ruby
mit
49
master
566
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_destroy_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end attributes = { name: "Lorem ipsum dolor ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_scope_all.rb
Ruby
mit
49
master
568
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_scope_all_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_adap...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_create_string_columns.rb
Ruby
mit
49
master
508
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_create_string_columns_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end attributes = {} STRING_COLU...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/activemodel_views.rb
Ruby
mit
49
master
1,212
require 'bundler/setup' require 'action_controller/railtie' require 'active_model' require_relative 'support/benchmark_rails' class HeavyController < ActionController::Base def index;end end class HeavyView < ActionView::Base def protect_against_forgery? false end end class Post include ActiveModel::Mode...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/bm_activerecord_scope_all_over_select.rb
Ruby
mit
49
master
534
require 'bundler/setup' require 'active_record' require_relative 'support/benchmark_rails' db_setup script: "bm_scope_all_setup.rb" ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false class User < ActiveRecord::Base; end Benchmark.rails("activerecord/#{db_adap...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/support/echo_channel.rb
Ruby
mit
49
master
244
class EchoChannel < ApplicationCable::Channel def subscribed stream_from "echo_channel" end def unsubscribed # Any cleanup needed when channel is unsubscribed end def ding(data) transmit(dong: data['message']) end end
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/support/benchmark_rails.rb
Ruby
mit
49
master
407
require 'rails' require_relative '../../../support/benchmark_runner' require_relative '../../../support/helpers' module Benchmark module Rails def rails(label = nil, version: ::Rails.version.to_s, time:, disable_gc: true, warmup: 3, &block) Benchmark::Runner.run(label, version: version, time: time, disabl...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/support/request_helper.rb
Ruby
mit
49
master
259
module RequestHelper VALID_STATUS = [200, 302] def self.perform(app, request) status, _, body = app.call(request) raise "Error: response status: #{status}" unless VALID_STATUS.include?(status) body.close if body.respond_to?(:close) end end
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
rails/benchmarks/support/url_generation_base.rb
Ruby
mit
49
master
1,606
require 'bundler/setup' require 'rails' require 'action_controller/railtie' class NullLogger < Logger def initialize(*args) end def add(*args, &block) end end class BenchmarkApp < Rails::Application routes.append do namespace :editor do resources :professionals resource :message end ...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
benchmark_driver-output-rubybench/benchmark_driver-output-rubybench.gemspec
Ruby
mit
49
master
1,290
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "benchmark_driver/output/rubybench/version" Gem::Specification.new do |spec| spec.name = "benchmark_driver-output-rubybench" spec.version = BenchmarkDriver::Output::Rubybench::VERSION spec.au...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
benchmark_driver-output-rubybench/lib/benchmark_driver/runner/rsskb.rb
Ruby
mit
49
master
4,360
require 'benchmark_driver/struct' require 'benchmark_driver/metric' require 'benchmark_driver/default_job' require 'benchmark_driver/default_job_parser' require 'tempfile' require 'shellwords' # Max resident set size class BenchmarkDriver::Runner::Rsskb # Using the RubyBench's original label METRIC = BenchmarkDriv...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
benchmark_driver-output-rubybench/lib/benchmark_driver/runner/seconds.rb
Ruby
mit
49
master
638
require 'benchmark_driver/runner/time' # For having a metric label compatible with RubyBench class BenchmarkDriver::Runner::Seconds < BenchmarkDriver::Runner::Time METRIC = BenchmarkDriver::Metric.new(name: 'Execution time', unit: 'Seconds', larger_better: false) # JobParser returns this, `BenchmarkDriver::Runner...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
benchmark_driver-output-rubybench/lib/benchmark_driver/output/rubybench.rb
Ruby
mit
49
master
2,898
# This file is auto-loaded by `BenchmarkDriver::Output` when `-o rubybench` is specified. require 'benchmark_driver' require 'net/http' # Common environment variables: # API_URL=rubybench.org # API_NAME # API_PASSWORD # RUBY_COMMIT_HASH or RUBY_VERSION # Benchmark-specific environment variables: # BENCHMARK_...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
bundler/benchmarks/bm_resolve_gx_api_rails.rb
Ruby
mit
49
master
219
require_relative 'support/benchmark_bundler.rb' gemfile = proc do source "https://rubygems.org" gem "sass-rails" gem "rails", "~> 3" gem "gxapi_rails" end Benchmark.resolve_definition('gxapi_rails', gemfile)
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
bundler/benchmarks/bm_bundle_exec_shell.rb
Ruby
mit
49
master
477
require_relative 'support/benchmark_bundler.rb' require 'bundler/cli' noop_gem = Pathname(__FILE__).expand_path + '../gems/noop-gem' Dir.mktmpdir do |dir| Dir.chdir(dir) do File.write('Gemfile', <<-GEMFILE) source 'https://rubygems.org' gem 'rails' gem 'noop-gem', path: '#{noop_gem}' GEMFI...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
bundler/benchmarks/driver.rb
Ruby
mit
49
master
3,778
# # Bundler Benchmark driver # require 'net/http' require 'json' require 'pathname' require 'optparse' require 'digest' RAW_URL = 'https://raw.githubusercontent.com/ruby-bench/ruby-bench-suite/master/bundler/benchmarks/' class BenchmarkDriver def self.benchmark(options) self.new(options).run end def initia...
github
ruby-bench/ruby-bench-suite
https://github.com/ruby-bench/ruby-bench-suite
bundler/benchmarks/bm_bundle_install_rails_fixed.rb
Ruby
mit
49
master
461
require_relative 'support/benchmark_bundler.rb' require 'bundler/cli' Dir.mktmpdir do |dir| Dir.chdir(dir) do File.write('Gemfile', <<-GEMFILE) source 'https://rubygems.org' gem 'rails', '5.0.0' gem 'nokogiri', '1.6.7.2' GEMFILE system("bundle package --quiet") system("bundle insta...