lacquer 0.4.0 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -20
  3. data/.travis.yml +3 -0
  4. data/Gemfile +2 -7
  5. data/README.md +260 -0
  6. data/Rakefile +11 -33
  7. data/init.rb +1 -1
  8. data/lacquer.gemspec +19 -69
  9. data/lib/generators/lacquer/install_generator.rb +5 -1
  10. data/lib/generators/lacquer/templates/initializer.rb +15 -3
  11. data/lib/generators/lacquer/templates/{varnish.sample.vcl → varnish.vcl.erb} +27 -27
  12. data/lib/generators/lacquer/templates/varnishd.yml +31 -0
  13. data/lib/lacquer/cache_control.rb +75 -0
  14. data/lib/lacquer/cache_utils.rb +14 -12
  15. data/lib/lacquer/capistrano/v2/hooks.rb +21 -0
  16. data/lib/lacquer/capistrano/v3/tasks/lacquer.rake +24 -0
  17. data/lib/lacquer/capistrano.rb +7 -0
  18. data/lib/lacquer/configuration.rb +12 -0
  19. data/lib/lacquer/delayed_job_job.rb +2 -2
  20. data/lib/lacquer/railtie.rb +9 -0
  21. data/lib/lacquer/recipes.rb +62 -0
  22. data/lib/lacquer/resque_job.rb +2 -2
  23. data/lib/lacquer/sidekiq_worker.rb +11 -0
  24. data/lib/lacquer/tasks.rb +48 -0
  25. data/lib/lacquer/varnish.rb +35 -4
  26. data/lib/lacquer/varnishd.rb +152 -0
  27. data/lib/lacquer/version.rb +3 -0
  28. data/lib/lacquer.rb +9 -0
  29. data/rails/init.rb +1 -1
  30. data/recipes/lacquer.rb +1 -0
  31. data/spec/config/generate.vcl.erb +15 -0
  32. data/spec/config/varnish.vcl +15 -0
  33. data/spec/config/varnishd.yml +12 -0
  34. data/spec/lacquer/cache_control_spec.rb +74 -0
  35. data/spec/lacquer/cache_utils_spec.rb +20 -8
  36. data/spec/lacquer/delayed_job_job_spec.rb +4 -2
  37. data/spec/lacquer/resque_job_spec.rb +4 -2
  38. data/spec/lacquer/sidekiq_worker_spec.rb +15 -0
  39. data/spec/lacquer/varnish_spec.rb +62 -18
  40. data/spec/lacquer/varnishd_spec.rb +122 -0
  41. data/spec/spec_helper.rb +13 -1
  42. data/tasks/lacquer.rake +1 -0
  43. metadata +135 -66
  44. data/.bundle/config +0 -2
  45. data/Gemfile.lock +0 -39
  46. data/README.rdoc +0 -83
  47. data/VERSION +0 -1
metadata CHANGED
@@ -1,115 +1,184 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lacquer
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.6
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Russ Smith (russ@bashme.org)
14
8
  - Ryan Johns
15
9
  - Garry Tan (garry@posterous.com), Gabe da Silveira (gabe@websaviour.com)
10
+ - Håkon Lerring
16
11
  autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
-
20
- date: 2010-11-03 00:00:00 -07:00
21
- default_executable:
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
14
+ date: 2017-06-07 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activesupport
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.3.10
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.3.10
30
+ - !ruby/object:Gem::Dependency
31
+ name: i18n
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '0.4'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.4'
44
+ - !ruby/object:Gem::Dependency
45
+ name: erubis
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: rake
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
24
65
  type: :development
25
66
  prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ - !ruby/object:Gem::Dependency
26
73
  name: rspec
27
- version_requirements: &id001 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ~>
31
- - !ruby/object:Gem::Version
32
- hash: 27
33
- segments:
34
- - 1
35
- - 3
36
- - 0
37
- version: 1.3.0
38
- requirement: *id001
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - "~>"
77
+ - !ruby/object:Gem::Version
78
+ version: '2.5'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '2.5'
86
+ - !ruby/object:Gem::Dependency
87
+ name: yard
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
39
100
  description: Rails drop in for Varnish support.
40
101
  email: russ@bashme.org
41
102
  executables: []
42
-
43
103
  extensions: []
