Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing rack-flash, updating redis

  • Loading branch information...
commit 22f5bbb94db844ac665db1d4509380312f42af7e 1 parent 742efdd
@winton authored
View
1  config/gemsets.yml
@@ -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
3  lib/gem_template.rb
@@ -1,6 +1,6 @@
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__)
@@ -8,7 +8,6 @@
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'
View
6 lib/gem_template/boot/flash.rb
@@ -1,6 +0,0 @@
-require 'rack-flash'
-
-Application.class_eval do
-
- use Rack::Flash, :accessorize => %w(error notice success)
-end
View
23 lib/gem_template/boot/redis.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.