Permalink
Browse files

remove bundler from the libs. libs dont assume rubygems or bundler, o…

…nly rake and config.ru (byob)
  • Loading branch information...
1 parent 67b262d commit b2fa61a142d7516be71074db75b1d35b7c27a362 @technoweenie committed Feb 24, 2011
Showing with 34 additions and 25 deletions.
  1. +5 −5 Gemfile
  2. +7 −1 config.ru
  3. +4 −2 lib/allofthestars/client.rb
  4. +17 −17 lib/allofthestars/server.rb
  5. +1 −0 lib/allofthestars/server/web.rb
View
10 Gemfile
@@ -1,7 +1,7 @@
source "http://rubygems.org"
gem 'excon'
-gem 'yajl-ruby', :require => 'yajl'
+gem 'yajl-ruby'
group :client do
gem 'faraday'
@@ -10,9 +10,9 @@ end
group :server do
gem "toystore"
gem "adapter"
- gem "adapter-riak", :require => 'adapter/riak'
- gem "adapter-redis", :require => 'adapter/redis'
+ gem "adapter-riak"
+ gem "adapter-redis"
gem "redis"
- gem "riak-client", :require => 'riak/search'
- gem "sinatra", :require => false
+ gem "riak-client"
+ gem "sinatra"
end
View
@@ -1,3 +1,9 @@
-require File.join(File.dirname(__FILE__), 'lib/allofthestars/server')
+require 'rubygems'
+require 'bundler'
+
+Bundler.setup(:default, :server)
+$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
+
require 'allofthestars/server/web'
+
run AllOfTheStars::Web
@@ -1,8 +1,6 @@
require 'faraday'
require 'yajl'
-require 'faraday'
-
module AllOfTheStars
class Client
Builder = Faraday::Builder.new do |b|
@@ -48,5 +46,9 @@ def add_cluster(id, data = {})
def add_star(cluster_id, data = {})
@http.post("/clusters/#{cluster_id}/stars", data)
end
+
+ def inspect
+ %(#<#{self.class.name} #{@http.build_url(nil).to_s}>)
+ end
end
end
@@ -1,25 +1,25 @@
-require 'rubygems'
-require 'bundler'
+require 'toystore'
+require 'adapter'
+require 'adapter/riak'
+require 'riak/search'
module AllOfTheStars
class << self
- attr_accessor :env, :riak_client
+ attr_accessor :riak_client
end
-end
-
-Bundler.require(:default, :server)
-$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
-options = {:http_backend => :Excon}
-config = File.expand_path('../../../db/config.json', __FILE__)
-if File.exist?(config)
- data = ActiveSupport::JSON.decode(IO.read(config))
- data.each do |key, value|
- options[key.to_sym] = value
+ options = {:http_backend => :Excon}
+ config = File.expand_path('../../../db/config.json', __FILE__)
+ if File.exist?(config)
+ data = ActiveSupport::JSON.decode(IO.read(config))
+ data.each do |key, value|
+ options[key.to_sym] = value
+ end
end
+
+ self.riak_client = Riak::Client.new(options)
end
-AllOfTheStars.riak_client = Riak::Client.new(options)
-require 'allofthestars/server/searchable'
-require 'allofthestars/server/cluster'
-require 'allofthestars/server/star'
+%w(searchable cluster star).each do |lib|
+ require "allofthestars/server/#{lib}"
+end
@@ -1,4 +1,5 @@
require 'sinatra/base'
+require 'allofthestars/server'
module AllOfTheStars
class Web < Sinatra::Base

0 comments on commit b2fa61a

Please sign in to comment.