deadweight 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +27 -24
  2. data/lib/deadweight.rb +0 -4
  3. 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, indeed language) your website is built on, but optimised for Ruby and Rails.
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
- I'm going to tell you about the coolest way to use it first.
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
- ### The Coolest Way to Use It ###
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. THIS IS PRETTY COOL YOU SHOULD TRY IT. (It's also somewhat new and untested, but you're the kind of person who just _loves_ it out here on the edge, I can tell.)
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
- Here's how it works. First, put this in your `Gemfile`:
31
+ First, put this in your `Gemfile`:
23
32
 
24
33
  group :test do
25
- gem 'colored' # optional, in the same way that dressing respectably when you leave the house is 'optional'
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
- ### Or Make a Rake Task ###
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 = %w( /stylesheets/style.css )
44
- dw.pages = %w( / /page/1 /about )
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
- ### Or Run it From the Command Line ###
58
+ ### Call it Directly from Ruby ###
50
59
 
51
- $ deadweight -s styles.css -s ie.css index.html about.html
52
- $ deadweight -s http://www.tigerbloodwins.com/index.css http://www.tigerbloodwins.com/
53
- $ deadweight --root http://kottke.org/ -s '/templates/2009/css.php?p=mac' / /everfresh /about
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
- You can pipe in CSS rules from STDIN:
67
+ ### Pipe In CSS Rules from STDIN ###
56
68
 
57
69
  $ cat styles.css | deadweight index.html
58
70
 
59
- And you can use it as an HTTP proxy:
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
 
@@ -1,7 +1,3 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- Bundler.setup
4
-
5
1
  $LOAD_PATH.concat Dir.glob(File.expand_path('../../vendor/gems/*/lib', __FILE__))
6
2
 
7
3
  require 'css_parser'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
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-03-04 00:00:00 +00:00
17
+ date: 2011-04-18 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency