Skip to content

Commit

Permalink
Ensure all directory entries before creating archive
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Mar 31, 2010
1 parent 3e9844a commit 43d3c64
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/warbler/war.rb
Expand Up @@ -25,6 +25,7 @@ def create(config_or_path)
war_path = File.join(config_or_path.autodeploy_dir, war_path) if config_or_path.autodeploy_dir
end
rm_f war_path
ensure_directory_entries
puts "Creating #{war_path}"
create_war war_path, @files
end
Expand Down Expand Up @@ -145,6 +146,16 @@ def apply_pathmaps(config, file, pathmaps)
file
end

def ensure_directory_entries
files.select {|k,v| !v.nil? }.each do |k,v|
dir = File.dirname(k)
while dir != "." && !files.has_key?(dir)
files[dir] = nil
dir = File.dirname(dir)
end
end
end

def create_war(war_file, entries)
Zip::ZipFile.open(war_file, Zip::ZipFile::CREATE) do |zipfile|
entries.keys.sort.each do |entry|
Expand Down

0 comments on commit 43d3c64

Please sign in to comment.