App-GHPT

 view release on metacpan or  search on metacpan

lib/App/GHPT/WorkSubmitter.pm  view on Meta::CPAN

        . PL_V( ' is', scalar $chore_stories->@* )
        . ' not shown here (chores by definition do not require review).'
        if $chore_stories;

    return $non_chore_stories // [];
}

sub _confirm_story ( $self, $text ) {
    my $result = $self->_choose(
        [ 'Accept', 'Edit' ],
        { prompt => $text, clear_screen => $ENV{'SUBMIT_WORK_CLEAR'} // 0 }
    );
    return $text if $result eq 'Accept';
    my $fh = solicit($text);
    return do { local $/ = undef; <$fh> };
}

sub _text_for_story ( $self, $story, $reviewer ) {
    join "\n\n",
        $story->name,
        $story->url,

lib/App/GHPT/WorkSubmitter/Question/ExampleFileNameCheck.pod  view on Meta::CPAN


    1;

=head1 DESCRIPTION

If you create one or more modules under the
L<App::GHPT::WorkSubmitter::Question> namespace, these modules will be loaded
and used to (maybe) ask additional questions as part of creating a pull
request.

This is useful if you want to automate prompting for various potential
issues. For example, you might look for database migrations and ask the person
submitting the pull request about things like table locking, whether the
existing code will work with the changed schema, etc.

=head1 API

To make a question work, you must follow a certain API:

=over 4

lib/App/GHPT/WorkSubmitter/Role/Question.pm  view on Meta::CPAN

    required => 1,
);

sub ask_question ( $self, $question, @responses ) {
    my $choice = choose(
        [
            @responses,
            'Launch Editor'
        ],
        {
            prompt       => $question,
            clear_screen => $ENV{'SUBMIT_WORK_CLEAR'} // 0
        }
    ) or exit;    # user hit 'q' or ctrl-d to stop

    return $self->format_qa_markdown( $question, $choice )
        unless $choice eq 'Launch Editor';

    # todo: It would be nice if the notes persisted to disk for a given PT so
    # that I could ctrl-c out of a later question and still not have to retype
    # previously asked questions.  That's a task for another day however.

    my $prompt = <<"ENDOFTEXT";
$question

Complete your answer below the line in markdown.
---
ENDOFTEXT
    my $fh = solicit($prompt);

    my $answer = do { local $/ = undef; <$fh> };
    $answer =~ s/\A\Q$prompt//;

    return $self->format_qa_markdown( $question, $answer );
}

## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
sub _trim ($text) {
    return $text =~ s/\A\s+//r =~ s/\s+\z//r;
}
## use critic

lib/App/GHPT/WorkSubmitter/Role/Question.pm  view on Meta::CPAN

=head1 DESCRIPTION

This role allows you to write questions to ask someone when creating pull
request.

You want to create these questions classes in the
C<App::GHPT::WorkSubmitter::Question::*> namespace where
L<App::GHPT::WorkSubmitter::Questioner> will automatically detect them and ask
them each time C<gh-pt.pl> is run.

Each class must supply an C<ask> method which should prompt the user as needed
and return any markdown to be placed in the pull request body.

=head1 ATTRIBUTES

=head2 changed_files

The files that have changed in this branch.  This is the primary attribute
you want to examine.

=head1 METHODS



( run in 0.917 second using v1.01-cache-2.11-cpan-6aa56a78535 )