juicer 1.1.2 → 1.2.0
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/juicer.rb +1 -1
- data/lib/juicer/binary.rb +3 -3
- data/lib/juicer/jslint.rb +13 -1
- data/lib/juicer/minifyer/closure_compiler.rb +1 -1
- data/lib/juicer/minifyer/java_base.rb +12 -0
- data/lib/juicer/minifyer/yui_compressor.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f06b71c8fce4347fff482b82fa6ac3179263d764
|
4
|
+
data.tar.gz: 43301ee9d2637b94385ece374e2f99747222d156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1117c46084397beda8ee1f0922958fdbf008ceb6a55b7e44d9cc51c56d5d4b5ccd880b9beec9b2a65a0bfc1d5857624b5661ef89f7c1733bae0e6f11283d022
|
7
|
+
data.tar.gz: 56a67e2a3c05d82bac219b19862c46353c611f5821f161da1ef139178ac11ef3f6170cf0ae736345c78427450dff05974944da449d94d42e0ffecfed4a8e8ece
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/lib/juicer.rb
CHANGED
data/lib/juicer/binary.rb
CHANGED
@@ -29,8 +29,8 @@ module Juicer
|
|
29
29
|
|
30
30
|
# Run command
|
31
31
|
#
|
32
|
-
def execute(params
|
33
|
-
cmd = IO.popen(
|
32
|
+
def execute(*params)
|
33
|
+
cmd = IO.popen(([self.command] + params).flatten, "r")
|
34
34
|
results = cmd.gets(nil)
|
35
35
|
cmd.close
|
36
36
|
results
|
@@ -107,7 +107,7 @@ module Juicer
|
|
107
107
|
def command
|
108
108
|
return @command if !@opt_set && @command
|
109
109
|
@opt_set = false
|
110
|
-
@command =
|
110
|
+
@command = [@binary, options]
|
111
111
|
end
|
112
112
|
|
113
113
|
# Locate the binary to execute. The binary is searched for in the
|
data/lib/juicer/jslint.rb
CHANGED
@@ -18,6 +18,18 @@ module Juicer
|
|
18
18
|
path << options[:bin_path] if options[:bin_path]
|
19
19
|
end
|
20
20
|
|
21
|
+
# Constructs the command to use
|
22
|
+
#
|
23
|
+
def command
|
24
|
+
java_opts = []
|
25
|
+
if ENV['JAVA_OPTS'].nil?
|
26
|
+
java_opts = []
|
27
|
+
else
|
28
|
+
java_opts = ENV['JAVA_OPTS'].split(" ")
|
29
|
+
end
|
30
|
+
@command = ([@binary] + java_opts).flatten
|
31
|
+
end
|
32
|
+
|
21
33
|
#
|
22
34
|
# Checks if a files has problems. Also includes experimental support for CSS
|
23
35
|
# files. CSS files should begin with the line @charset "UTF-8";
|
@@ -32,7 +44,7 @@ module Juicer
|
|
32
44
|
raise FileNotFoundError.new("Unable to locate JsLint '#{js_file}'") if !js_file || !File.exists?(js_file)
|
33
45
|
raise FileNotFoundError.new("Unable to locate input file '#{file}'") unless File.exists?(file)
|
34
46
|
|
35
|
-
lines = execute(
|
47
|
+
lines = execute("-jar", rhino, locate_lib, file).split("\n")
|
36
48
|
return Report.new if lines.length == 1 && lines[0] =~ /jslint: No problems/
|
37
49
|
|
38
50
|
report = Report.new
|
@@ -62,7 +62,7 @@ module Juicer
|
|
62
62
|
|
63
63
|
out_dir = File.dirname(output)
|
64
64
|
FileUtils.mkdir_p(out_dir) unless File.exists?(out_dir)
|
65
|
-
execute(
|
65
|
+
execute("-jar", "#{locate_jar}#{jar_args}", "--js_output_file", output, "--js", file)
|
66
66
|
|
67
67
|
File.delete(file) if use_tmp
|
68
68
|
end
|
@@ -55,6 +55,18 @@ module Juicer
|
|
55
55
|
@jar_args = " #{args}"
|
56
56
|
end
|
57
57
|
|
58
|
+
# Constructs the command to use
|
59
|
+
#
|
60
|
+
def command
|
61
|
+
java_opts = []
|
62
|
+
if ENV['JAVA_OPTS'].nil?
|
63
|
+
java_opts = []
|
64
|
+
else
|
65
|
+
java_opts = ENV['JAVA_OPTS'].split(" ")
|
66
|
+
end
|
67
|
+
@command = ([@binary] + java_opts).flatten
|
68
|
+
end
|
69
|
+
|
58
70
|
def jar_args
|
59
71
|
@jar_args
|
60
72
|
end
|
@@ -57,7 +57,7 @@ module Juicer
|
|
57
57
|
output = File.join(Dir::tmpdir, File.basename(file) + '.min.tmp.' + type.to_s) if use_tmp
|
58
58
|
FileUtils.mkdir_p(File.dirname(output))
|
59
59
|
|
60
|
-
result = execute(
|
60
|
+
result = execute("-jar", "#{locate_jar}#{jar_args}", "-o", output, file)
|
61
61
|
|
62
62
|
if use_tmp # If no output file is provided, YUI compressor will
|
63
63
|
output.puts IO.read(output) # compress to a temp file. This file should be cleared
|