public
Description: Simple Ruby 1.8/1.9 code comparison app
Homepage: http://codefluency.com
Clone URL: git://github.com/bruce/compare-1-9.git
bruce (author)
Tue Jan 15 07:47:23 -0800 2008
commit  27faf30f8bccf541432a49aa5950ec9bdb02982c
tree    21b9437690923fa3582c239b6eada317bc8d82b4
parent  0f7968718f8b6458c7dc6d40ffdaecc5302fd320
compare-1-9 / lib / tasks / load_benchmarks.rake
100644 21 lines (19 sloc) 0.597 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
namespace :benchmarks do
  
  task :load => :environment do
    files = Dir[File.dirname(__FILE__) << "/benchmark/*.rb"]
    files.each_with_index do |file, offset|
      puts "Running `#{File.basename(file)}' (#{offset + 1}/#{files.size})..."
      item = nil
      begin
        item = Comparison.create(
          :name => File.basename(file),
          :code => File.read(file),
          :description => "Benchmark from the Ruby 1.9 repository"
        )
      rescue => e
        item.destroy unless item.new_record?
        puts "... could not execute (#{e})"
      end
    end
  end
  
end