sstephenson / ruby-yui-compressor

A Ruby interface to YUI Compressor for minifying JavaScript and CSS assets.
217 stars 57 forks source link

incorrect use of popen3 on Windows #3

Closed ghazel closed 13 years ago

ghazel commented 14 years ago
ArgumentError (wrong number of arguments (7 for 3)):
  yui-compressor (0.9.1) lib/yui/compressor.rb:60:in `popen3'
  yui-compressor (0.9.1) lib/yui/compressor.rb:60:in `compress'
  yui-compressor (0.9.1) lib/yui/compressor.rb:102:in `streamify'
  yui-compressor (0.9.1) lib/yui/compressor.rb:59:in `compress'

I know exec() takes either a string or an array of args, but popen3() on Windows does not seem to. This is easily fixed by calling .join(' ') on the array.

triemstr commented 14 years ago

I also get this error on windows under 1.8.7 (1.9 doesn't seem to have this problem). Also figured out the fix just like ghazel though it took me awhile. I changed the initialize block, adding flatten.join(' ') similar to ghazel. Full method:

def initialize(options = {}) #:nodoc:
  @options = self.class.default_options.merge(options)
  @command = [path_to_java, "-jar", path_to_jar_file, *(command_option_for_type + command_options)].flatten.join(' ') 
end
sstephenson commented 13 years ago

We're using POpen4 as of version 0.9.6. Please reopen if this is still an issue.

triemstr commented 13 years ago

Thanks for revisiting this issue. I'm way beyond ruby 1.8.7 now but perhaps ghazel or others can test 1.8.7 and POpen4. I've had no problems with ruby 1.9.1 or 1.9.2 and ruby-yui.

ghazel commented 13 years ago

yui-compressr 0.9.6 works great on ruby 1.8.7 on Windows! Thanks!