View difference between Paste ID: r25QtNkS and AcfXzwm7
SHOW: | | - or go back to the newest paste.
1
require 'riak'
2
3
@host   = ARGV[0]
4
@port   = ARGV[1].to_i
5
@bucket = ARGV[2]
6
@dir    = ARGV[3]
7
8
@riak_client = Riak::Client.new(:host => @host, :http_port => @port)
9
10
@riak_bucket = @riak_client.bucket(@bucket)
11
Dir.glob(@dir + '/*.json') do |file_path|
12
  json = File.read(file_path)
13
  
14
  w_props = { 
15
    :w => 0,
16
    :dw => 0,
17
    :returnbody => false
18
  }
19
  
20
  o = @riak_bucket.new(File.basename(file_path, ".json"))
21
  o.data = json
22
  o.content_type = 'application/json'
23
  o.store(w_props)
24
end