Permalink
Browse files

BIG BANG

  • Loading branch information...
0 parents commit f55564c097deea9b1ffa12b13ac903f6102d9c85 @technoweenie committed Feb 13, 2011
Showing with 133 additions and 0 deletions.
  1. +1 −0 .rvmrc
  2. +13 −0 Gemfile
  3. +52 −0 Gemfile.lock
  4. +45 −0 app.rb
  5. +9 −0 lib/gravastar/cluster.rb
  6. +12 −0 lib/gravastar/star.rb
  7. +1 −0 lib/gravastar/web.rb
1 .rvmrc
@@ -0,0 +1 @@
+rvm ruby-1.9.2-p136
13 Gemfile
@@ -0,0 +1,13 @@
+source "http://rubygems.org"
+
+gem "toystore"
+gem "adapter"
+gem "adapter-riak", :require => 'adapter/riak'
+gem "adapter-redis", :require => 'adapter/redis'
+gem "redis"
+gem "riak-client"
+
+group :production do
+ gem "thin"
+ gem "sinatra"
+end
@@ -0,0 +1,52 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ activemodel (3.0.4)
+ activesupport (= 3.0.4)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activesupport (3.0.4)
+ adapter (0.5.2)
+ adapter-redis (0.5.1)
+ adapter (~> 0.5.1)
+ redis (~> 2.1.1)
+ adapter-riak (0.5)
+ activesupport (~> 3.0.3)
+ adapter (~> 0.5.1)
+ riak-client (~> 0.8.3)
+ builder (2.1.2)
+ daemons (1.1.0)
+ eventmachine (0.12.10)
+ i18n (0.5.0)
+ rack (1.2.1)
+ redis (2.1.1)
+ riak-client (0.8.3)
+ builder (~> 2.1.2)
+ i18n (>= 0.4.0)
+ simple_uuid (0.1.2)
+ sinatra (1.1.2)
+ rack (~> 1.1)
+ tilt (~> 1.2)
+ thin (1.2.7)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ tilt (1.2.2)
+ toystore (0.6.3)
+ activemodel (~> 3.0.3)
+ activesupport (~> 3.0.3)
+ adapter (~> 0.5.1)
+ simple_uuid (~> 0.1.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ adapter
+ adapter-redis
+ adapter-riak
+ redis
+ riak-client
+ sinatra
+ thin
+ toystore
45 app.rb
@@ -0,0 +1,45 @@
+require 'rubygems'
+require 'bundler'
+
+module Gravastar
+ class << self
+ attr_accessor :env
+ end
+ self.env = (ENV['GRAVASTAR_ENV'] || :dev).to_sym
+end
+
+Bundler.require(:default, Gravastar.env)
+$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
+
+require 'gravastar/cluster'
+require 'gravastar/star'
+
+if defined?(Sinatra)
+ require 'gravastar/web'
+else
+ require 'irb'
+ # http://jameskilton.com/2009/04/02/embedding-irb-into-your-ruby-application/
+ module IRB # :nodoc:
+ def self.start_session(binding)
+ unless @__initialized
+ args = ARGV
+ ARGV.replace(ARGV.dup)
+ IRB.setup(nil)
+ ARGV.replace(args)
+ @__initialized = true
+ end
+
+ ws = WorkSpace.new(binding)
+ irb = Irb.new(ws)
+
+ @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
+ @CONF[:MAIN_CONTEXT] = irb.context
+
+ catch(:IRB_EXIT) do
+ irb.eval_input
+ end
+ end
+ end
+
+ IRB.start_session(binding)
+end
@@ -0,0 +1,9 @@
+module Gravastar
+ class Cluster
+ include Toy::Store
+ store :redis, Redis.new(:db => 1)
+
+ attribute :name, String
+ attribute :email, String
+ end
+end
@@ -0,0 +1,12 @@
+module Gravastar
+ class Star
+ include Toy::Store
+ store :riak, Riak::Client.new['stars']
+
+ attribute :cluster_id, String
+ attribute :type, Hash
+ attribute :url, String
+ attribute :content, String
+ attribute :created_at, Time
+ end
+end
@@ -0,0 +1 @@
+# placeholder for sinatra crap

0 comments on commit f55564c

Please sign in to comment.