deadweight 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -24
- data/lib/deadweight.rb +0 -4
- metadata +3 -3
data/README.md
CHANGED
@@ -8,21 +8,30 @@ Screencast!
|
|
8
8
|
|
9
9
|
Ryan Bates has worked his magic once again. [Head over here for an excellent introduction to Deadweight](http://railscasts.com/episodes/180-finding-unused-css).
|
10
10
|
|
11
|
+
How to Install It
|
12
|
+
-----------------
|
13
|
+
|
14
|
+
$ gem install deadweight
|
15
|
+
|
11
16
|
How to Use It
|
12
17
|
-------------
|
13
18
|
|
14
|
-
There are multiple ways to use Deadweight. It's designed to be completely agnostic of whatever framework (or
|
19
|
+
There are multiple ways to use Deadweight. It's designed to be completely agnostic of whatever framework (or indeed language) your website is built on, but optimised for Ruby and Rails.
|
20
|
+
|
21
|
+
### Run it From the Command Line ###
|
15
22
|
|
16
|
-
|
23
|
+
$ deadweight -s styles.css -s ie.css index.html about.html
|
24
|
+
$ deadweight -s http://www.tigerbloodwins.com/index.css http://www.tigerbloodwins.com/
|
25
|
+
$ deadweight --root http://kottke.org/ -s '/templates/2009/css.php?p=mac' / /everfresh /about
|
17
26
|
|
18
|
-
###
|
27
|
+
### Integrate it With Your Integration Tests ###
|
19
28
|
|
20
|
-
Deadweight can hijack your Rails integration tests (both the spartan Test::Unit type and the refreshing Cucumber variety), capturing every page that is returned by your app during testing and saving you the trouble of manually specifying a ton of URLs and login processses.
|
29
|
+
Deadweight can hijack your Rails integration tests (both the spartan Test::Unit type and the refreshing Cucumber variety), capturing every page that is returned by your app during testing and saving you the trouble of manually specifying a ton of URLs and login processses.
|
21
30
|
|
22
|
-
|
31
|
+
First, put this in your `Gemfile`:
|
23
32
|
|
24
33
|
group :test do
|
25
|
-
gem 'colored'
|
34
|
+
gem 'colored'
|
26
35
|
gem 'deadweight', :require => 'deadweight/hijack/rails'
|
27
36
|
end
|
28
37
|
|
@@ -33,42 +42,36 @@ Then, run your integration tests with the environment variable `DEADWEIGHT` set
|
|
33
42
|
|
34
43
|
Let me know how it goes. It's not terribly customisable at the moment (you can't specify what exact stylesheets to look at, or what selectors to ignore). I'm looking for your feedback on how you'd like to be able to do that.
|
35
44
|
|
36
|
-
###
|
45
|
+
### Rake Task ###
|
37
46
|
|
38
47
|
# lib/tasks/deadweight.rake
|
39
48
|
|
40
49
|
require 'deadweight'
|
41
50
|
|
42
51
|
Deadweight::RakeTask.new do |dw|
|
43
|
-
dw.stylesheets =
|
44
|
-
dw.pages =
|
52
|
+
dw.stylesheets = ["/stylesheets/style.css"]
|
53
|
+
dw.pages = ["/", "/page/1", "/about"]
|
45
54
|
end
|
46
55
|
|
47
56
|
Running `rake deadweight` will output all unused rules, one per line. Note that it looks at `http://localhost:3000` by default, so you'll need to have `script/server` (or whatever your server command looks like) running.
|
48
57
|
|
49
|
-
###
|
58
|
+
### Call it Directly from Ruby ###
|
50
59
|
|
51
|
-
|
52
|
-
|
53
|
-
|
60
|
+
require 'deadweight'
|
61
|
+
|
62
|
+
dw = Deadweight.new
|
63
|
+
dw.stylesheets = ["/stylesheets/style.css"]
|
64
|
+
dw.pages = ["/", "/page/1", "/about"]
|
65
|
+
puts dw.run
|
54
66
|
|
55
|
-
|
67
|
+
### Pipe In CSS Rules from STDIN ###
|
56
68
|
|
57
69
|
$ cat styles.css | deadweight index.html
|
58
70
|
|
59
|
-
|
71
|
+
### Use it as an HTTP Proxy ###
|
60
72
|
|
61
73
|
$ deadweight -l deadweight.log -s styles.css -w http://github.com/ -P
|
62
74
|
|
63
|
-
### Or Call it Directly ###
|
64
|
-
|
65
|
-
require 'deadweight'
|
66
|
-
|
67
|
-
dw = Deadweight.new
|
68
|
-
dw.stylesheets = %w( /stylesheets/style.css )
|
69
|
-
dw.pages = %w( / /page/1 /about )
|
70
|
-
puts dw.run
|
71
|
-
|
72
75
|
Setting the Root URL
|
73
76
|
--------------------
|
74
77
|
|
data/lib/deadweight.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Aanand Prasad
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-04-18 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|