App-JIRAPrint

 view release on metacpan or  search on metacpan

scripts/jiraprint  view on Meta::CPAN


use App::JIRAPrint;

use Getopt::Long;
use Pod::Usage;

my ($sprint, $project, $url, $username);

my $verbose;
my $help;
my $output;

GetOptions(
    "sprint=s" => \$sprint,
    "project=s" => \$project,
    "url=s" => \$url,
    "username=s" => \$username,
    "verbose" => \$verbose,
    "help" => \$help,
    "output=s" => \$output,
);

if( $verbose ){
    Log::Any::Adapter->set('Stderr' , log_level => 'trace' );
}

if( $help ){
    Pod::Usage::pod2usage( -input => __FILE__ , -verbose => 2,
                           -message => 'Generating help'
                       );
}

unless( $sprint ){
    $log->error("Missing --sprint options. Run jiraprint --help for more details");
    exit(1);
}


my $j = App::JIRAPrint->new({
    sprint => $sprint,
    ( $project ? ( project => $project ) : () ),
    ( $username ? ( username => $username ) : () ),
    ( $url ? ( url => $url ) : () )
});

# Force config loading
eval{
    $j->config();
};
if( my $err = $@ ){
    $log->error("Error in arguments or configuration: ".$err);
    $log->error("Please run jiraprint --help");
    exit(1);
}

unless( $output ){

    binmode STDOUT, ':utf8';
    print $j->process_template();
}else{
    open OUTPUT , '>' , $output;
    binmode OUTPUT , ':utf8';
    print OUTPUT $j->process_template();
    close OUTPUT;
    $log->info("XeTeX file written to $output. Now run xelatex $output to generate your PDF.");
}

__END__

=head1 NAME

jiraprint - Generate printable XeTeX code to print JIRA tickets on Postits

=head1 INSTALLATION

This is a standard Perl package. Install on system perl:

  sudo cpan -i App::JIRAPrint

Or in your cpanminus favorite destination:

  cpanm App::JIRAPrint

=head1 DEPENDENCY

To process the generated LaTeX code into a usable PDF, you'll have
to have a full TeXLive (or MacTeX) distribution on your machine.

See L<https://www.tug.org/texlive/> Or  L<https://tug.org/mactex/>

=head1 SYNOPSIS

  jiraprint --project PROJ --sprint 52 --output proj-52.tex

Then:

  xelatex proj-52.tex

You can also pipe directly from this to xelatex if you're lazy:

 jiraprint --project PROJ --sprint 52 | xelatex

This will create a pdf named 'texput.pdf'

Note that the 'project' option is optional and can live in the configuration file.

=head1 CONFIGURATION

This script relies on configuration files and on command line options for its configuration.

This will attempt to load three configuration files: C<$PWD/.jiraprint.conf> , C<$HOME/.jiraprint.conf> and C</etc/jiraprint.conf>.

Each configuration files in in Perl format and can contain the following keys:

  {
    url => 'https://yourjira.domain.net/',
    username => 'jirausername',
    password => 'jirapassword',
    project => 'PROJ',
  }


url, username and password have to be defined in config files.



( run in 2.324 seconds using v1.01-cache-2.11-cpan-437f7b0c052 )