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 CHANGED
@@ -3,7 +3,7 @@ require 'pathname'
3
3
  require 'optparse'
4
4
  require 'stringio'
5
5
  require 'fileutils'
6
- require 'lib/js-preflight'
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
- lint_errors = []
122
+ lints = []
112
123
  if options[:lint]
113
- ::Js::Preflight::Lint.build(relative_js_files) do |errors|
114
- lint_errors << errors
124
+ ::Js::Preflight::Lint.build(relative_js_files) do |lint|
125
+ lints << lint
115
126
  end
116
127
  end
117
128
 
118
- if lint_errors.any?
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
@@ -18,7 +18,7 @@ module Js
18
18
  def self.build(files)
19
19
  files.each do |file|
20
20
  lint = Lint.new(file)
21
- yield lint.errors unless lint.clean?
21
+ yield lint unless lint.clean?
22
22
  end
23
23
  end
24
24
 
@@ -1,5 +1,5 @@
1
1
  module Js
2
2
  module Preflight
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
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
- hash: 29
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 1
10
- version: 0.0.1
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-26 00:00:00 -07:00
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.4.2
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