coffee_table 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -9
- data/changelog.txt +3 -0
- data/lib/coffee_table.rb +12 -4
- data/lib/coffee_table/version.rb +1 -1
- data/spec/lib/coffee_table_spec.rb +1 -2
- data/spec/spec_helper.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fee2e1ac835d575263dd819e6fd16b08ea050767
|
4
|
+
data.tar.gz: 51f4a70b7b890bc9d84b2249ac0dc3479985c335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0cad5dbb073a07ce1a78af5376deb303eb1f7a128c1c2c73d75ea89f589f8515a537fb59cb7c85799ad0b0174744a3a45e1bd0ba1718afb2cce19da3e116b5f
|
7
|
+
data.tar.gz: 0f9450b337d1c52c8b0f5ea0467d0c414a565be14d021f9a83678d35fdcad06e5561d4656b0f1220aea9403df276c04d5c3ac894d366d03c9744669f50fcc88e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coffee_table (0.2.
|
4
|
+
coffee_table (0.2.11)
|
5
5
|
activesupport
|
6
6
|
gzip
|
7
7
|
redis
|
@@ -29,14 +29,15 @@ GEM
|
|
29
29
|
file-tail (1.2.0)
|
30
30
|
tins (~> 1.0)
|
31
31
|
gzip (1.0)
|
32
|
-
i18n (0.
|
32
|
+
i18n (0.9.3)
|
33
|
+
concurrent-ruby (~> 1.0)
|
33
34
|
mime-types (1.23)
|
34
|
-
minitest (5.
|
35
|
+
minitest (5.11.3)
|
35
36
|
mock_redis (0.17.0)
|
36
37
|
multi_json (1.7.8)
|
37
|
-
redis (
|
38
|
-
redis-namespace (1.
|
39
|
-
redis (
|
38
|
+
redis (4.0.1)
|
39
|
+
redis-namespace (1.6.0)
|
40
|
+
redis (>= 3.0.4)
|
40
41
|
rest-client (1.6.7)
|
41
42
|
mime-types (>= 1.16)
|
42
43
|
rspec (2.14.1)
|
@@ -65,8 +66,8 @@ GEM
|
|
65
66
|
spork (0.9.2)
|
66
67
|
thor (0.18.1)
|
67
68
|
thread_safe (0.3.6)
|
68
|
-
tins (1.
|
69
|
-
tzinfo (1.2.
|
69
|
+
tins (1.16.3)
|
70
|
+
tzinfo (1.2.4)
|
70
71
|
thread_safe (~> 0.1)
|
71
72
|
|
72
73
|
PLATFORMS
|
@@ -81,4 +82,4 @@ DEPENDENCIES
|
|
81
82
|
spork
|
82
83
|
|
83
84
|
BUNDLED WITH
|
84
|
-
1.
|
85
|
+
1.16.1
|
data/changelog.txt
CHANGED
data/lib/coffee_table.rb
CHANGED
@@ -9,6 +9,8 @@ require 'redis-namespace'
|
|
9
9
|
require 'active_support/inflector'
|
10
10
|
require 'digest/md5'
|
11
11
|
require 'gzip'
|
12
|
+
require 'awesome_print'
|
13
|
+
require 'active_support/hash_with_indifferent_access'
|
12
14
|
|
13
15
|
module CoffeeTable
|
14
16
|
class Cache
|
@@ -17,7 +19,7 @@ module CoffeeTable
|
|
17
19
|
|
18
20
|
# initialize for coffee_table. takes options to setup behaviour of cache
|
19
21
|
def initialize(options={})
|
20
|
-
@options = options
|
22
|
+
@options = options.symbolize_keys
|
21
23
|
|
22
24
|
default_enable_cache_to true
|
23
25
|
default_redis_namespace_to :coffee_table
|
@@ -28,13 +30,19 @@ module CoffeeTable
|
|
28
30
|
default_compress_content_to true
|
29
31
|
default_compress_min_size_to 10240
|
30
32
|
|
33
|
+
redis_client = nil
|
31
34
|
if !@options[:redis].nil?
|
32
|
-
|
35
|
+
redis_client = @options[:redis]
|
33
36
|
elsif @options.has_key?(:redis_url)
|
34
|
-
|
37
|
+
redis_client = Redis.new(:url => @options[:redis_url])
|
35
38
|
else
|
36
|
-
|
39
|
+
redis_client = Redis.new(:host => @options[:redis_server], :port => @options[:redis_port])
|
37
40
|
end
|
41
|
+
|
42
|
+
@redis = Redis::Namespace.new(@options[:redis_namespace], :redis => redis_client)
|
43
|
+
|
44
|
+
self
|
45
|
+
|
38
46
|
end
|
39
47
|
|
40
48
|
|
data/lib/coffee_table/version.rb
CHANGED
@@ -50,8 +50,7 @@ describe CoffeeTable::Cache do
|
|
50
50
|
context "compressing" do
|
51
51
|
|
52
52
|
before(:each) do
|
53
|
-
@redis = Redis::Namespace.new("coffee_table",
|
54
|
-
|
53
|
+
@redis = Redis::Namespace.new("coffee_table", :redis => Redis.new)
|
55
54
|
end
|
56
55
|
|
57
56
|
it "compresses on strings greater than limit" do
|
data/spec/spec_helper.rb
CHANGED
@@ -6,7 +6,7 @@ Coveralls.wear!
|
|
6
6
|
|
7
7
|
require 'digest/md5'
|
8
8
|
require 'spork'
|
9
|
-
require 'mock_redis'
|
9
|
+
# require 'mock_redis'
|
10
10
|
require File.expand_path(File.dirname(__FILE__) + '/../../coffee_table/spec/lib/sample_class')
|
11
11
|
require File.expand_path(File.dirname(__FILE__) + '/../../coffee_table/spec/lib/sample_class_without_id')
|
12
12
|
|
@@ -23,8 +23,8 @@ Spork.each_run do
|
|
23
23
|
config.before(:each) {
|
24
24
|
|
25
25
|
|
26
|
-
redis = double(:redis)
|
27
|
-
Redis.stub(:new).and_return(MockRedis.new)
|
26
|
+
# redis = double(:redis)
|
27
|
+
# Redis.stub(:new).and_return(MockRedis.new)
|
28
28
|
CoffeeTable::Cache.new.expire_all
|
29
29
|
|
30
30
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stewart McKee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|