44
-
45
- extra_rdoc_files:
46
- - LICENSE
47
- - README.rdoc
48
- files:
49
- - .bundle/config
50
- - .document
51
- - .gitignore
104
+ extra_rdoc_files: []
105
+ files:
106
+ - ".document"
107
+ - ".gitignore"
108
+ - ".travis.yml"
52
109
  - Gemfile
53
- - Gemfile.lock
54
110
  - LICENSE
55
- - README.rdoc
111
+ - README.md
56
112
  - Rakefile
57
- - VERSION
58
113
  - init.rb
59
114
  - lacquer.gemspec
60
115
  - lib/generators/lacquer/USAGE
61
116
  - lib/generators/lacquer/install_generator.rb
62
117
  - lib/generators/lacquer/templates/initializer.rb
63
- - lib/generators/lacquer/templates/varnish.sample.vcl
118
+ - lib/generators/lacquer/templates/varnish.vcl.erb
119
+ - lib/generators/lacquer/templates/varnishd.yml
64
120
  - lib/lacquer.rb
121
+ - lib/lacquer/cache_control.rb
65
122
  - lib/lacquer/cache_utils.rb
123
+ - lib/lacquer/capistrano.rb
124
+ - lib/lacquer/capistrano/v2/hooks.rb
125
+ - lib/lacquer/capistrano/v3/tasks/lacquer.rake
66
126
  - lib/lacquer/configuration.rb
67
127
  - lib/lacquer/delayed_job_job.rb
128
+ - lib/lacquer/railtie.rb
129
+ - lib/lacquer/recipes.rb
68
130
  - lib/lacquer/resque_job.rb
131
+ - lib/lacquer/sidekiq_worker.rb
132
+ - lib/lacquer/tasks.rb
69
133
  - lib/lacquer/varnish.rb
134
+ - lib/lacquer/varnishd.rb
135
+ - lib/lacquer/version.rb
70
136
  - rails/init.rb
137
+ - recipes/lacquer.rb
138
+ - spec/config/generate.vcl.erb
139
+ - spec/config/varnish.vcl
140
+ - spec/config/varnishd.yml
141
+ - spec/lacquer/cache_control_spec.rb
71
142
  - spec/lacquer/cache_utils_spec.rb
72
143
  - spec/lacquer/delayed_job_job_spec.rb
73
144
  - spec/lacquer/resque_job_spec.rb
145
+ - spec/lacquer/sidekiq_worker_spec.rb
74
146
  - spec/lacquer/varnish_spec.rb
147
+ - spec/lacquer/varnishd_spec.rb
75
148
  - spec/spec_helper.rb
76
- has_rdoc: true
149
+ - tasks/lacquer.rake
77
150
  homepage: http://github.com/russ/lacquer
78
151
  licenses: []
79
-
152
+ metadata: {}
80
153
  post_install_message:
81
- rdoc_options:
82
- - --charset=UTF-8
83
- require_paths:
154
+ rdoc_options: []
155
+ require_paths:
84
156
  - lib
85
- required_ruby_version: !ruby/object:Gem::Requirement
86
- none: false
87
- requirements:
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ requirements:
88
159
  - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: 3
91
- segments:
92
- - 0
93
- version: "0"
94
- required_rubygems_version: !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ requirements:
97
164
  - - ">="
98
- - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
- version: "0"
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
103
167
  requirements: []
104
-
105
- rubyforge_project:
106
- rubygems_version: 1.3.7
168
+ rubyforge_project: lacquer
169
+ rubygems_version: 2.5.2
107
170
  signing_key:
108
- specification_version: 3
171
+ specification_version: 4
109
172
  summary: Rails drop in for Varnish support.
110
- test_files:
173
+ test_files:
174
+ - spec/config/generate.vcl.erb
175
+ - spec/config/varnish.vcl
176
+ - spec/config/varnishd.yml
177
+ - spec/lacquer/cache_control_spec.rb
111
178
  - spec/lacquer/cache_utils_spec.rb
112
179
  - spec/lacquer/delayed_job_job_spec.rb
113
180
  - spec/lacquer/resque_job_spec.rb
181
+ - spec/lacquer/sidekiq_worker_spec.rb
114
182
  - spec/lacquer/varnish_spec.rb
183
+ - spec/lacquer/varnishd_spec.rb
115
184
  - spec/spec_helper.rb
