headhunter 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e083d2cf2ed28ecd66e9fd0b7317c39565f996c
4
- data.tar.gz: 874442a4314a680b9582be26ff1ac475590b3079
3
+ metadata.gz: 8d287be5bc2f5e01f890c230b48551f4e5c2e8bd
4
+ data.tar.gz: 283aca4ad207e9bb2c61521c3d44acfde5a0c3ad
5
5
  SHA512:
6
- metadata.gz: 3ba8f645a5d4843b2e9e5df932dfe68cc91e2383e0cceb71c85b2c857c0b622e0f476957cadf321614c5302532f764f71056b7e0f6d45b7c2934af15a30c9282
7
- data.tar.gz: 7a4e13c8f0df5a84980e24d6ccfe1bd1333152cbbf66b8e754349be72d12a3732d22f6f4b44a31d276e645babef849e00e4eac37c8bde4bb5fd1fb9dd0f8cca2
6
+ metadata.gz: c101581f77a54f142e17a96b1d981f1bcb2c24f466dd14a03cbd49b541bec26baad1930b12ffd8c40e147443d6e6341b21dccb9523d7c3899468efbc1ed344b8
7
+ data.tar.gz: a798b94f7f2d39abb98b2ddabe59f9bef8dd2193d7d4ce5d14c78f5b16816da0858ff851a8e4e67d4dc4f8cb2120b66f9bc5d1e97d791057bb1d5a176d2c8394
data/README.md CHANGED
@@ -26,6 +26,10 @@ Just set the environment variable `HEADHUNTER` to `true` when running your tests
26
26
 
27
27
  Headhunter doesn't keep your tests from passing if invalid HTML or unused CSS is found. Instead it displays a short statistic after the tests are run.
28
28
 
29
+ $ rake HEADHUNTER=true
30
+
31
+ Precompiling assets for Headhunter... done!
32
+
29
33
  30/30 |============================= 100 ==============================>| Time: 00:00:02
30
34
 
31
35
  Finished in 2.65 seconds
@@ -47,11 +51,9 @@ Headhunter doesn't keep your tests from passing if invalid HTML or unused CSS is
47
51
 
48
52
  ## How it works
49
53
 
50
- Headhunter registers itself as middleware in the Rack stack and triggers validation for every HTML response.
51
-
52
- For every `.css` file, validation is also triggered. In addition, it iterates over every HTML page's selectors to see whether there exist any unused CSS definitions in your `.css` files.
54
+ Headhunter registers itself as middleware in the Rack stack and triggers validation for every HTML response. Headhunter also iterates over every `.css` file and triggers its validation. In addition, it checks which CSS selectors are really used in the HTML pages to see whether there exist any unused CSS definitions.
53
55
 
54
- For being able to validate CSS, `rake assets:precompile` is triggered at the beginning of running tests. This may slow down starting your tests a bit. (Notice: after the tests have finished, the precompiled assets are also removed automatically by running `rake assets:clobber`.)
56
+ For being able to validate CSS, `rake assets:precompile` is triggered at the beginning of running tests. This may slow down starting your tests a bit. **Notice: all precompiled assets will be removed after the tests have finished!**
55
57
 
56
58
  ## Requirements
57
59
 
@@ -74,6 +76,7 @@ You need a working internet connection to run CSS validation. As a Rails applica
74
76
  - HTML and CSS sources should not be compressed, to allow more concise error messages
75
77
  - Would be really useful to have the concrete URL of every validated HTML page. But can't find a way to extract it from Rack response.
76
78
  - There are not tests yet. I first want to see whether this gem would be appreciated by the community, and if so, I will definitely add tests.
79
+ - Didn't try this with AJAX requests yet. Would be great if such responses would be validated, too!
77
80
 
78
81
  ## Disclaimer
79
82
 
@@ -1,4 +1,4 @@
1
- class Headhunter
1
+ module Headhunter
2
2
  module Rack
3
3
  class CapturingMiddleware
4
4
  def initialize(app, headhunter)
@@ -1,9 +1,14 @@
1
+ require 'fileutils'
2
+
1
3
  module Headhunter
2
4
  class Runner
5
+ ASSETS_PATH = 'public/assets'
6
+
3
7
  attr_accessor :results
4
8
 
5
9
  def initialize(root)
6
- @root = root
10
+ @root = root
11
+ @temporary_assets = []
7
12
 
8
13
  precompile_assets!
9
14
 
@@ -34,18 +39,18 @@ module Headhunter
34
39
  private
35
40
 
36
41
  def precompile_assets!
37
- # Remove existing assets! This seems to be necessary to make sure that they don't exist twice, see http://stackoverflow.com/questions/20938891
38
- system 'rake assets:clobber HEADHUNTER=false &> /dev/null'
39
-
42
+ log.print "\nPrecompiling assets for Headhunter...".yellow
43
+ remove_assets! # Remove existing assets! This seems to be necessary to make sure that they don't exist twice, see http://stackoverflow.com/questions/20938891
40
44
  system 'rake assets:precompile HEADHUNTER=false &> /dev/null'
45
+ log.puts " done!\n".yellow
41
46
  end
42
47
 
43
48
  def remove_assets!
44
- system 'rake assets:clobber HEADHUNTER=false &> /dev/null'
49
+ FileUtils.rm_r ASSETS_PATH if File.exist?(ASSETS_PATH)
45
50
  end
46
51
 
47
52
  def stylesheets
48
- Dir.chdir(@root) { Dir.glob('public/assets/*.css') }
53
+ Dir["#{ASSETS_PATH}/*.css"]
49
54
  end
50
55
  end
51
56
  end
@@ -1,3 +1,3 @@
1
1
  module Headhunter
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: headhunter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Muheim