Class: Manifest

Inherits:
JavaTask show all
Defined in:
lib/jake/manifest.rb

Instance Attribute Summary collapse

Attributes inherited from JavaTask

#base_dir

Instance Method Summary collapse

Methods inherited from JavaTask

in

Instance Attribute Details

#cpObject

Returns the value of attribute cp.



2
3
4
# File 'lib/jake/manifest.rb', line 2

def cp
  @cp
end

#main_classObject

Returns the value of attribute main_class.



2
3
4
# File 'lib/jake/manifest.rb', line 2

def main_class
  @main_class
end

Instance Method Details

#execute {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Manifest)

    the object that the method was called on



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/jake/manifest.rb', line 4

def execute &block
  yield self

  in_path @base_dir do
    FileUtils.mkdir 'META-INF' unless File.exists? 'META-INF'
    @cp = Dir.glob(@cp)

    File.open(File.join('META-INF', 'MANIFEST.MF'), 'w') do |f|
      f.puts 'Manifest-Version: 1.0'
      f.puts 'Class-Path: ' + @cp.join(" \n ").to_s
      f.puts 'Main-Class: ' + @main_class
    end

    nil
  end
end