data/.bundle/config DELETED
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_DISABLE_SHARED_GEMS: "1"
data/Gemfile.lock DELETED
@@ -1,39 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- activesupport (3.0.1)
5
- diff-lcs (1.1.2)
6
- gemcutter (0.5.0)
7
- json_pure
8
- git (1.2.5)
9
- i18n (0.4.1)
10
- jeweler (1.4.0)
11
- gemcutter (>= 0.1.0)
12
- git (>= 1.2.5)
13
- rubyforge (>= 2.0.0)
14
- json_pure (1.4.6)
15
- rake (0.8.7)
16
- rspec (2.0.0)
17
- rspec-core (= 2.0.0)
18
- rspec-expectations (= 2.0.0)
19
- rspec-mocks (= 2.0.0)
20
- rspec-core (2.0.0)
21
- rspec-expectations (2.0.0)
22
- diff-lcs (>= 1.1.2)
23
- rspec-mocks (2.0.0)
24
- rspec-core (= 2.0.0)
25
- rspec-expectations (= 2.0.0)
26
- rubyforge (2.0.4)
27
- json_pure (>= 1.1.7)
28
- yard (0.6.1)
29
-
30
- PLATFORMS
31
- ruby
32
-
33
- DEPENDENCIES
34
- activesupport (= 3.0.1)
35
- i18n (= 0.4.1)
36
- jeweler
37
- rake
38
- rspec (= 2.0.0)
39
- yard
data/README.rdoc DELETED
@@ -1,83 +0,0 @@
1
- = lacquer
2
-
3
- Rails drop in for Varnish support.
4
-
5
- == Install
6
- Basic installation
7
-
8
- sudo gem install lacquer
9
-
10
- config/initializers/lacquer.rb
11
-
12
- Lacquer.configure do |config|
13
- # Globally enable/disable cache
14
- config.enable_cache = true
15
-
16
- # Unless overridden in a controller or action, the default will be used
17
- config.default_ttl = 1.week
18
-
19
- # Can be :none, :delayed_job, :resque
20
- config.job_backend = :none
21
-
22
- # Array of Varnish servers to manage
23
- config.varnish_servers << {
24
- :host => "0.0.0.0", :port => 6082
25
- }
26
-
27
- # Number of retries
28
- config.retries = 5
29
-
30
- # config handler (optional, if you use Hoptoad or another error tracking service)
31
- config.command_error_handler = lambda { |s| HoptoadNotifier.notify(s) }
32
- end
33
-
34
- app/controllers/application_controller.rb
35
-
36
- class ApplicationController < ActionController::Base
37
- include Lacquer::CacheUtils
38
- end
39
-
40
- == Usage
41
-
42
- To set a custom ttl for a controller:
43
-
44
- before_filter { |controller| controller.set_cache_ttl(15.minutes) }
45
-
46
- Clearing the cache:
47
-
48
- class Posts < ApplicationController
49
- after_filter :clear_cache, :only => [ :create, :update, :destroy ]
50
-
51
- private
52
-
53
- def clear_cache
54
- clear_cache_for(
55
- root_path,
56
- posts_path,
57
- post_path(@post))
58
- end
59
- end
60
-
61
- == Gotchas
62
-
63
- The default TTL for most actions is set to 0, since for most cases you'll probably want to be fairly explicit about what pages do get cached by varnish. The default cache header is typically:
64
-
65
- Cache-Control: max-age=0, no-cache, private
66
-
67
- This is good for normal controller actions, since you won't want to cache them. If TTL for an action is set to 0, it won't mess with the default header.
68
-
69
- The key gotcha here is that cached pages strip cookies, so if your application relies on sessions and uses authenticity tokens, the user will need a session cookie set before form actions will work. Setting default TTL to 0 here will make sure these session cookies won't break.
70
-
71
- As a result, all you have to do to set a cacheable action is the before filter above.
72
-
73
- == Note on Patches/Pull Requests
74
-
75
- * Fork the project.
76
- * Make your feature addition or bug fix.
77
- * Add tests for it. This is important so I don't break it in a future version unintentionally.
78
- * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
79
- * Send me a pull request. Bonus points for topic branches.
80
-
81
- == Copyright
82
-
83
- Copyright (c) 2010 Russ Smith. See LICENSE for details.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.4.0