ruby_css_lint 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,19 +1,44 @@
1
1
  = ruby_css_lint
2
2
 
3
- Description goes here.
4
-
5
- == Contributing to ruby_css_lint
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
3
+ A repackaging of [CSS Lint](https://github.com/stubbornella/csslint) for use with Rails.
4
+
5
+ If you're using Rails 3.1, you probably want to run css lint on your precompiled assets. Compile them:
6
+ rake assets:precompile
7
+
8
+
9
+ To install Ruby CSS Lint, Add it to your gemfile
10
+ gem 'ruby_css_lint'
11
+
12
+ And after a bundle install, run it:
13
+ rake css_lint:run
14
+
15
+
16
+ You probably want more control over things, so generate a config file:
17
+ rake css_lint:generate_config
18
+
19
+ You will find the config file at config/initializers/css_lint.rb.
20
+
21
+ You can control the behavior of Ruby CSS Lint by modifying the implementation of the methods RubyCssLint::location_of_css_files, RubyCssLint::location_of_custom_rules and RubyCssLint::ruleset_classifications.
22
+
23
+ module RubyCssLint
24
+ def self.ruleset_classifications
25
+ {
26
+ "floats" => RubyCssLint::WARNING,
27
+ }
28
+ end
29
+
30
+ def self.location_of_custom_rules(rails_root)
31
+ ["#{rails_root.to_s}/test/css_lint/*.js"]
32
+ end
33
+
34
+ def self.location_of_css_files(rails_root)
35
+ [rails_root.to_s+"/public/assets/application.css"]
36
+ end
37
+ end
38
+
14
39
 
15
40
  == Copyright
16
41
 
17
- Copyright (c) 2012 Andrew Mutz. See LICENSE.txt for
42
+ Copyright (c) 2012 AppFolio, inc. See LICENSE.txt for
18
43
  further details.
19
44
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
data/lib/ruby_css_lint.rb CHANGED
@@ -12,6 +12,10 @@ if defined?(Rails)
12
12
  RubyCssLint::construct_js_and_run_rhino(RubyCssLint::location_of_css_files(Rails.root))
13
13
  end
14
14
 
15
+ task :dump_to_file => :environment do |t|
16
+ RubyCssLint::construct_js_and_run_rhino(RubyCssLint::location_of_css_files(Rails.root), 'css_lint_output.txt')
17
+ end
18
+
15
19
  task :generate_config => :environment do |t|
16
20
  File.open("#{Rails.root.to_s}/config/initializers/css_lint.rb", "w") do |filehandle|
17
21
  filehandle.puts <<-CSS_LINT_INIT
@@ -96,7 +100,7 @@ CSS_LINT_DEFAULT
96
100
  result
97
101
  end
98
102
 
99
- def self.construct_js_and_run_rhino(css_files)
103
+ def self.construct_js_and_run_rhino(css_files, output_location = nil)
100
104
  css_files = css_files.join(" ") if css_files.is_a?(Array)
101
105
 
102
106
  Tempfile.open("csslint_temp_js") do |tempfile|
@@ -110,15 +114,16 @@ HEADER
110
114
  FOOTER
111
115
  tempfile.puts`cat #{list_of_js_files_to_compile_step_2}`
112
116
  tempfile.flush
113
- run_rhino_with_js_file(tempfile.path, css_files)
117
+ run_rhino_with_js_file(tempfile.path, css_files, output_location)
114
118
  end
115
119
 
116
120
 
117
121
  end
118
122
 
119
- def self.run_rhino_with_js_file(file, css_files)
123
+ def self.run_rhino_with_js_file(file, css_files, output_location = nil)
120
124
  rhino_jarfile = File.dirname(__FILE__) + "/../js.jar"
121
125
  command = "java -jar #{rhino_jarfile} #{file} #{construct_error_and_warning_options} #{css_files}"
126
+ command += " > #{output_location}" if output_location
122
127
  result = `#{command}`
123
128
  puts result
124
129
  end
@@ -155,14 +160,6 @@ FOOTER
155
160
  cli_rhino
156
161
  ].join(" ")
157
162
  end
