closure-compiler 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -1
- data/closure-compiler.gemspec +2 -2
- data/lib/closure-compiler.rb +1 -1
- data/lib/closure/compiler.rb +2 -2
- data/lib/closure/popen.rb +12 -8
- metadata +3 -3
data/README.textile
CHANGED
@@ -2,7 +2,7 @@ h1. The Closure Compiler (as a Ruby Gem)
|
|
2
2
|
|
3
3
|
The *closure-compiler* gem is a svelte wrapper around the "Google Closure Compiler":http://code.google.com/closure/compiler/ for JavaScript compression.
|
4
4
|
|
5
|
-
Latest Version: *"0.3.
|
5
|
+
Latest Version: *"0.3.2":http://gemcutter.org/gems/closure-compiler*
|
6
6
|
|
7
7
|
The Closure Compiler's *2010-05-15* JAR-file is included with the gem, so you'll need *Java 6* installed in order to run the compiler.
|
8
8
|
|
data/closure-compiler.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'closure-compiler'
|
3
|
-
s.version = '0.3.
|
4
|
-
s.date = '2010-6-
|
3
|
+
s.version = '0.3.2' # Keep version in sync with closure-compiler.rb
|
4
|
+
s.date = '2010-6-14'
|
5
5
|
|
6
6
|
s.homepage = "http://github.com/documentcloud/closure-compiler/"
|
7
7
|
s.summary = "Ruby Wrapper for the Google Closure Compiler"
|
data/lib/closure-compiler.rb
CHANGED
data/lib/closure/compiler.rb
CHANGED
@@ -19,7 +19,7 @@ module Closure
|
|
19
19
|
# block, for streaming.
|
20
20
|
def compile(io)
|
21
21
|
result, error = nil, nil
|
22
|
-
Closure::Popen.popen(command) do |stdin, stdout, stderr|
|
22
|
+
status = Closure::Popen.popen(command) do |stdin, stdout, stderr|
|
23
23
|
if io.respond_to? :read
|
24
24
|
while buffer = io.read(4096) do
|
25
25
|
stdin.write(buffer)
|
@@ -39,7 +39,7 @@ module Closure
|
|
39
39
|
end
|
40
40
|
yield(StringIO.new(result)) if block_given?
|
41
41
|
end
|
42
|
-
raise Error, error unless
|
42
|
+
raise Error, error unless status.success?
|
43
43
|
result
|
44
44
|
end
|
45
45
|
alias_method :compress, :compile
|
data/lib/closure/popen.rb
CHANGED
@@ -4,24 +4,28 @@ module Closure
|
|
4
4
|
# grandchild process, and returns the pid of the external process.
|
5
5
|
module Popen
|
6
6
|
|
7
|
-
WINDOWS
|
7
|
+
WINDOWS = RUBY_PLATFORM.match(/(win|w)32$/)
|
8
|
+
ONE_NINE = RUBY_VERSION >= "1.9"
|
8
9
|
if WINDOWS
|
9
|
-
|
10
|
-
|
10
|
+
if ONE_NINE
|
11
|
+
require 'open3'
|
12
|
+
else
|
13
|
+
require 'rubygems'
|
14
|
+
require 'win32/open3'
|
15
|
+
end
|
11
16
|
end
|
12
17
|
|
13
18
|
def self.popen(cmd)
|
14
|
-
pid = nil
|
15
19
|
if WINDOWS
|
16
|
-
error
|
17
|
-
|
20
|
+
error = nil
|
21
|
+
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thread|
|
18
22
|
yield(stdin, stdout, stderr) if block_given?
|
19
23
|
stdout.read unless stdout.closed? or stdout.eof?
|
20
24
|
unless stderr.closed?
|
21
25
|
stderr.rewind
|
22
26
|
error = stderr.read
|
23
27
|
end
|
24
|
-
|
28
|
+
return wait_thread.value if wait_thread.is_a? Thread
|
25
29
|
end
|
26
30
|
else
|
27
31
|
# pipe[0] for read, pipe[1] for write
|
@@ -55,7 +59,7 @@ module Closure
|
|
55
59
|
end
|
56
60
|
Process.waitpid pid
|
57
61
|
end
|
58
|
-
|
62
|
+
$?
|
59
63
|
end
|
60
64
|
|
61
65
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeremy Ashkenas
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-14 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|