Delete the zipfile before building it.

If we don't' do this, Zip::File.new and despite the Zip::File::CREATE
flag, will reopen an existing zip file instead of writing a new one.

The error you get without this patch is

    rake aborted!
    add failed. Entry logstash-2.0.0.dev/LICENSE already exists
    /Users/jls/projects/logstash/vendor/bundle/jruby/1.9/gems/rubyzip-1.1.6/lib/zip/file.rb:392:in
    `check_entry_exists'

Fixes #2456
This commit is contained in:
Jordan Sissel 2015-01-27 16:16:18 -08:00
parent f0da80f090
commit b7455cbb2b

View file

@ -85,6 +85,7 @@ namespace "artifact" do
Rake::Task["dependency:rubyzip"].invoke
require 'zip'
zippath = "build/logstash-#{LOGSTASH_VERSION}.zip"
File.unlink(zippath) if File.exists?(zippath)
Zip::File.open(zippath, Zip::File::CREATE) do |zipfile|
files.each do |path|
path_in_zip = "logstash-#{LOGSTASH_VERSION}/#{path}"