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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec232a058df24e0e2cc70e10ef41e4b392152480
4
- data.tar.gz: 319cbc42c5f1c831c351089fc2a8ccd9fd01f3d9
3
+ metadata.gz: f06b71c8fce4347fff482b82fa6ac3179263d764
4
+ data.tar.gz: 43301ee9d2637b94385ece374e2f99747222d156
5
5
  SHA512:
6
- metadata.gz: 3e6a9dd9ada260b9e2ccc309558e6c96a319b72354eeb5afd25315bf230cfce861a4f36768bd6d27ebfaf26d2cf1c4705693ed8b75d17ad6123747a5f56d088c
7
- data.tar.gz: 5af2f7f41c187a84461fd7f9ef7aed731134136652385fefd23d61834e7e1ac267aa5ca8cd748f82edc43336a8147ac678c83f4ce74a79c9a538864c54d991d2
6
+ metadata.gz: e1117c46084397beda8ee1f0922958fdbf008ceb6a55b7e44d9cc51c56d5d4b5ccd880b9beec9b2a65a0bfc1d5857624b5661ef89f7c1733bae0e6f11283d022
7
+ data.tar.gz: 56a67e2a3c05d82bac219b19862c46353c611f5821f161da1ef139178ac11ef3f6170cf0ae736345c78427450dff05974944da449d94d42e0ffecfed4a8e8ece
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.2.0
@@ -3,7 +3,7 @@ require "logger"
3
3
  module Juicer
4
4
 
5
5
  # :stopdoc:
6
- VERSION = "1.1.2"
6
+ VERSION = "1.2.0"
7
7
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
8
8
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
9
9
  LOGGER = Logger.new(STDOUT)
@@ -29,8 +29,8 @@ module Juicer
29
29
 
30
30
  # Run command
31
31
  #
32
- def execute(params = nil)
33
- cmd = IO.popen("#{self.command} #{params}", "r")
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 = "#{@binary} #{options}"
110
+ @command = [@binary, options]
111
111
  end
112
112
 
113
113
  # Locate the binary to execute. The binary is searched for in the
@@ -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(%Q{-jar "#{rhino}" "#{locate_lib}" "#{file}"}).split("\n")
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(%Q{-jar "#{locate_jar}"#{jar_args} --js_output_file "#{output}" --js "#{file}"})
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(%Q{-jar "#{locate_jar}"#{jar_args} -o "#{output}" "#{file}"})
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: juicer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Johansen