klarlack 0.0.4 → 0.0.5
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.
- data/README.rdoc +1 -1
- data/VERSION.yml +1 -1
- data/lib/klarlack.rb +1 -1
- data/lib/varnish/client.rb +16 -9
- data/spec/klarlack_spec.rb +1 -0
- metadata +2 -2
data/README.rdoc
CHANGED
data/VERSION.yml
CHANGED
data/lib/klarlack.rb
CHANGED
data/lib/varnish/client.rb
CHANGED
@@ -117,13 +117,17 @@ module Varnish
|
|
117
117
|
|
118
118
|
# Purge objects from the cache or show the purge queue.
|
119
119
|
#
|
120
|
+
# Takes one or two arguments:
|
121
|
+
#
|
122
|
+
# 1.
|
120
123
|
# .purge :url, <regexp>
|
121
124
|
# .purge :hash, <regexp>
|
122
|
-
# .purge :list
|
123
|
-
# .purge <costum-field> <args>
|
124
125
|
#
|
125
|
-
#
|
126
|
-
#
|
126
|
+
# <regexp> is a string containing a varnish compatible regexp
|
127
|
+
#
|
128
|
+
# 2.
|
129
|
+
# .purge <costum-purge-conditions>
|
130
|
+
# .purge :list
|
127
131
|
#
|
128
132
|
# Returns true for purging, returns an array containing the purge queue
|
129
133
|
# for :list
|
@@ -132,14 +136,17 @@ module Varnish
|
|
132
136
|
# v = Varnish::Client.new
|
133
137
|
# v.purge :url, '.*'
|
134
138
|
#
|
139
|
+
# v.purge "req.http.host ~ www.foo.com && req.http.url ~ images"
|
140
|
+
#
|
135
141
|
# v.purge :list
|
136
142
|
# #=> [[1, "req.url ~ .*"]]
|
137
143
|
#
|
138
|
-
def purge(
|
139
|
-
c =
|
140
|
-
|
141
|
-
|
142
|
-
|
144
|
+
def purge(*args)
|
145
|
+
c = 'purge'
|
146
|
+
c << ".#{args.shift}" if [:url, :hash, :list].include?(args.first)
|
147
|
+
response = cmd(c, *args)
|
148
|
+
case c
|
149
|
+
when 'purge.list'
|
143
150
|
response.split("\n").map do |line|
|
144
151
|
a = line.split("\t")
|
145
152
|
[a[0].to_i, a[1]]
|
data/spec/klarlack_spec.rb
CHANGED
@@ -82,6 +82,7 @@ describe Varnish::Client do
|
|
82
82
|
@varnish.purge(:url, '^/articles/.*').should be_true
|
83
83
|
@varnish.purge(:hash, 12345).should be_true
|
84
84
|
@varnish.purge("req.http.host", "~", "www.example.com").should be_true
|
85
|
+
@varnish.purge("req.http.host ~ www.example.com").should be_true
|
85
86
|
end
|
86
87
|
|
87
88
|
it '#purge with :list should return an array with queued purges' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klarlack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Max Sch\xC3\xB6fmann"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-04 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|