From 761de7bbbf7e3db249163a6fea49745f22cde0fe Mon Sep 17 00:00:00 2001 From: Tommy McGuire Date: Thu, 23 Oct 2008 17:33:24 -0500 Subject: [PATCH] Add configuration option to set MANIFEST.MF. Add manifest_file configuration option in warble.rb that specifies a path to a file containing entries that will be added to the MANIFEST.MF. [Also, use config.manifest_file in the warble.rb template.] Signed-off-by: Nick Sieger --- generators/warble/templates/warble.rb | 6 +++++- lib/warbler/config.rb | 4 ++++ lib/warbler/task.rb | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/generators/warble/templates/warble.rb b/generators/warble/templates/warble.rb index 8fcfe996..8702fbe2 100644 --- a/generators/warble/templates/warble.rb +++ b/generators/warble/templates/warble.rb @@ -59,6 +59,10 @@ # of RAILS_ROOT # config.war_name = "mywar" + # Name of the MANIFEST.MF template for the war file. Defaults to the + # MANIFEST.MF normally generated by `jar cf`. + # config.manifest_file = "config/MANIFEST.MF" + # Value of RAILS_ENV for the webapp -- default as shown below # config.webxml.rails.env = ENV['RAILS_ENV'] || 'production' @@ -79,4 +83,4 @@ # JNDI data source name # config.webxml.jndi = 'jdbc/rails' -end \ No newline at end of file +end diff --git a/lib/warbler/config.rb b/lib/warbler/config.rb index 409b7b74..235ffe21 100644 --- a/lib/warbler/config.rb +++ b/lib/warbler/config.rb @@ -59,6 +59,10 @@ class Config # the Rails application attr_accessor :war_name + # Name of the MANIFEST.MF template. Defaults to the MANIFEST.MF normally generated + # by jar -cf.... + attr_accessor :manifest_file + # Extra configuration for web.xml. Controls how the dynamically-generated web.xml # file is generated. # diff --git a/lib/warbler/task.rb b/lib/warbler/task.rb index 250cdbee..24f5806b 100644 --- a/lib/warbler/task.rb +++ b/lib/warbler/task.rb @@ -172,7 +172,8 @@ def define_jar_task task "jar" do war_path = "#{config.war_name}.war" war_path = File.join(config.autodeploy_dir, war_path) if config.autodeploy_dir - sh "jar cf #{war_path} -C #{config.staging_dir} ." + flags, manifest = config.manifest_file ? ["cfm", config.manifest_file] : ["cf", ""] + sh "jar #{flags} #{war_path} #{manifest} -C #{config.staging_dir} ." end end end @@ -331,4 +332,4 @@ def apply_pathmaps(file, pathmaps) file end end -end \ No newline at end of file +end