158
-
159
-
160
- def self.run
161
- rhino_jarfile = File.dirname(__FILE__) + "../js.jar"
162
- rhino_csslint_file = File.dirname(__FILE__) + "../csslint/"
163
- command = "java -jar js.jar "
164
- end
165
-
166
163
  end
167
164
 
168
165
 
@@ -0,0 +1,166 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "ruby_css_lint"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Andrew Mutz"]
12
+ s.date = "2012-06-21"
13
+ s.description = "Wraps up the CSS lint tool from https://github.com/stubbornella/csslint into a gem"
14
+ s.email = "andrew.mutz@appfolio.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "LICENSE.txt",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "csslint/CHANGELOG",
27
+ "csslint/LICENSE",
28
+ "csslint/README.md",
29
+ "csslint/build.xml",
30
+ "csslint/demos/CSSLintDemo.htm",
31
+ "csslint/demos/demo.css",
32
+ "csslint/lib/js.jar",
33
+ "csslint/lib/jshint.js",
34
+ "csslint/lib/parserlib.js",
35
+ "csslint/lib/yuitest-rhino-cli.js",
36
+ "csslint/lib/yuitest.js",
37
+ "csslint/npm/package.json",
38
+ "csslint/release/csslint-node.js",
39
+ "csslint/release/csslint-rhino.js",
40
+ "csslint/release/csslint-tests.js",
41
+ "csslint/release/csslint-worker.js",
42
+ "csslint/release/csslint-wsh.js",
43
+ "csslint/release/csslint.js",
44
+ "csslint/release/npm/cli.js",
45
+ "csslint/release/npm/lib/csslint-node.js",
46
+ "csslint/release/npm/package.json",
47
+ "csslint/src/cli/common.js",
48
+ "csslint/src/cli/node.js",
49
+ "csslint/src/cli/rhino.js",
50
+ "csslint/src/cli/wsh.js",
51
+ "csslint/src/core/CSSLint.js",
52
+ "csslint/src/core/Reporter.js",
53
+ "csslint/src/core/Util.js",
54
+ "csslint/src/formatters/checkstyle-xml.js",
55
+ "csslint/src/formatters/compact.js",
56
+ "csslint/src/formatters/csslint-xml.js",
57
+ "csslint/src/formatters/lint-xml.js",
58
+ "csslint/src/formatters/text.js",
59
+ "csslint/src/rules/adjoining-classes.js",
60
+ "csslint/src/rules/box-model.js",
61
+ "csslint/src/rules/box-sizing.js",
62
+ "csslint/src/rules/compatible-vendor-prefixes.js",
63
+ "csslint/src/rules/display-property-grouping.js",
64
+ "csslint/src/rules/duplicate-background-images.js",
65
+ "csslint/src/rules/duplicate-properties.js",
66
+ "csslint/src/rules/empty-rules.js",
67
+ "csslint/src/rules/errors.js",
68
+ "csslint/src/rules/fallback-colors.js",
69
+ "csslint/src/rules/floats.js",
70
+ "csslint/src/rules/font-faces.js",
71
+ "csslint/src/rules/font-sizes.js",
72
+ "csslint/src/rules/gradients.js",
73
+ "csslint/src/rules/ids.js",
74
+ "csslint/src/rules/import.js",
75
+ "csslint/src/rules/important.js",
76
+ "csslint/src/rules/known-properties.js",
77
+ "csslint/src/rules/outline-none.js",
78
+ "csslint/src/rules/overqualified-elements.js",
79
+ "csslint/src/rules/qualified-headings.js",
80
+ "csslint/src/rules/regex-selectors.js",
81
+ "csslint/src/rules/rules-count.js",
82
+ "csslint/src/rules/shorthand.js",
83
+ "csslint/src/rules/star-property-hack.js",
84
+ "csslint/src/rules/text-indent.js",
85
+ "csslint/src/rules/underscore-property-hack.js",
86
+ "csslint/src/rules/unique-headings.js",
87
+ "csslint/src/rules/universal-selector.js",
88
+ "csslint/src/rules/unqualified-attributes.js",
89
+ "csslint/src/rules/vendor-prefix.js",
90
+ "csslint/src/rules/zero-units.js",
91
+ "csslint/src/worker/Worker.js",
92
+ "csslint/tests/all-rules.js",
93
+ "csslint/tests/core/CSSLint.js",
94
+ "csslint/tests/core/Reporter.js",
95
+ "csslint/tests/css/width-100.html",
96
+ "csslint/tests/formatters/checkstyle-xml.js",
97
+ "csslint/tests/formatters/compact.js",
98
+ "csslint/tests/formatters/csslint-xml.js",
99
+ "csslint/tests/formatters/lint-xml.js",
100
+ "csslint/tests/formatters/text.js",
101
+ "csslint/tests/rules/adjoining-classes.js",
102
+ "csslint/tests/rules/box-model.js",
103
+ "csslint/tests/rules/box-sizing.js",
104
+ "csslint/tests/rules/compatible-vendor-prefixes.js",
105
+ "csslint/tests/rules/display-property-grouping.js",
106
+ "csslint/tests/rules/duplicate-background-images.js",
107
+ "csslint/tests/rules/duplicate-properties.js",
108
+ "csslint/tests/rules/empty-rules.js",
109
+ "csslint/tests/rules/errors.js",
110
+ "csslint/tests/rules/fallback-colors.js",
111
+ "csslint/tests/rules/floats.js",
112
+ "csslint/tests/rules/font-faces.js",
113
+ "csslint/tests/rules/font-sizes.js",
114
+ "csslint/tests/rules/gradients.js",
115
+ "csslint/tests/rules/ids.js",
116
+ "csslint/tests/rules/import.js",
117
+ "csslint/tests/rules/important.js",
118
+ "csslint/tests/rules/known-properties.js",
119
+ "csslint/tests/rules/outline-none.js",
120
+ "csslint/tests/rules/overqualified-elements.js",
121
+ "csslint/tests/rules/qualified-headings.js",
122
+ "csslint/tests/rules/regex-selectors.js",
123
+ "csslint/tests/rules/shorthand.js",
124
+ "csslint/tests/rules/star-property-hack.js",
125
+ "csslint/tests/rules/text-indent.js",
126
+ "csslint/tests/rules/underscore-property-hack.js",
127
+ "csslint/tests/rules/unique-headings.js",
128
+ "csslint/tests/rules/universal-selector.js",
129
+ "csslint/tests/rules/unqualified-attributes.js",
130
+ "csslint/tests/rules/vendor-prefix.js",
131
+ "csslint/tests/rules/zero-units.js",
132
+ "csslint/tests/testrunner.htm",
133
+ "js.jar",
134
+ "lib/ruby_css_lint.rb",
135
+ "ruby_css_lint.gemspec",
136
+ "test/helper.rb",
137
+ "test/test_ruby_css_lint.rb"
138
+ ]
139
+ s.homepage = "http://github.com/amutz/ruby_css_lint"
140
+ s.licenses = ["MIT"]
141
+ s.require_paths = ["lib"]
142
+ s.rubygems_version = "1.8.21"
143
+ s.summary = "CSS Lint testing for Ruby"
144
+
145
+ if s.respond_to? :specification_version then
146
+ s.specification_version = 3
147
+
148
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
149
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
150
+ s.add_development_dependency(%q<bundler>, [">= 0"])
151
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
152
+ s.add_development_dependency(%q<rcov>, [">= 0"])
153
+ else
154
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
155
+ s.add_dependency(%q<bundler>, [">= 0"])
156
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
157
+ s.add_dependency(%q<rcov>, [">= 0"])
158
+ end
159
+ else
160
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
161
+ s.add_dependency(%q<bundler>, [">= 0"])
162
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
163
+ s.add_dependency(%q<rcov>, [">= 0"])
164
+ end
165
+ end
166
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_css_lint
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
9
+ - 0
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Mutz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-20 00:00:00 Z
18
+ date: 2012-06-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  type: :development
@@ -201,6 +201,7 @@ files:
201
201
  - csslint/tests/testrunner.htm
202
202
  - js.jar
203
203
  - lib/ruby_css_lint.rb
204
+ - ruby_css_lint.gemspec
204
205
  - test/helper.rb
205
206
  - test/test_ruby_css_lint.rb
206
207
  homepage: http://github.com/amutz/ruby_css_lint