js-preflight 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/preflight +22 -12
- data/lib/js-preflight/lint.rb +1 -1
- data/lib/js-preflight/version.rb +1 -1
- metadata +5 -8
data/bin/preflight
CHANGED
@@ -3,7 +3,7 @@ require 'pathname'
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'stringio'
|
5
5
|
require 'fileutils'
|
6
|
-
require '
|
6
|
+
require 'js-preflight'
|
7
7
|
|
8
8
|
module Js
|
9
9
|
module Preflight
|
@@ -28,6 +28,17 @@ For help with options and usage:
|
|
28
28
|
|
29
29
|
USAGE
|
30
30
|
end
|
31
|
+
|
32
|
+
def file_banner(path, char = "=")
|
33
|
+
banner = ""
|
34
|
+
banner << "\n\n"
|
35
|
+
banner << (char * path.to_s.length + "#{char * 4}\n")
|
36
|
+
banner << "#{char} #{path} #{char}\n"
|
37
|
+
banner << (char * path.to_s.length + "#{char * 4}\n")
|
38
|
+
banner << "\n"
|
39
|
+
banner
|
40
|
+
end
|
41
|
+
|
31
42
|
end
|
32
43
|
end
|
33
44
|
end
|
@@ -95,7 +106,7 @@ optparse.parse!
|
|
95
106
|
|
96
107
|
|
97
108
|
if ARGV.length > 0
|
98
|
-
|
109
|
+
STDERR.puts("Operating on #{ARGV}")
|
99
110
|
ARGV.each do |filename|
|
100
111
|
|
101
112
|
js_files = []
|
@@ -108,21 +119,20 @@ if ARGV.length > 0
|
|
108
119
|
|
109
120
|
relative_js_files = js_files.map{|js_file| File.join(path.dirname, js_file)}
|
110
121
|
|
111
|
-
|
122
|
+
lints = []
|
112
123
|
if options[:lint]
|
113
|
-
::Js::Preflight::Lint.build(relative_js_files) do |
|
114
|
-
|
124
|
+
::Js::Preflight::Lint.build(relative_js_files) do |lint|
|
125
|
+
lints << lint
|
115
126
|
end
|
116
127
|
end
|
117
128
|
|
118
|
-
|
119
|
-
unless options[:quiet]
|
120
|
-
STDERR.puts("#{path}:")
|
121
|
-
STDERR.puts("=" * path.to_s.length)
|
122
|
-
lint_errors.each {|error| STDERR.puts(error)}
|
123
|
-
end
|
129
|
+
STDERR.puts ::Js::Preflight::Instructions.file_banner(path)
|
124
130
|
|
131
|
+
if lints.any?
|
132
|
+
lints.each {|lint| STDERR.puts ::Js::Preflight::Instructions.file_banner(lint.filename, '-'); STDERR.puts(lint.errors)} unless options[:quiet]
|
125
133
|
next if options[:strict]
|
134
|
+
else
|
135
|
+
STDERR.puts("Jslint: No problems found") unless options[:quiet]
|
126
136
|
end
|
127
137
|
|
128
138
|
if options[:pack]
|
@@ -155,4 +165,4 @@ if ARGV.length > 0
|
|
155
165
|
else
|
156
166
|
Js::Preflight::Instructions.print_usage
|
157
167
|
exit
|
158
|
-
end
|
168
|
+
end
|
data/lib/js-preflight/lint.rb
CHANGED
data/lib/js-preflight/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js-preflight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Scott Burton
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-27 00:00:00 -07:00
|
21
20
|
default_executable:
|
22
21
|
dependencies: []
|
23
22
|
|
@@ -60,7 +59,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
59
|
requirements:
|
61
60
|
- - ">="
|
62
61
|
- !ruby/object:Gem::Version
|
63
|
-
hash: 3
|
64
62
|
segments:
|
65
63
|
- 0
|
66
64
|
version: "0"
|
@@ -69,14 +67,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
67
|
requirements:
|
70
68
|
- - ">="
|
71
69
|
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
70
|
segments:
|
74
71
|
- 0
|
75
72
|
version: "0"
|
76
73
|
requirements: []
|
77
74
|
|
78
75
|
rubyforge_project: js-preflight
|
79
|
-
rubygems_version: 1.
|
76
|
+
rubygems_version: 1.3.7
|
80
77
|
signing_key:
|
81
78
|
specification_version: 3
|
82
79
|
summary: Easy preflight command-line script for jslint and jsmin
|