lacquer 0.5.8 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 67124eacec337f8d11e5e72c7a03d899b759d17a
4
+ data.tar.gz: a985a3d7fc01d062afc82d86c5c6c76fe45faffc
5
+ SHA512:
6
+ metadata.gz: 40278b6b726c88845e9b9c411f1baae3020b36e6faac77b1ae08b295d34aba8e1607223c2127b728ef74c4fc284e8b9b71387eb66f16d4678fefda1c8a579e3f
7
+ data.tar.gz: 3522c1e552018600eec6b1a08c7c9a1e363013aa406ab2ad0c18adcba42b974235bf4aa1f683dbf4f2032d269b989d027255e7c5400f4045e3179289642583ea
data/.gitignore CHANGED
@@ -1,5 +1,5 @@
1
- *.gem
2
- .bundle
3
- .DS_Store
4
- Gemfile.lock
5
- pkg/*
1
+ *.gem
2
+ .bundle
3
+ .DS_Store
4
+ Gemfile.lock
5
+ pkg/*
@@ -1,33 +1,33 @@
1
- Lacquer.configure do |config|
2
- # Globally enable/disable cache
3
- config.enable_cache = true
4
-
5
- # Unless overridden in a controller or action, the default will be used
6
- config.default_ttl = 1.week
7
-
8
- # Can be :none, :delayed_job, :resque
9
- config.job_backend = :none
10
-
11
- # Array of Varnish servers to manage
12
- config.varnish_servers << {
13
- :host => "0.0.0.0", :port => 6082 # if you have authentication enabled, add :secret => "your secret"
14
- }
15
-
16
- # Number of retries
17
- config.retries = 5
18
-
19
- # Config handler (optional, if you use Hoptoad or another error tracking service)
20
- # config.command_error_handler = lambda { |s| HoptoadNotifier.notify(s) }
21
-
22
-
23
- ### Varnish - 2.x / 3.x .. VCL-Changes
24
- ### https://www.varnish-cache.org/docs/trunk/installation/upgrade.html
25
-
26
- # => Purge Command ( "url.purge" for Varnish 2.x .. "ban.url" for Varnish 3.x )
27
- # => purges are now called bans in Varnish 3.x .. purge() and purge_url() are now respectively ban() and ban_url()
28
- config.purge_command = "url.purge"
29
-
30
- # => VCL_Fetch Pass Command ( "pass" for Varnish 2.x .. "hit_for_pass" for Varnish 3.x )
31
- # => pass in vcl_fetch renamed to hit_for_pass in Varnish 3.x
32
- config.pass_command = "pass"
33
- end
1
+ Lacquer.configure do |config|
2
+ # Globally enable/disable cache
3
+ config.enable_cache = true
4
+
5
+ # Unless overridden in a controller or action, the default will be used
6
+ config.default_ttl = 1.week
7
+
8
+ # Can be :none, :delayed_job, :resque, :sidekiq
9
+ config.job_backend = :none
10
+
11
+ # Array of Varnish servers to manage
12
+ config.varnish_servers << {
13
+ :host => "0.0.0.0", :port => 6082 # if you have authentication enabled, add :secret => "your secret"
14
+ }
15
+
16
+ # Number of retries
17
+ config.retries = 5
18
+
19
+ # Config handler (optional, if you use Hoptoad or another error tracking service)
20
+ # config.command_error_handler = lambda { |s| HoptoadNotifier.notify(s) }
21
+
22
+
23
+ ### Varnish - 2.x / 3.x .. VCL-Changes
24
+ ### https://www.varnish-cache.org/docs/trunk/installation/upgrade.html
25
+
26
+ # => Purge Command ( "url.purge" for Varnish 2.x .. "ban.url" for Varnish 3.x )
27
+ # => purges are now called bans in Varnish 3.x .. purge() and purge_url() are now respectively ban() and ban_url()
28
+ config.purge_command = "url.purge"
29
+
30
+ # => VCL_Fetch Pass Command ( "pass" for Varnish 2.x .. "hit_for_pass" for Varnish 3.x )
31
+ # => pass in vcl_fetch renamed to hit_for_pass in Varnish 3.x
32
+ config.pass_command = "pass"
33
+ end
@@ -1,102 +1,102 @@
1
- backend default {
2
- .host = "<%= backend.split(':').first %>";
3
- .port = "<%= backend.split(':').last %>";
4
- }
5
-
6
- # Handling of requests that are received from clients.
7
- # First decide whether or not to lookup data in the cache.
8
- sub vcl_recv {
9
- # Pipe requests that are non-RFC2616 or CONNECT which is weird.
10
- if (req.request != "GET" &&
11
- req.request != "HEAD" &&
12
- req.request != "PUT" &&
13
- req.request != "POST" &&
14
- req.request != "TRACE" &&
15
- req.request != "OPTIONS" &&
16
- req.request != "DELETE") {
17
- return(pipe);
18
- }
19
-
20
- if (req.backend.healthy) {
21
- set req.grace = 30s;
22
- } else {
23
- set req.grace = 1h;
24
- }
25
-
26
- # Pass requests that are not GET or HEAD
27
- if (req.request != "GET" && req.request != "HEAD") {
28
- return(pass);
29
- }
30
-
31
- # Handle compression correctly. Varnish treats headers literally, not
32
- # semantically. So it is very well possible that there are cache misses
33
- # because the headers sent by different browsers aren't the same.
34
- # @see: http://varnish.projects.linpro.no/wiki/FAQ/Compression
35
- if (req.http.Accept-Encoding) {
36
- if (req.http.Accept-Encoding ~ "gzip") {
37
- # if the browser supports it, we'll use gzip
38
- set req.http.Accept-Encoding = "gzip";
39
- } elsif (req.http.Accept-Encoding ~ "deflate") {
40
- # next, try deflate if it is supported
41
- set req.http.Accept-Encoding = "deflate";
42
- } else {
43
- # unknown algorithm. Probably junk, remove it
44
- remove req.http.Accept-Encoding;
45
- }
46
- }
47
-
48
- # Clear cookie and authorization headers, set grace time, lookup in the cache
49
- unset req.http.Cookie;
50
- unset req.http.Authorization;
51
- return(lookup);
52
- }
53
-
54
- # Called when entering pipe mode
55
- sub vcl_pipe {
56
- # If we don't set the Connection: close header, any following
57
- # requests from the client will also be piped through and
58
- # left untouched by varnish. We don't want that.
59
- set req.http.connection = "close";
60
- return(pipe);
61
- }
62
-
63
- # Called when the requested object has been retrieved from the
64
- # backend, or the request to the backend has failed
65
- sub vcl_fetch {
66
- # Set the grace time
67
- set beresp.grace = 1h;
68
-
69
- # Do not cache the object if the status is not in the 200s
70
- if (beresp.status >= 300) {
71
- # Remove the Set-Cookie header
72
- remove beresp.http.Set-Cookie;
73
- return(<%= Lacquer.configuration.pass_command %>);
74
- }
75
-
76
- # Do not cache the object if the backend application does not want us to.
77
- if (beresp.http.Cache-Control ~ "(no-cache|no-store|private|must-revalidate)") {
78
- return(<%= Lacquer.configuration.pass_command %>);
79
- }
80
-
81
- # Everything below here should be cached
82
-
83
- # Remove the Set-Cookie header
84
- remove beresp.http.Set-Cookie;
85
-
86
- # Deliver the object
87
- return(deliver);
88
- }
89
-
90
- # Called before the response is sent back to the client
91
- sub vcl_deliver {
92
- # Force browsers and intermediary caches to always check back with us
93
- set resp.http.Cache-Control = "private, max-age=0, must-revalidate";
94
- set resp.http.Pragma = "no-cache";
95
-
96
- # Add a header to indicate a cache HIT/MISS
97
- if (obj.hits > 0) {
98
- set resp.http.X-Cache = "HIT";
99
- } else {
100
- set resp.http.X-Cache = "MISS";
101
- }
102
- }
1
+ backend default {
2
+ .host = "<%= backend.split(':').first %>";
3
+ .port = "<%= backend.split(':').last %>";
4
+ }
5
+
6
+ # Handling of requests that are received from clients.
7
+ # First decide whether or not to lookup data in the cache.
8
+ sub vcl_recv {
9
+ # Pipe requests that are non-RFC2616 or CONNECT which is weird.
10
+ if (req.request != "GET" &&
11
+ req.request != "HEAD" &&
12
+ req.request != "PUT" &&
13
+ req.request != "POST" &&
14
+ req.request != "TRACE" &&
15
+ req.request != "OPTIONS" &&
16
+ req.request != "DELETE") {
17
+ return(pipe);
18
+ }
19
+
20
+ if (req.backend.healthy) {
21
+ set req.grace = 30s;
22
+ } else {
23
+ set req.grace = 1h;
24
+ }
25
+
26
+ # Pass requests that are not GET or HEAD
27
+ if (req.request != "GET" && req.request != "HEAD") {
28
+ return(pass);
29
+ }
30
+
31
+ # Handle compression correctly. Varnish treats headers literally, not
32
+ # semantically. So it is very well possible that there are cache misses
33
+ # because the headers sent by different browsers aren't the same.
34
+ # @see: http://varnish.projects.linpro.no/wiki/FAQ/Compression
35
+ if (req.http.Accept-Encoding) {
36
+ if (req.http.Accept-Encoding ~ "gzip") {
37
+ # if the browser supports it, we'll use gzip
38
+ set req.http.Accept-Encoding = "gzip";
39
+ } elsif (req.http.Accept-Encoding ~ "deflate") {
40
+ # next, try deflate if it is supported
41
+ set req.http.Accept-Encoding = "deflate";
42
+ } else {
43
+ # unknown algorithm. Probably junk, remove it
44
+ remove req.http.Accept-Encoding;
45
+ }
46
+ }
47
+
48
+ # Clear cookie and authorization headers, set grace time, lookup in the cache
49
+ unset req.http.Cookie;
50
+ unset req.http.Authorization;
51
+ return(lookup);
52
+ }
53
+
54
+ # Called when entering pipe mode
55
+ sub vcl_pipe {
56
+ # If we don't set the Connection: close header, any following
57
+ # requests from the client will also be piped through and
58
+ # left untouched by varnish. We don't want that.
59
+ set req.http.connection = "close";
60
+ return(pipe);
61
+ }
62
+
63
+ # Called when the requested object has been retrieved from the
64
+ # backend, or the request to the backend has failed
65
+ sub vcl_fetch {
66
+ # Set the grace time
67
+ set beresp.grace = 1h;
68
+
69
+ # Do not cache the object if the status is not in the 200s
70
+ if (beresp.status >= 300) {
71
+ # Remove the Set-Cookie header
72
+ remove beresp.http.Set-Cookie;
73
+ return(<%= Lacquer.configuration.pass_command %>);
74
+ }
75
+
76
+ # Do not cache the object if the backend application does not want us to.
77
+ if (beresp.http.Cache-Control ~ "(no-cache|no-store|private|must-revalidate)") {
78
+ return(<%= Lacquer.configuration.pass_command %>);
79
+ }
80
+
81
+ # Everything below here should be cached
82
+
83
+ # Remove the Set-Cookie header
84
+ remove beresp.http.Set-Cookie;
85
+
86
+ # Deliver the object
87
+ return(deliver);
88
+ }
89
+
90
+ # Called before the response is sent back to the client
91
+ sub vcl_deliver {
92
+ # Force browsers and intermediary caches to always check back with us
93
+ set resp.http.Cache-Control = "private, max-age=0, must-revalidate";
94
+ set resp.http.Pragma = "no-cache";
95
+
96
+ # Add a header to indicate a cache HIT/MISS
97
+ if (obj.hits > 0) {
98
+ set resp.http.X-Cache = "HIT";
99
+ } else {
100
+ set resp.http.X-Cache = "MISS";
101
+ }
102
+ }
@@ -34,6 +34,9 @@ module Lacquer
34
34
  when :resque
35
35
  require 'lacquer/resque_job'
36
36
  Resque.enqueue(Lacquer::ResqueJob, paths)
37
+ when :sidekiq
38
+ require 'lacquer/sidekiq_worker'
39
+ Lacquer::SidekiqWorker.perform_async(paths)
37
40
  when :none
38
41
  Varnish.new.purge(*paths)
39
42
  end
@@ -0,0 +1,11 @@
1
+ module Lacquer
2
+ class SidekiqWorker
3
+ include Sidekiq::Worker
4
+
5
+ sidekiq_options queue: :lacquer
6
+
7
+ def perform(urls)
8
+ Varnish.new.purge(*urls)
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Lacquer
2
- VERSION = '0.5.8'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -16,7 +16,7 @@ describe Lacquer::CacheControl do
16
16
  it "returns urls to expire for object" do
17
17
  cache_control = described_class.new
18
18
  cache_control.register :class_section, :url => "^/sv/class_sections/%s.*$", :args => "[0-9]+"
19
- cache_control.urls_for(:class_section, mock("ClassSection", :to_param => 1)).should == ["^/sv/class_sections/1.*$"]
19
+ cache_control.urls_for(:class_section, double("ClassSection", :to_param => 1)).should == ["^/sv/class_sections/1.*$"]
20
20
  end
21
21
  end
22
22
 
@@ -1,5 +1,7 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
2
2
  require 'lacquer/delayed_job_job'
3
+ require 'lacquer/resque_job'
4
+ require 'lacquer/sidekiq_worker'
3
5
 
4
6
  describe "Lacquer" do
5
7
  before(:each) do
@@ -8,8 +10,8 @@ describe "Lacquer" do
8
10
 
9
11
  describe "talking to varnish" do
10
12
  before(:each) do
11
- @varnish_stub = mock('varnish')
12
- Lacquer::Varnish.stub!(:new).and_return(@varnish_stub)
13
+ @varnish_stub = double('varnish')
14
+ Lacquer::Varnish.stub(:new).and_return(@varnish_stub)
13
15
  end
14
16
 
15
17
  describe "when backend is :none" do
@@ -45,6 +47,15 @@ describe "Lacquer" do
45
47
  @controller.clear_cache_for('/', '/blog/posts')
46
48
  end
47
49
  end
50
+
51
+ describe "when backend is :sidekiq" do
52
+ it "sends commands to a sidekiq queue" do
53
+ Lacquer.configuration.job_backend = :sidekiq
54
+
55
+ Lacquer::SidekiqWorker.should_receive(:perform_async).once
56
+ @controller.clear_cache_for('/', '/blog/posts')
57
+ end
58
+ end
48
59
  end
49
60
 
50
61
  describe "when cache is enabled" do
@@ -71,8 +82,8 @@ describe "Lacquer" do
71
82
  end
72
83
 
73
84
  it "should allow purge by non-controller sweepers" do
74
- @varnish_stub = mock('varnish')
75
- Lacquer::Varnish.stub!(:new).and_return(@varnish_stub)
85
+ @varnish_stub = double('varnish')
86
+ Lacquer::Varnish.stub(:new).and_return(@varnish_stub)
76
87
 
77
88
  @sweeper = SweeperClass.new
78
89
 
@@ -5,8 +5,8 @@ describe "DelayedJobJob" do
5
5
  it "should purge the parameter" do
6
6
  require File.expand_path('lib/lacquer/delayed_job_job')
7
7
 
8
- @varnish_mock = mock('varnish')
9
- Lacquer::Varnish.stub!(:new).and_return(@varnish_mock)
8
+ @varnish_mock = double('varnish')
9
+ Lacquer::Varnish.stub(:new).and_return(@varnish_mock)
10
10
 
11
11
  @varnish_mock.should_receive(:purge).with('/').exactly(1).times
12
12
  Lacquer::DelayedJobJob.new('/').perform
@@ -5,8 +5,8 @@ describe "ResqueJob" do
5
5
  it "should purge the parameter" do
6
6
  require File.expand_path('lib/lacquer/resque_job')
7
7
 
8
- @varnish_mock = mock('varnish')
9
- Lacquer::Varnish.stub!(:new).and_return(@varnish_mock)
8
+ @varnish_mock = double('varnish')
9
+ Lacquer::Varnish.stub(:new).and_return(@varnish_mock)
10
10
 
11
11
  @varnish_mock.should_receive(:purge).with('/').exactly(1).times
12
12
  Lacquer::ResqueJob.perform('/')
@@ -0,0 +1,15 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
2
+
3
+ describe "SidekiqWorker" do
4
+ describe "perform" do
5
+ it "should purge the parameter" do
6
+ require File.expand_path('lib/lacquer/sidekiq_worker')
7
+
8
+ @varnish_mock = double('varnish')
9
+ Lacquer::Varnish.stub(:new).and_return(@varnish_mock)
10
+
11
+ @varnish_mock.should_receive(:purge).with('/').exactly(1).times
12
+ Lacquer::SidekiqWorker.new.perform('/')
13
+ end
14
+ end
15
+ end
@@ -2,30 +2,30 @@ require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
2
2
 
3
3
  describe "Varnish" do
4
4
  before(:each) do
5
- @telnet_mock = mock('Net::Telnet')
6
- Net::Telnet.stub!(:new).and_return(@telnet_mock)
7
- @telnet_mock.stub!(:close)
8
- @telnet_mock.stub!(:cmd)
9
- @telnet_mock.stub!(:puts)
10
- @telnet_mock.stub!(:waitfor)
5
+ @telnet_mock = double('Net::Telnet')
6
+ Net::Telnet.stub(:new).and_return(@telnet_mock)
7
+ @telnet_mock.stub(:close)
8
+ @telnet_mock.stub(:cmd)
9
+ @telnet_mock.stub(:puts)
10
+ @telnet_mock.stub(:waitfor)
11
11
  Lacquer.configuration.retries.should == 5
12
12
  end
13
13
 
14
14
  describe "with any command" do
15
15
  describe "when connection is unsuccessful" do
16
16
  it "should raise a Lacquer::VarnishError" do
17
- @telnet_mock.stub!(:cmd).and_raise(Timeout::Error)
18
- lambda {
17
+ @telnet_mock.stub(:cmd).and_raise(Timeout::Error)
18
+ expect {
19
19
  Lacquer::Varnish.new.purge('/')
20
- }.should raise_error(Lacquer::VarnishError)
20
+ }.to raise_error(Lacquer::VarnishError)
21
21
  end
22
22
 
23
23
  it "should retry on failure before erroring" do
24
- @telnet_mock.stub!(:cmd).and_raise(Timeout::Error)
24
+ @telnet_mock.stub(:cmd).and_raise(Timeout::Error)
25
25
  Net::Telnet.should_receive(:new).exactly(5).times
26
- lambda {
26
+ expect {
27
27
  Lacquer::Varnish.new.purge('/')
28
- }.should raise_error(Lacquer::VarnishError)
28
+ }.to raise_error(Lacquer::VarnishError)
29
29
  end
30
30
 
31
31
  it "should close the connection afterwards" do
@@ -44,13 +44,13 @@ describe "Varnish" do
44
44
  end
45
45
 
46
46
  it "should return successfully when using correct secret" do
47
- @telnet_mock.stub!(:waitfor).with("Match" => /^107/).and_yield("107 59 \nhaalpffwlcvblmdrinpnjwigwsbiiigq\n\nAuthentication required.\n\n")
48
- @telnet_mock.stub!(:cmd).with("String" => "auth a4aefcde4b0ee27268af1c9ed613e3220601276b48f9ae5914f801db6c8ef612", "Match" => /\d{3}/).and_yield('200')
49
- @telnet_mock.stub!(:cmd).with("String" => "url.purge /", "Match" => /\n\n/).and_yield('200')
47
+ @telnet_mock.stub(:waitfor).with("Match" => /^107/).and_yield("107 59 \nhaalpffwlcvblmdrinpnjwigwsbiiigq\n\nAuthentication required.\n\n")
48
+ @telnet_mock.stub(:cmd).with("String" => "auth a4aefcde4b0ee27268af1c9ed613e3220601276b48f9ae5914f801db6c8ef612", "Match" => /\d{3}/).and_yield('200')
49
+ @telnet_mock.stub(:cmd).with("String" => "url.purge /", "Match" => /\n\n/).and_yield('200')
50
50
 
51
- lambda {
51
+ expect {
52
52
  Lacquer::Varnish.new.purge('/')
53
- }.should_not raise_error(Lacquer::AuthenticationError)
53
+ }.not_to raise_error
54
54
  end
55
55
 
56
56
  after(:each) do
@@ -63,13 +63,13 @@ describe "Varnish" do
63
63
  Lacquer.configuration.varnish_servers.first[:secret] = "the wrong secret"
64
64
  end
65
65
  it "should raise Lacquer::AuthenticationError when using wrong secret" do
66
- @telnet_mock.stub!(:waitfor).with("Match" => /^107/).and_yield("107 59 \nhaalpffwlcvblmdrinpnjwigwsbiiigq\n\nAuthentication required.\n\n")
67
- @telnet_mock.stub!(:cmd).with("String" => "auth 767dc6ec9eca6e4155d20c8479d3a1a10cf88d92c3846388a830d7fd966d58f9", "Match" => /\d{3}/).and_yield('107')
68
- @telnet_mock.stub!(:cmd).with("url.purge /").and_yield('200')
66
+ @telnet_mock.stub(:waitfor).with("Match" => /^107/).and_yield("107 59 \nhaalpffwlcvblmdrinpnjwigwsbiiigq\n\nAuthentication required.\n\n")
67
+ @telnet_mock.stub(:cmd).with("String" => "auth 767dc6ec9eca6e4155d20c8479d3a1a10cf88d92c3846388a830d7fd966d58f9", "Match" => /\d{3}/).and_yield('107')
68
+ @telnet_mock.stub(:cmd).with("url.purge /").and_yield('200')
69
69
 
70
- lambda {
70
+ expect {
71
71
  Lacquer::Varnish.new.purge('/')
72
- }.should raise_error(Lacquer::AuthenticationError)
72
+ }.to raise_error(Lacquer::AuthenticationError)
73
73
  end
74
74
  after(:each) do
75
75
  Lacquer.configuration.varnish_servers.first[:secret] = nil
@@ -79,14 +79,14 @@ describe "Varnish" do
79
79
 
80
80
  describe "when connection is unsuccessful and an error handler is set" do
81
81
  before(:each) do
82
- Lacquer.configuration.command_error_handler = mock("command_error_handler")
82
+ Lacquer.configuration.command_error_handler = double("command_error_handler")
83
83
  end
84
84
  it "should call handler on error" do
85
- @telnet_mock.stub!(:cmd).and_raise(Timeout::Error)
85
+ @telnet_mock.stub(:cmd).and_raise(Timeout::Error)
86
86
  Lacquer.configuration.command_error_handler.should_receive(:call).exactly(1).times
87
- lambda {
87
+ expect {
88
88
  Lacquer::Varnish.new.purge('/')
89
- }.should_not raise_error(Lacquer::VarnishError)
89
+ }.not_to raise_error
90
90
  end
91
91
  end
92
92
 
@@ -94,7 +94,7 @@ describe "Varnish" do
94
94
 
95
95
  describe "when sending a stats command" do
96
96
  it "should return an array of stats" do
97
- @telnet_mock.stub!(:cmd).and_yield(%Q[
97
+ @telnet_mock.stub(:cmd).and_yield(%Q[
98
98
  200 2023
99
99
  6263596 Client connections accepted
100
100
  6260911 Client requests received
@@ -169,7 +169,7 @@ Closing CLI connection
169
169
 
170
170
  describe "when sending a purge command" do
171
171
  it "should return successfully" do
172
- @telnet_mock.stub!(:cmd).with("String" => "url.purge /", "Match" => /\n\n/).and_yield('200')
172
+ @telnet_mock.stub(:cmd).with("String" => "url.purge /", "Match" => /\n\n/).and_yield('200')
173
173
  Lacquer::Varnish.new.purge('/').should be(true)
174
174
  end
175
175
  end
@@ -3,17 +3,17 @@ require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
3
3
  describe "Varnishd" do
4
4
  before do
5
5
  spec_root = Pathname.new(__FILE__).dirname.join('..').expand_path
6
- Lacquer::Varnishd.stub!(:started_check_delay).and_return(0)
7
- Lacquer::Varnishd.stub!(:env).and_return('test')
8
- Lacquer::Varnishd.stub!(:root_path).and_return(spec_root)
6
+ Lacquer::Varnishd.stub(:started_check_delay).and_return(0)
7
+ Lacquer::Varnishd.stub(:env).and_return('test')
8
+ Lacquer::Varnishd.stub(:root_path).and_return(spec_root)
9
9
  end
10
10
 
11
11
  def executes_with(regexp)
12
12
  new_method = Lacquer::Varnishd.method(:new)
13
- Lacquer::Varnishd.stub!(:new).and_return do |*args|
13
+ Lacquer::Varnishd.stub(:new).and_return do |*args|
14
14
  varnishd = new_method.call(*args)
15
15
  varnishd.should_receive(:execute).with(regexp)
16
- varnishd.stub!(:log)
16
+ varnishd.stub(:log)
17
17
  varnishd
18
18
  end
19
19
  end
@@ -66,14 +66,14 @@ describe "Varnishd" do
66
66
  end
67
67
 
68
68
  it "raises error if vcl_script_file is not present" do
69
- Lacquer::Varnishd.stub!(:vcl_script_filename).and_return("config/file_not_found.vcl")
69
+ Lacquer::Varnishd.stub(:vcl_script_filename).and_return("config/file_not_found.vcl")
70
70
  expect {
71
71
  Lacquer::Varnishd.new.vcl_script_path
72
72
  }.to raise_error
73
73
  end
74
74
 
75
75
  it "renders vcl file when erb is present" do
76
- Lacquer::Varnishd.stub!(:vcl_script_filename).and_return("config/generate.vcl")
76
+ Lacquer::Varnishd.stub(:vcl_script_filename).and_return("config/generate.vcl")
77
77
  result = Lacquer::Varnishd.new.render_vcl
78
78
  result.should include('.host = "0.0.0.0"')
79
79
  result.should include('.port = "3000"')
@@ -21,6 +21,18 @@ end
21
21
 
22
22
  module Resque; end
23
23
 
24
+ module Sidekiq
25
+ module Worker
26
+ module ClassMethods
27
+ def sidekiq_options(options); end
28
+ end
29
+
30
+ def self.included(base)
31
+ base.extend(ClassMethods)
32
+ end
33
+ end
34
+ end
35
+
24
36
  Lacquer.configure do |config|
25
37
  config.enable_cache = true
26
38
  config.default_ttl = 1.week
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lacquer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
5
- prerelease:
4
+ version: 0.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Russ Smith (russ@bashme.org)
@@ -12,28 +11,25 @@ authors:
12
11
  autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2012-12-03 00:00:00.000000000 Z
14
+ date: 2014-01-14 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: activesupport
19
18
  requirement: !ruby/object:Gem::Requirement
20
- none: false
21
19
  requirements:
22
- - - ! '>='
20
+ - - '>='
23
21
  - !ruby/object:Gem::Version
24
22
  version: 2.3.10
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - '>='
31
28
  - !ruby/object:Gem::Version
32
29
  version: 2.3.10
33
30
  - !ruby/object:Gem::Dependency
34
31
  name: i18n
35
32
  requirement: !ruby/object:Gem::Requirement
36
- none: false
37
33
  requirements:
38
34
  - - ~>
39
35
  - !ruby/object:Gem::Version
@@ -41,7 +37,6 @@ dependencies:
41
37
  type: :runtime
42
38
  prerelease: false
43
39
  version_requirements: !ruby/object:Gem::Requirement
44
- none: false
45
40
  requirements:
46
41
  - - ~>
47
42
  - !ruby/object:Gem::Version
@@ -49,39 +44,34 @@ dependencies:
49
44
  - !ruby/object:Gem::Dependency
50
45
  name: erubis
51
46
  requirement: !ruby/object:Gem::Requirement
52
- none: false
53
47
  requirements:
54
- - - ! '>='
48
+ - - '>='
55
49
  - !ruby/object:Gem::Version
56
50
  version: '0'
57
51
  type: :runtime
58
52
  prerelease: false
59
53
  version_requirements: !ruby/object:Gem::Requirement
60
- none: false
61
54
  requirements:
62
- - - ! '>='
55
+ - - '>='
63
56
  - !ruby/object:Gem::Version
64
57
  version: '0'
65
58
  - !ruby/object:Gem::Dependency
66
59
  name: rake
67
60
  requirement: !ruby/object:Gem::Requirement
68
- none: false
69
61
  requirements:
70
- - - ! '>='
62
+ - - '>='
71
63
  - !ruby/object:Gem::Version
72
64
  version: '0'
73
65
  type: :development
74
66
  prerelease: false
75
67
  version_requirements: !ruby/object:Gem::Requirement
76
- none: false
77
68
  requirements:
78
- - - ! '>='
69
+ - - '>='
79
70
  - !ruby/object:Gem::Version
80
71
  version: '0'
81
72
  - !ruby/object:Gem::Dependency
82
73
  name: rspec
83
74
  requirement: !ruby/object:Gem::Requirement
84
- none: false
85
75
  requirements:
86
76
  - - ~>
87
77
  - !ruby/object:Gem::Version
@@ -89,7 +79,6 @@ dependencies:
89
79
  type: :development
90
80
  prerelease: false
91
81
  version_requirements: !ruby/object:Gem::Requirement
92
- none: false
93
82
  requirements:
94
83
  - - ~>
95
84
  - !ruby/object:Gem::Version
@@ -97,17 +86,15 @@ dependencies:
97
86
  - !ruby/object:Gem::Dependency
98
87
  name: yard
99
88
  requirement: !ruby/object:Gem::Requirement
100
- none: false
101
89
  requirements:
102
- - - ! '>='
90
+ - - '>='
103
91
  - !ruby/object:Gem::Version
104
92
  version: '0'
105
93
  type: :development
106
94
  prerelease: false
107
95
  version_requirements: !ruby/object:Gem::Requirement
108
- none: false
109
96
  requirements:
110
- - - ! '>='
97
+ - - '>='
111
98
  - !ruby/object:Gem::Version
112
99
  version: '0'
113
100
  description: Rails drop in for Varnish support.
@@ -139,6 +126,7 @@ files:
139
126
  - lib/lacquer/railtie.rb
140
127
  - lib/lacquer/recipes.rb
141
128
  - lib/lacquer/resque_job.rb
129
+ - lib/lacquer/sidekiq_worker.rb
142
130
  - lib/lacquer/tasks.rb
143
131
  - lib/lacquer/varnish.rb
144
132
  - lib/lacquer/varnishd.rb
@@ -152,33 +140,33 @@ files:
152
140
  - spec/lacquer/cache_utils_spec.rb
153
141
  - spec/lacquer/delayed_job_job_spec.rb
154
142
  - spec/lacquer/resque_job_spec.rb
143
+ - spec/lacquer/sidekiq_worker_spec.rb
155
144
  - spec/lacquer/varnish_spec.rb
156
145
  - spec/lacquer/varnishd_spec.rb
157
146
  - spec/spec_helper.rb
158
147
  - tasks/lacquer.rake
159
148
  homepage: http://github.com/russ/lacquer
160
149
  licenses: []
150
+ metadata: {}
161
151
  post_install_message:
162
152
  rdoc_options: []
163
153
  require_paths:
164
154
  - lib
165
155
  required_ruby_version: !ruby/object:Gem::Requirement
166
- none: false
167
156
  requirements:
168
- - - ! '>='
157
+ - - '>='
169
158
  - !ruby/object:Gem::Version
170
159
  version: '0'
171
160
  required_rubygems_version: !ruby/object:Gem::Requirement
172
- none: false
173
161
  requirements:
174
- - - ! '>='
162
+ - - '>='
175
163
  - !ruby/object:Gem::Version
176
164
  version: '0'
177
165
  requirements: []
178
166
  rubyforge_project: lacquer
179
- rubygems_version: 1.8.23
167
+ rubygems_version: 2.0.3
180
168
  signing_key:
181
- specification_version: 3
169
+ specification_version: 4
182
170
  summary: Rails drop in for Varnish support.
183
171
  test_files:
184
172
  - spec/config/generate.vcl.erb
@@ -188,6 +176,7 @@ test_files:
188
176
  - spec/lacquer/cache_utils_spec.rb
189
177
  - spec/lacquer/delayed_job_job_spec.rb
190
178
  - spec/lacquer/resque_job_spec.rb
179
+ - spec/lacquer/sidekiq_worker_spec.rb
191
180
  - spec/lacquer/varnish_spec.rb
192
181
  - spec/lacquer/varnishd_spec.rb
193
182
  - spec/spec_helper.rb