Class: BuildMaster::PackageAnt

Inherits:
Object
  • Object
show all
Defined in:
lib/buildmaster/auto/package_ant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir, name) ⇒ PackageAnt

Returns a new instance of PackageAnt.



5
6
7
8
9
10
# File 'lib/buildmaster/auto/package_ant.rb', line 5

def initialize(dir, name)
  @jar = dir.file("#{name}.jar")
  @zip = dir.file("#{name}-src.zip")
  @classes = []
  @sources = []
end

Instance Attribute Details

#manifestObject

Returns the value of attribute manifest.



3
4
5
# File 'lib/buildmaster/auto/package_ant.rb', line 3

def manifest
  @manifest
end

Instance Method Details

#add(class_root, source_root = nil) ⇒ Object



16
17
18
19
# File 'lib/buildmaster/auto/package_ant.rb', line 16

def add(class_root, source_root = nil)
  @classes.push class_root
  @sources.push source_root unless source_root.nil?
end

#build_fileObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/buildmaster/auto/package_ant.rb', line 21

def build_file
  file = @jar.parent.file('package-ant.xml')
  file.write do |f|
    f.puts <<CONTENT
<!-- ANT file generated by buildmaste PackageAnt -->
<project name="#{target}" default="#{target}">
  <target name="#{target}">
<jar destfile="#{@jar}"#{manifest_attribute}>
#{fileset_elements(@classes)}    </jar>
<zip destfile="#{@zip}">
#{fileset_elements(@sources)}    </zip>
  </target>
</project>
CONTENT
  end
  file
end

#runObject



39
40
41
42
# File 'lib/buildmaster/auto/package_ant.rb', line 39

def run
  @jar.parent.mkdirs
  AntDriver.from_file(build_file).target(target)
end

#targetObject



12
13
14
# File 'lib/buildmaster/auto/package_ant.rb', line 12

def target
  'package-ant'
end