pangolin 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/examples/errors/Rakefile +16 -0
- data/examples/errors/src/com/example/HelloWorld.java +12 -0
- data/lib/pangolin.rb +2 -0
- data/lib/pangolin/javac.rb +25 -5
- data/lib/pangolin/output/formatting.rb +4 -0
- data/pangolin.gemspec +4 -2
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../lib/pangolin')
|
2
|
+
|
3
|
+
require 'rake/clean'
|
4
|
+
|
5
|
+
|
6
|
+
CLOBBER.include('build')
|
7
|
+
|
8
|
+
|
9
|
+
task :default => :compile
|
10
|
+
|
11
|
+
desc "Compile all classes"
|
12
|
+
task :compile => 'build' do
|
13
|
+
javac FileList['src/**/*.java'], :destination => 'build', :verbose => true, :colorize => true
|
14
|
+
end
|
15
|
+
|
16
|
+
directory 'build'
|
data/lib/pangolin.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
raise "Pangolin requires JRuby" unless RUBY_PLATFORM =~ /\bjava\b/
|
2
2
|
|
3
|
+
$stderr.puts "Warning: JAVA_HOME not set, this may cause problems" unless ENV['JAVA_HOME']
|
4
|
+
|
3
5
|
|
4
6
|
require File.expand_path(File.dirname(__FILE__)) + '/pangolin/output/formatting'
|
5
7
|
require File.expand_path(File.dirname(__FILE__)) + '/pangolin/javac'
|
data/lib/pangolin/javac.rb
CHANGED
@@ -3,10 +3,9 @@ require 'java'
|
|
3
3
|
|
4
4
|
module Pangolin
|
5
5
|
|
6
|
-
TOOLS_PATHS = [
|
7
|
-
|
8
|
-
|
9
|
-
]
|
6
|
+
TOOLS_PATHS = [ ]
|
7
|
+
TOOLS_PATHS << File.join(ENV['JAVA_HOME'], '..', 'lib', 'tools.jar') if ENV['JAVA_HOME']
|
8
|
+
TOOLS_PATHS << File.join(ENV['JAVA_HOME'], 'lib', 'tools.jar') if ENV['JAVA_HOME']
|
10
9
|
|
11
10
|
# must use include_class instead of import because import interferes with Rake's import
|
12
11
|
include_class 'java.io.PrintWriter'
|
@@ -14,6 +13,9 @@ module Pangolin
|
|
14
13
|
|
15
14
|
|
16
15
|
class Javac
|
16
|
+
|
17
|
+
include Output::Formatting
|
18
|
+
|
17
19
|
|
18
20
|
# The files to compile.
|
19
21
|
attr_accessor :source_files
|
@@ -61,6 +63,8 @@ module Pangolin
|
|
61
63
|
|
62
64
|
# Determines the maximum number of warnings to print, default (nil) is to print all
|
63
65
|
attr_accessor :max_warnings
|
66
|
+
|
67
|
+
attr_accessor :colorize
|
64
68
|
|
65
69
|
|
66
70
|
def initialize( *source_files )
|
@@ -74,6 +78,7 @@ module Pangolin
|
|
74
78
|
@encoding = nil
|
75
79
|
@verbose = false
|
76
80
|
@lint = [ ]
|
81
|
+
@colorize = false
|
77
82
|
end
|
78
83
|
|
79
84
|
# Run javac. If #verbose is true the equivalent command string for
|
@@ -88,7 +93,7 @@ module Pangolin
|
|
88
93
|
|
89
94
|
output_str = output_writer.to_s
|
90
95
|
|
91
|
-
io.puts output_str if output_str !~ /^\s*$/
|
96
|
+
io.puts format_output(output_str) if output_str !~ /^\s*$/
|
92
97
|
|
93
98
|
if 0 == result
|
94
99
|
true
|
@@ -147,6 +152,21 @@ module Pangolin
|
|
147
152
|
items.to_s
|
148
153
|
end
|
149
154
|
end
|
155
|
+
|
156
|
+
def format_output(output)
|
157
|
+
output.split(/\n/).map do |line|
|
158
|
+
case line
|
159
|
+
when /^.+\.java:\d+: warning: .+$/
|
160
|
+
format_warning_header(line)
|
161
|
+
when /^.+\.java:\d+: .+$/
|
162
|
+
format_error_header(line)
|
163
|
+
when /^\d+ errors?$/
|
164
|
+
format_error(line)
|
165
|
+
else
|
166
|
+
line
|
167
|
+
end
|
168
|
+
end.join("\n")
|
169
|
+
end
|
150
170
|
|
151
171
|
end
|
152
172
|
|
data/pangolin.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pangolin}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Theo Hultberg"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-06}
|
13
13
|
s.description = %q{Ant is a nice tool for writing Java build scripts, but Rake is nicer. The only thing missing from Rake is a way to run javac and jar, and although it's easy to run these as shell scripts you have to wait for the JVM to start. In combination with JRuby this gem lets you run javac and jar in your Rake scripts without exec'ing.}
|
14
14
|
s.email = %q{theo@iconara.net}
|
15
15
|
s.extensions = ["Rakefile"]
|
@@ -24,6 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
"VERSION",
|
25
25
|
"examples/compile/Rakefile",
|
26
26
|
"examples/compile/src/com/example/HelloWorld.java",
|
27
|
+
"examples/errors/Rakefile",
|
28
|
+
"examples/errors/src/com/example/HelloWorld.java",
|
27
29
|
"examples/package/Rakefile",
|
28
30
|
"examples/package/src/com/example/HelloWorld.java",
|
29
31
|
"examples/test/Rakefile",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pangolin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Hultberg
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-06 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -29,6 +29,8 @@ files:
|
|
29
29
|
- VERSION
|
30
30
|
- examples/compile/Rakefile
|
31
31
|
- examples/compile/src/com/example/HelloWorld.java
|
32
|
+
- examples/errors/Rakefile
|
33
|
+
- examples/errors/src/com/example/HelloWorld.java
|
32
34
|
- examples/package/Rakefile
|
33
35
|
- examples/package/src/com/example/HelloWorld.java
|
34
36
|
- examples/test/Rakefile
|