From 3e1ed7818ba1abbc331c568327c6c0d64702985e Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sun, 6 Jan 2013 00:05:25 +0100 Subject: extract PerformanceTest into rails-performance_tests gem --- railties/lib/rails/commands/benchmarker.rb | 34 ------------------------------ 1 file changed, 34 deletions(-) delete mode 100644 railties/lib/rails/commands/benchmarker.rb (limited to 'railties/lib/rails/commands/benchmarker.rb') diff --git a/railties/lib/rails/commands/benchmarker.rb b/railties/lib/rails/commands/benchmarker.rb deleted file mode 100644 index b745b45e17..0000000000 --- a/railties/lib/rails/commands/benchmarker.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'optparse' -require 'rails/test_help' -require 'rails/performance_test_help' - -ARGV.push('--benchmark') # HAX -require 'active_support/testing/performance' -ARGV.pop - -def options - options = {} - defaults = ActiveSupport::Testing::Performance::DEFAULTS - - OptionParser.new do |opt| - opt.banner = "Usage: rails benchmarker 'Ruby.code' 'Ruby.more_code' ... [OPTS]" - opt.on('-r', '--runs N', Numeric, 'Number of runs.', "Default: #{defaults[:runs]}") { |r| options[:runs] = r } - opt.on('-o', '--output PATH', String, 'Directory to use when writing the results.', "Default: #{defaults[:output]}") { |o| options[:output] = o } - opt.on('-m', '--metrics a,b,c', Array, 'Metrics to use.', "Default: #{defaults[:metrics].join(",")}") { |m| options[:metrics] = m.map(&:to_sym) } - opt.parse!(ARGV) - end - - options -end - -class BenchmarkerTest < ActionDispatch::PerformanceTest #:nodoc: - self.profile_options = options - - ARGV.each do |expression| - eval <<-RUBY - def test_#{expression.parameterize('_')} - #{expression} - end - RUBY - end -end -- cgit v1.2.3