Skip to content

Commit

Permalink
Don't overwrite existing manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed May 6, 2010
1 parent 79ee189 commit a607a6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/warbler/war.rb
Expand Up @@ -57,10 +57,12 @@ def add_webxml(config)

# Add a manifest file either from config or by making a default manifest.
def add_manifest(config)
if config.manifest_file
@files['META-INF/MANIFEST.MF'] = config.manifest_file
else
@files['META-INF/MANIFEST.MF'] = StringIO.new(%{Manifest-Version: 1.0\nCreated-By: Warbler #{VERSION}\n\n})
unless @files.keys.detect{|k| k =~ /^META-INF\/MANIFEST\.MF$/i}
if config.manifest_file
@files['META-INF/MANIFEST.MF'] = config.manifest_file
else
@files['META-INF/MANIFEST.MF'] = StringIO.new(%{Manifest-Version: 1.0\nCreated-By: Warbler #{VERSION}\n\n})
end
end
end

Expand Down
6 changes: 6 additions & 0 deletions spec/warbler/war_spec.rb
Expand Up @@ -158,6 +158,12 @@ def expand_webxml
@war.files['META-INF/MANIFEST.MF'].should == "manifest"
end

it "should not add a manifest if one already exists" do
@war.files['META-INF/MANIFEST.MF'] = 'manifest'
@war.add_manifest(@config)
@war.files['META-INF/MANIFEST.MF'].should == "manifest"
end

it "should be able to exclude files from the .war" do
@config.excludes += FileList['lib/tasks/utils.rake']
@war.apply(@config)
Expand Down

0 comments on commit a607a6e

Please sign in to comment.