File Coverage

blib/lib/App/GHPT/WorkSubmitter/AskPullRequestQuestions.pm
Criterion Covered Total %
statement 21 26 80.7
branch n/a
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 28 34 82.3


line stmt bran cond sub pod time code
1             package App::GHPT::WorkSubmitter::AskPullRequestQuestions;
2              
3 1     1   8 use App::GHPT::Wrapper::OurMoose;
  1         4  
  1         14  
4              
5             our $VERSION = '1.000012';
6              
7 1     1   12 use App::GHPT::Types qw( ArrayRef Str );
  1         2  
  1         16  
8 1     1   6476 use Module::Pluggable::Object;
  1         6452  
  1         51  
9 1     1   624 use App::GHPT::WorkSubmitter::ChangedFilesFactory;
  1         4  
  1         508  
10              
11             has merge_to_branch_name => (
12             is => 'ro',
13             isa => Str,
14             required => 1,
15             );
16              
17             has question_namespaces => (
18             is => 'ro',
19             isa => ArrayRef [Str],
20             required => 1,
21             );
22              
23             has _changed_files => (
24             is => 'ro',
25             isa => 'App::GHPT::WorkSubmitter::ChangedFiles',
26             lazy => 1,
27             builder => '_build_changed_files',
28             );
29              
30 2     2   8 sub _build_changed_files ($self) {
  2         12  
  2         5  
31 2         100 return App::GHPT::WorkSubmitter::ChangedFilesFactory->new(
32             merge_to_branch_name => $self->merge_to_branch_name,
33             )->changed_files;
34             }
35              
36             has _questions => (
37             is => 'ro',
38             isa => ArrayRef,
39             lazy => 1,
40             builder => '_build_questions',
41             );
42              
43 2     2   10 sub _build_questions ($self) {
  2         12  
  2         3  
44             return [
45 2         94 map { $_->new( changed_files => $self->_changed_files ) }
  3         4269  
46             Module::Pluggable::Object->new(
47             search_path => $self->question_namespaces,
48             require => 1,
49             )->plugins,
50             ];
51             }
52              
53 0     0 1   sub ask_questions ($self) {
  0            
  0            
54 0           return join "\n", map { $_->ask } $self->_questions->@*;
  0            
55             }
56              
57             __PACKAGE__->meta->make_immutable;
58              
59             1;
60              
61             # ABSTRACT: Ask questions to go in the pull request
62              
63             __END__
64              
65             =pod
66              
67             =encoding UTF-8
68              
69             =head1 NAME
70              
71             App::GHPT::WorkSubmitter::AskPullRequestQuestions - Ask questions to go in the pull request
72              
73             =head1 VERSION
74              
75             version 1.000012
76              
77             =head1 SYNOPSIS
78              
79             my $markdown = App::GHPT::WorkSubmitter::AskPullRequestQuestions->new(
80             merge_to_branch_name => 'master',
81             )->ask_questions;
82              
83             =head1 DESCRIPTION
84              
85             A module to ask questions about the branch you're creating a pull request
86             about and find.
87              
88             This module searches for all C<App::GHPT::WorkSubmitter::Question::*> modules and uses
89             them to produce markdown.
90              
91             =head1 ATTRIBUTES
92              
93             =head2 merge_to_branch_name
94              
95             The name of the branch that we're creating the pull request against. This is
96             probably C<master>.
97              
98             Required. Str.
99              
100             =head1 METHODS
101              
102             =head2 $asker->ask_questions
103              
104             Ask all the questions, return markdown.
105              
106             =head1 SUPPORT
107              
108             Bugs may be submitted through L<https://github.com/maxmind/App-GHPT/issues>.
109              
110             =head1 AUTHORS
111              
112             =over 4
113              
114             =item *
115              
116             Mark Fowler <mark@twoshortplanks.com>
117              
118             =item *
119              
120             Dave Rolsky <autarch@urth.org>
121              
122             =back
123              
124             =head1 COPYRIGHT AND LICENSE
125              
126             This software is Copyright (c) 2019 by MaxMind, Inc.
127              
128             This is free software, licensed under:
129              
130             The Artistic License 2.0 (GPL Compatible)
131              
132             =cut