Skip to content

Commit

Permalink
redis.fakeredis if using fakeredis
Browse files Browse the repository at this point in the history
  • Loading branch information
yagop committed May 14, 2015
1 parent 5b48948 commit b172f18
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libs/redis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ end)
if not ok then

local fake_func = function()
print('\27[31mRedis isn\'t installed, install it!\27[39m')
print('\27[31mCan\'t connect with Redis, install/configure it!\27[39m')
end

fake_func()
fake = FakeRedis.new()

redis = setmetatable({}, {
print('\27[31mRedis addr: '..params.host..'\27[39m')
print('\27[31mRedis port: '..params.port..'\27[39m')

redis = setmetatable({fakeredis=true}, {
__index = function(a, b)
if b ~= 'data' and fake[b] then
fake_func(b)
Expand Down

0 comments on commit b172f18

Please sign in to comment.