slimmer 3.3.2 → 3.3.3
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.md +19 -0
- data/lib/slimmer/app.rb +10 -2
- data/lib/slimmer/version.rb +1 -1
- metadata +47 -47
data/README.md
CHANGED
@@ -53,6 +53,25 @@ To get this, include Slimmer::Template in your controller:
|
|
53
53
|
include Slimmer::Template
|
54
54
|
end
|
55
55
|
|
56
|
+
## Logging
|
57
|
+
|
58
|
+
Slimmer can be configured with a logger by passing in a logger instance (anything that quacks like an instance of Logger).
|
59
|
+
For example to log to the Rails log, put the following in an initializer:
|
60
|
+
|
61
|
+
YourApp::Application.configure do
|
62
|
+
config.slimmer.logger = Rails.logger
|
63
|
+
end
|
64
|
+
|
65
|
+
**Note:** This can't be in `application.rb` because the Rails logger hasn't been initialized by then.
|
66
|
+
|
67
|
+
**Debug logging**
|
68
|
+
|
69
|
+
By default if you pass in a logger with its log level set to debug, slimmer will dup this logger and reduce the level to info. (Slimmer's debug logging is very noisy). To prevent this, set the `enable_debugging` option to true. e.g. for Rails:
|
70
|
+
|
71
|
+
YourApp::Application.configure do
|
72
|
+
config.slimmer.enable_debugging = true
|
73
|
+
end
|
74
|
+
|
56
75
|
## The name
|
57
76
|
|
58
77
|
Slimmer was extracted from a much larger project called 'skinner'. 'slimmer' referred to the size
|
data/lib/slimmer/app.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Slimmer
|
2
2
|
class App
|
3
3
|
attr_accessor :logger
|
4
|
-
private :logger=, :logger
|
5
4
|
|
6
5
|
def initialize(app, *args, &block)
|
7
6
|
options = args.first || {}
|
@@ -9,6 +8,15 @@ module Slimmer
|
|
9
8
|
|
10
9
|
logger = options[:logger] || NullLogger.instance
|
11
10
|
self.logger = logger
|
11
|
+
begin
|
12
|
+
if logger.level == 0 # Log set to debug level
|
13
|
+
unless options[:enable_debugging]
|
14
|
+
self.logger = logger.dup
|
15
|
+
self.logger.level = 1 # info
|
16
|
+
end
|
17
|
+
end
|
18
|
+
rescue NoMethodError # In case logger doesn't respond_to? :level
|
19
|
+
end
|
12
20
|
|
13
21
|
if options.key? :template_path
|
14
22
|
raise "Template path should not be used. Use asset_host instead."
|
@@ -18,7 +26,7 @@ module Slimmer
|
|
18
26
|
options[:asset_host] = Plek.current.find("assets")
|
19
27
|
end
|
20
28
|
|
21
|
-
@skin = Skin.new options.merge(logger: logger)
|
29
|
+
@skin = Skin.new options.merge(logger: self.logger)
|
22
30
|
end
|
23
31
|
|
24
32
|
def call(env)
|
data/lib/slimmer/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: slimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 3.3.
|
5
|
+
version: 3.3.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ben Griffiths
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2012-09-
|
14
|
+
date: 2012-09-21 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: nokogiri
|
@@ -180,51 +180,51 @@ extra_rdoc_files: []
|
|
180
180
|
files:
|
181
181
|
- README.md
|
182
182
|
- CHANGELOG.md
|
183
|
+
- lib/tasks/slimmer.rake
|
183
184
|
- lib/slimmer.rb
|
184
|
-
- lib/slimmer/
|
185
|
-
- lib/slimmer/test_template.rb
|
186
|
-
- lib/slimmer/version.rb
|
185
|
+
- lib/slimmer/skin.rb
|
187
186
|
- lib/slimmer/railtie.rb
|
188
|
-
- lib/slimmer/
|
189
|
-
- lib/slimmer/
|
187
|
+
- lib/slimmer/template.rb
|
188
|
+
- lib/slimmer/test_template.rb
|
189
|
+
- lib/slimmer/test.rb
|
190
|
+
- lib/slimmer/app.rb
|
190
191
|
- lib/slimmer/processors/logo_class_inserter.rb
|
191
|
-
- lib/slimmer/processors/
|
192
|
-
- lib/slimmer/processors/
|
193
|
-
- lib/slimmer/processors/footer_remover.rb
|
194
|
-
- lib/slimmer/processors/google_analytics_configurator.rb
|
195
|
-
- lib/slimmer/processors/admin_title_inserter.rb
|
192
|
+
- lib/slimmer/processors/body_class_copier.rb
|
193
|
+
- lib/slimmer/processors/tag_mover.rb
|
196
194
|
- lib/slimmer/processors/search_path_setter.rb
|
197
195
|
- lib/slimmer/processors/title_inserter.rb
|
198
|
-
- lib/slimmer/processors/
|
199
|
-
- lib/slimmer/processors/section_inserter.rb
|
196
|
+
- lib/slimmer/processors/google_analytics_configurator.rb
|
200
197
|
- lib/slimmer/processors/conditional_comment_mover.rb
|
198
|
+
- lib/slimmer/processors/related_items_inserter.rb
|
199
|
+
- lib/slimmer/processors/header_context_inserter.rb
|
201
200
|
- lib/slimmer/processors/body_inserter.rb
|
202
|
-
- lib/slimmer/
|
203
|
-
- lib/slimmer/
|
201
|
+
- lib/slimmer/processors/admin_title_inserter.rb
|
202
|
+
- lib/slimmer/processors/report_a_problem_inserter.rb
|
203
|
+
- lib/slimmer/processors/section_inserter.rb
|
204
|
+
- lib/slimmer/processors/footer_remover.rb
|
204
205
|
- lib/slimmer/headers.rb
|
205
|
-
- lib/slimmer/
|
206
|
-
- lib/slimmer/
|
207
|
-
- lib/tasks/slimmer.rake
|
206
|
+
- lib/slimmer/version.rb
|
207
|
+
- lib/slimmer/artefact.rb
|
208
208
|
- Rakefile
|
209
|
-
- test/
|
209
|
+
- test/headers_test.rb
|
210
|
+
- test/artefact_test.rb
|
211
|
+
- test/fixtures/related.raw.html.erb
|
212
|
+
- test/fixtures/500.html.erb
|
213
|
+
- test/fixtures/404.html.erb
|
214
|
+
- test/fixtures/wrapper.html.erb
|
215
|
+
- test/fixtures/report_a_problem.raw.html.erb
|
216
|
+
- test/skin_test.rb
|
217
|
+
- test/processors/logo_class_inserter_test.rb
|
210
218
|
- test/processors/google_analytics_test.rb
|
211
|
-
- test/processors/body_inserter_test.rb
|
212
219
|
- test/processors/report_a_problem_inserter_test.rb
|
213
|
-
- test/processors/
|
220
|
+
- test/processors/body_inserter_test.rb
|
214
221
|
- test/processors/search_path_setter_test.rb
|
222
|
+
- test/processors/section_inserter_test.rb
|
215
223
|
- test/processors/related_items_inserter_test.rb
|
216
|
-
- test/processors/
|
224
|
+
- test/processors/header_context_inserter_test.rb
|
225
|
+
- test/typical_usage_test.rb
|
217
226
|
- test/test_template_dependency_on_static_test.rb
|
218
|
-
- test/headers_test.rb
|
219
227
|
- test/test_helper.rb
|
220
|
-
- test/typical_usage_test.rb
|
221
|
-
- test/artefact_test.rb
|
222
|
-
- test/skin_test.rb
|
223
|
-
- test/fixtures/404.html.erb
|
224
|
-
- test/fixtures/500.html.erb
|
225
|
-
- test/fixtures/wrapper.html.erb
|
226
|
-
- test/fixtures/related.raw.html.erb
|
227
|
-
- test/fixtures/report_a_problem.raw.html.erb
|
228
228
|
- bin/render_slimmer_error
|
229
229
|
homepage: http://github.com/alphagov/slimmer
|
230
230
|
licenses: []
|
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
239
|
requirements:
|
240
240
|
- - ">="
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
hash: -
|
242
|
+
hash: -600482071330210129
|
243
243
|
segments:
|
244
244
|
- 0
|
245
245
|
version: "0"
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
requirements:
|
249
249
|
- - ">="
|
250
250
|
- !ruby/object:Gem::Version
|
251
|
-
hash: -
|
251
|
+
hash: -600482071330210129
|
252
252
|
segments:
|
253
253
|
- 0
|
254
254
|
version: "0"
|
@@ -260,22 +260,22 @@ signing_key:
|
|
260
260
|
specification_version: 3
|
261
261
|
summary: Thinner than the skinner
|
262
262
|
test_files:
|
263
|
-
- test/
|
263
|
+
- test/headers_test.rb
|
264
|
+
- test/artefact_test.rb
|
265
|
+
- test/fixtures/related.raw.html.erb
|
266
|
+
- test/fixtures/500.html.erb
|
267
|
+
- test/fixtures/404.html.erb
|
268
|
+
- test/fixtures/wrapper.html.erb
|
269
|
+
- test/fixtures/report_a_problem.raw.html.erb
|
270
|
+
- test/skin_test.rb
|
271
|
+
- test/processors/logo_class_inserter_test.rb
|
264
272
|
- test/processors/google_analytics_test.rb
|
265
|
-
- test/processors/body_inserter_test.rb
|
266
273
|
- test/processors/report_a_problem_inserter_test.rb
|
267
|
-
- test/processors/
|
274
|
+
- test/processors/body_inserter_test.rb
|
268
275
|
- test/processors/search_path_setter_test.rb
|
276
|
+
- test/processors/section_inserter_test.rb
|
269
277
|
- test/processors/related_items_inserter_test.rb
|
270
|
-
- test/processors/
|
278
|
+
- test/processors/header_context_inserter_test.rb
|
279
|
+
- test/typical_usage_test.rb
|
271
280
|
- test/test_template_dependency_on_static_test.rb
|
272
|
-
- test/headers_test.rb
|
273
281
|
- test/test_helper.rb
|
274
|
-
- test/typical_usage_test.rb
|
275
|
-
- test/artefact_test.rb
|
276
|
-
- test/skin_test.rb
|
277
|
-
- test/fixtures/404.html.erb
|
278
|
-
- test/fixtures/500.html.erb
|
279
|
-
- test/fixtures/wrapper.html.erb
|
280
|
-
- test/fixtures/related.raw.html.erb
|
281
|
-
- test/fixtures/report_a_problem.raw.html.erb
|