Permalink
Browse files

Created initial project, plus basics test.

  • Loading branch information...
0 parents commit 80dd77c4c3851acc2f4e15321c8f659cf808d84b @lstoll committed Feb 16, 2010
Showing with 445 additions and 0 deletions.
  1. +45 −0 1_ripple_basics.rb
  2. +13 −0 README.md
  3. +387 −0 uuid.rb
@@ -0,0 +1,45 @@
+require 'riak'
+require 'uuid'
+
+def gen_id
+ UUID.create.to_s.gsub('-','')
+end
+
+# Until issue http://github.com/seancribbs/ripple/issues#issue/8 is fixed, force
+# the Net::HTTP backend
+class Riak::Client
+ def http
+ @http ||= NetHTTPBackend.new(self)
+ end
+end
+
+# Connect and get a bucket instance
+client = Riak::Client.new
+bucket = client.bucket("test1")
+
+# Create and save a simple JSON object
+new_one = Riak::RObject.new(bucket, gen_id)
+new_one.content_type = "application/json" # You must set the content type.
+new_one.data = "{'item': 'one'}"
+new_one.store
+
+# Create and save a simple JSON object
+new_two = Riak::RObject.new(bucket, gen_id)
+new_two.content_type = "application/json" # You must set the content type.
+new_two.data = "{'item': 'two'}"
+new_two.store
+
+
+# The above MP doesn't work anyway - backends need tweaking. DO this the old way
+# instead
+
+# Print bucket contents
+#bucket.keys {|k| p bucket.get(k)}
+
+# Empty Bucket
+#bucket.keys {|k| bucket.get(k).delete}
+
+keys = bucket.keys
+
+keys.each {|k| p bucket.get(k)}
+keys.each {|k| bucket.get(k).delete}
@@ -0,0 +1,13 @@
+# Riak Playground
+
+This is my dumping ground for mucking around with riak
+
+## Getting Started
+
+Ripple requires ActiveSupport (and Model?) from Rails 3. To get everything installed:
+
+ gem install gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
+ gem install rack-mount --version "~> 0.4.0"
+ gem install rails --pre
+ gem install ripple
+
Oops, something went wrong.

0 comments on commit 80dd77c

Please sign in to comment.