NAME

XML::Ant::BuildFile::Project - consume Ant build files

VERSION

version 0.212

SYNOPSIS

    use XML::Ant::BuildFile::Project;

    my $project = XML::Ant::BuildFile::Project->new( file => 'build.xml' );
    print 'Project name: ', $project->name, "\n";
    print "File lists:\n";
    for my $list_ref (@{$project->file_lists}) {
        print 'id: ', $list_ref->id, "\n";
        print join "\n", @{$list_ref->files};
        print "\n\n";
    }

DESCRIPTION

This class uses XML::Rabbit to consume Ant build files using a Moose object-oriented interface. It is a work in progress and in no way a complete implementation of all Ant syntax.

ATTRIBUTES

file

On top of XML::Rabbit's normal behavior, this class will also coerce Path::Class::File objects to the strings expected by XML::Rabbit::Role::Document.

name

Name of the Ant project.

paths

Hash of XML::Ant::BuildFile::Resource::Paths from the build file. The keys are the path ids.

targets

Hash of XML::Ant::BuildFile::Targets from the build file. The keys are the target names.

METHODS

filelists

Returns an array of all filelists in the project.

filelist

Given an index number returns that filelist from the project. You can also use negative numbers to count from the end. Returns undef if the specified filelist does not exist.

map_filelists

Given a code reference, transforms every filelist element into a new array.

filter_filelists

Given a code reference, returns an array with every filelist element for which that code returns true.

find_filelist

Given a code reference, returns the first filelist for which the code returns true.

num_filelists

Returns a count of all filelists in the project.

path

Given a list of one or more id strings, returns a list of XML::Ant::BuildFile::Resource::Paths for <classpath/>s and <path/>s in the project.

target

Given a list of target names, return the corresponding XML::Ant::BuildFile::Target objects. In scalar context return only the last target specified.

all_targets

Returns a list of all targets as XML::Ant::BuildFile::Target objects.

target_names

Returns a list of the target names from the build file.

has_target

Given a target name, returns true or false if the target exists.

num_targets

Returns a count of the number of targets in the build file.

BUILD

After construction, the app-wide XML::Ant::Properties singleton stores any <property/> name/value pairs set by the build file, as well as any resource string expansions handled by XML::Ant::BuildFile::Resource plugins. It also contains the following predefined properties as per the Ant documentation:

os.name
basedir
ant.file
ant.project.name

BUGS

Please report any bugs or feature requests on the bugtracker website http://github.com/mjgardner/XML-Ant-BuildFile/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Mark Gardner <mjgardner@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by GSI Commerce.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.