| 1 | package App::JC::Client::start; | ||
| 2 | #ABSTRACT: class implementing starting of an issue | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use MooseX::App::Command; | ||
| 6 | extends qw(App::JC::Client); | ||
| 7 | |||
| 8 | use Term::ANSIColor; | ||
| 9 | use Try::Tiny; | ||
| 10 | use JIRA::Client::Automated; | ||
| 11 | |||
| 12 | # the version of the module | ||
| 13 | our $VERSION = '0.001'; | ||
| 14 | |||
| 15 | command_short_description 'start an issue'; | ||
| 16 | command_usage 'jc.pl start <issuekey>'; | ||
| 17 | |||
| 18 | |||
| 19 | option 'issuekey' => ( | ||
| 20 | is => 'ro', | ||
| 21 | isa => 'Str', | ||
| 22 | required => 1, | ||
| 23 | documentation => q[The key of the issue to start], | ||
| 24 | cmd_aliases => [qw(i)], # Alternative option name | ||
| 25 | ); | ||
| 26 | |||
| 27 | sub run | ||
| 28 | { | ||
| 29 | my $self = shift; | ||
| 30 | |||
| 31 | my $jira = JIRA::Client::Automated->new($self->url, $self->user, $self->pass); | ||
| 32 | |||
| 33 | my $issue = $jira->get_issue($self->issuekey); | ||
| 34 | if (!defined($issue)) | ||
| 35 | { | ||
| 36 | die("ERROR: issue does not exist\n"); | ||
| 37 | } | ||
| 38 | $jira->assign_issue($self->issuekey, $self->user); | ||
| 39 | $jira->transition_issue($self->issuekey, "In Arbeit"); | ||
| 40 | |||
| 41 | } | ||
| 42 | |||
| 43 | 1; | ||
| 44 | |||
| 45 | __END__ |