load_stocks.rb in riakpb-0.2.2 vs load_stocks.rb in riakpb-0.2.3
- old
+ new
@@ -1,12 +1,20 @@
-require 'riakpb'
+require 'rubygems' if RUBY_VERSION < '1.9'
+require 'bundler'
+
+Bundler.require
+
require 'csv'
+require 'benchmark'
+@noisy = ARGV.grep("-q").none?
+
client = Riakpb::Client.new
bucket = client["goog"]
CSV.foreach('goog.csv', :headers => true) do |row|
- puts row.first[1].to_s
+ @noisy && puts(row.first[1].to_s)
+
key = bucket[row.first[1].to_s]
key.content.value = Hash[row.to_a]
key.save
end