Module: Buildr::Packaging::Java::WithManifest
- Defined in:
- lib/buildr/java/packaging.rb
Overview
Adds support for MANIFEST.MF and other META-INF files.
Instance Attribute Summary collapse
-
#manifest ⇒ Object
Specifies how to create the manifest file.
-
#meta_inf ⇒ Object
Specifies files to include in the META-INF directory.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#manifest ⇒ Object
Specifies how to create the manifest file.
159 160 161 |
# File 'lib/buildr/java/packaging.rb', line 159 def manifest @manifest end |
#meta_inf ⇒ Object
Specifies files to include in the META-INF directory.
162 163 164 |
# File 'lib/buildr/java/packaging.rb', line 162 def @meta_inf end |
Class Method Details
.included(base) ⇒ Object
149 150 151 152 153 154 |
# File 'lib/buildr/java/packaging.rb', line 149 def included(base) base.class_eval do alias :initialize_without_manifest :initialize alias :initialize :initialize_with_manifest end end |
Instance Method Details
#initialize_with_manifest(*args) ⇒ Object
:nodoc:
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/buildr/java/packaging.rb', line 164 def initialize_with_manifest(*args) #:nodoc: initialize_without_manifest *args @manifest = false @meta_inf = [] @dependencies = FileList[] prepare do @prerequisites << manifest if String === manifest || Rake::Task === manifest [].flatten.map { |file| file.to_s }.uniq.each { |file| path('META-INF').include file } end enhance do if manifest # Tempfiles gets deleted on garbage collection, so we're going to hold on to it # through instance variable not closure variable. @manifest_tmp = Tempfile.new('MANIFEST.MF') File.chmod 0644, @manifest_tmp.path self.manifest = File.read(manifest.to_s) if String === manifest || Rake::Task === manifest self.manifest = Manifest.new(manifest) unless Manifest === manifest #@manifest_tmp.write Manifest::STANDARD_HEADER @manifest_tmp.write manifest.to_s @manifest_tmp.write "\n" @manifest_tmp.close path('META-INF').include @manifest_tmp.path, :as=>'MANIFEST.MF' end end end |