Permalink
Browse files

Removing rack-flash, updating redis

  • Loading branch information...
1 parent 742efdd commit 22f5bbb94db844ac665db1d4509380312f42af7e @winton committed Aug 18, 2011
Showing with 10 additions and 23 deletions.
  1. +0 −1 config/gemsets.yml
  2. +1 −2 lib/gem_template.rb
  3. +0 −6 lib/gem_template/boot/flash.rb
  4. +9 −14 lib/gem_template/boot/redis.rb
View
@@ -4,7 +4,6 @@ gem_template:
default:
haml: =3.1.1
lilypad: =0.3.1
- rack-flash: =0.1.1
rack-test: =0.6.0
redis: =2.1.1
sinatra: =1.2.6
View
@@ -1,14 +1,13 @@
require File.dirname(__FILE__) + '/gem_template/gems'
-GemTemplate::Gems.activate %w(haml lilypad rack-flash sinatra)
+GemTemplate::Gems.activate %w(haml lilypad sinatra)
$:.unshift File.dirname(__FILE__)
require 'gem_template/boot/application'
require 'gem_template/boot/sinatra'
require 'gem_template/boot/log'
require 'gem_template/boot/session'
-require 'gem_template/boot/flash'
require 'gem_template/boot/haml'
require 'gem_template/boot/lilypad'
require 'gem_template/boot/redis'
@@ -1,6 +0,0 @@
-require 'rack-flash'
-
-Application.class_eval do
-
- use Rack::Flash, :accessorize => %w(error notice success)
-end
@@ -1,18 +1,15 @@
require 'uri'
require 'redis'
-Application.class_eval do
- helpers do
-
- def redis
- define_redis
- end
- end
-end
-
-def define_redis
+def redis
$redis ||= (
- url = URI('redis://localhost:6379/0')
+
+ env = ENV['RACK_ENV'] || 'development'
+ yaml = YAML.load(File.read('config/redis.yml'))[env]
+ db = yaml.keys.first
+ config = yaml[db]
+ config['db'] = db
+ url = URI("redis://#{config['host']}:#{config['port']}/#{config['db']}")
::Redis.new(
:host => url.host,
@@ -21,6 +18,4 @@ def define_redis
:password => url.password
)
)
-end
-
-define_redis
+end

0 comments on commit 22f5bbb

Please sign in to comment.