faithfulgeek-naked_rack 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +11 -6
- data/VERSION.yml +1 -1
- data/lib/naked_rack.rb +8 -3
- metadata +2 -2
data/README.textile
CHANGED
@@ -12,12 +12,19 @@ h2. Options
|
|
12
12
|
|
13
13
|
@naked_rack@ supports the following options:
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
@:display_banner => [true]|false@ - This will replace all stylesheet tags with an HTML comment advertising CSS Naked Day (not to mention giving itself some love)
|
16
|
+
|
17
|
+
@:remove_js => true|[false]@ - Also take out any @script@ tags. Prove your unobtrusiveness with this option.
|
18
|
+
|
19
|
+
@:permanent => true|[false]@ - Ignores the date and puts the site in permanent naked mode. This is really meant to be used during testing, but make sure you turn it off!
|
18
20
|
|
19
21
|
h2. Installation
|
20
22
|
|
23
|
+
To install the library:
|
24
|
+
|
25
|
+
sudo gem install faithfulgeek-naked_rack
|
26
|
+
|
27
|
+
|
21
28
|
Rails (in @config/environment.rb@):
|
22
29
|
|
23
30
|
@config.middleware.use "NakedRack"[, options]@
|
@@ -33,12 +40,10 @@ Rackup Script:
|
|
33
40
|
|
34
41
|
Thanks for using naked_rack! Hope everyone has a safe and happy CSS Naked Day.
|
35
42
|
|
36
|
-
hr.
|
37
|
-
|
38
43
|
Developed by:
|
39
44
|
|
40
45
|
@joefiorini (irc: faithfulgeek)
|
41
46
|
|
42
|
-
|
47
|
+
h3. Copyright
|
43
48
|
|
44
49
|
Copyright (c) 2009 faithfulgeek. See LICENSE for details.
|
data/VERSION.yml
CHANGED
data/lib/naked_rack.rb
CHANGED
@@ -14,9 +14,7 @@ class NakedRack
|
|
14
14
|
status, headers, response = @app.call(env)
|
15
15
|
body = ''
|
16
16
|
response.each do |str|
|
17
|
-
body
|
18
|
-
body = remove_style_tags(body).to_html
|
19
|
-
body = remove_js_tags(body).to_html if @options[:remove_js]
|
17
|
+
body << remove_all_tags(str)
|
20
18
|
end
|
21
19
|
headers['Content-Length'] = body.length.to_s
|
22
20
|
[status, headers, body]
|
@@ -24,6 +22,13 @@ class NakedRack
|
|
24
22
|
|
25
23
|
private
|
26
24
|
|
25
|
+
def remove_all_tags body
|
26
|
+
body = remove_link_tags(body).to_html
|
27
|
+
body = remove_style_tags(body).to_html
|
28
|
+
body = remove_js_tags(body).to_html if @options[:remove_js]
|
29
|
+
body
|
30
|
+
end
|
31
|
+
|
27
32
|
def remove_link_tags body
|
28
33
|
remove_tags body, "//link[@rel='stylesheet']"
|
29
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faithfulgeek-naked_rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- faithfulgeek
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|