我正在尝试在长鳍金枪鱼中压缩zip
任务,但是出现错误。这是IronRuby的问题吗?
task :publish => :build do
Rake::Task[:service].invoke
Rake::Task[:site].invoke
Rake::Task[:zip_svc].invoke
end
zip :zip_svc do |zip|
zip.directories_to_zip 'publish'
zip.output_file = 'Svc.zip'
zip.output_path = File.dirname(__FILE__)
end
错误>
** Invoke zip_svc (first_time)
** Execute zip_svc
rake aborted!
wrong number of arguments (1 for 2)
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1113:in `<<'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1062:in `<<'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/ioextras.rb:125:in `write'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/ioextras.rb:9:in `copy_stream'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:832:in `write_to_zip_output_stream'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:772:in `get_input_stream'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:832:in `write_to_zip_output_stream'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1515:in `commit'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1153:in `each'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1153:in `each'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1515:in `commit'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:963:in `open'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1512:in `commit'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1601:in `on_success_replace'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1510:in `commit'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1525:in `close'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib/zip/zip.rb:1415:in `open'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/albacore-0.2.5/lib/albacore/zipdirectory.rb:28:in `execute'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/albacore-0.2.5/lib/albacore/support/createtask.rb:24:in `zip'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
c:/IronRuby/Lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/Users/Thiago/projetos/Cosan/mapaestrutura/rakefile.rb:8
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
c:/IronRuby/Lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
c:/IronRuby/Lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31
C:/IronRuby/bin/rake:19:in `load'
C:/IronRuby/bin/rake:19
不幸的是,zip
任务是少数几个在 IronRuby 中无法正常工作的项目之一。我已经看了好几次,但也没有找到合适的rubyzip
库替代品。我建议使用外部工具,如 7-zip(免费/非常好的工具),并从exec
任务调用它。