| 1 |
=begin |
| 2 |
|
| 3 |
=head1 Adding a New Project Action |
| 4 |
|
| 5 |
Read on if you want to add a new action that can be performed on a project |
| 6 |
according to instructions found in its metadata. If you're looking to add |
| 7 |
some other type of command to C<plumage>, read |
| 8 |
L<Adding a New Command|add-command.pod> instead. |
| 9 |
|
| 10 |
|
| 11 |
=head2 Base Implementation |
| 12 |
|
| 13 |
You will need to update F<src/lib/Plumage/Project.nqp> to implement the |
| 14 |
action, as follows: |
| 15 |
|
| 16 |
=over 4 |
| 17 |
|
| 18 |
=item New subsection |
| 19 |
|
| 20 |
Add a new subsection for the new action within the C<ACTIONS> section of |
| 21 |
the code. Try to place the new subsection roughly in the sequence the |
| 22 |
action is likely to be used. |
| 23 |
|
| 24 |
=item Base action method |
| 25 |
|
| 26 |
Add the base action method at the top of the new subsection. It should |
| 27 |
be named for the action itself, and take no arguments. For instance, the |
| 28 |
base method for the fetch action begins C<method fetch () {>. This base |
| 29 |
method should start by pulling the action instructions from the metadata. |
| 30 |
|
| 31 |
If these instructions don't exist, most actions should simply report that |
| 32 |
the action is not needed or not available on that project, and return |
| 33 |
success (1). A few actions, such as fetch and install, are required -- |
| 34 |
these should return failure (0) if no instructions exist. |
| 35 |
|
| 36 |
If the instructions do exist, the base method should let the user know |
| 37 |
the action is about to be executed, and then redispatch to a method |
| 38 |
specific to the action type specified in the metadata instructions. |
| 39 |
|
| 40 |
=item Specific action methods |
| 41 |
|
| 42 |
Add specific action methods for each type supported by the new action. |
| 43 |
Each specific method name should have the base method name and the action |
| 44 |
type separated by an underscore, e.g. C<fetch_git()> and C<fetch_svn()>. |
| 45 |
|
| 46 |
These should actually perform the task at hand, reporting success (1) or |
| 47 |
failure (0) as appropriate. |
| 48 |
|
| 49 |
=back |
| 50 |
|
| 51 |
|
| 52 |
=head2 Known Actions List |
| 53 |
|
| 54 |
Before the new action is considered valid, it must be added to the known |
| 55 |
actions list in the C<known_actions()> method at the top of the C<ACTIONS> |
| 56 |
section. Before this is done, metadata referring to the new action will |
| 57 |
be considered invalid, and C<perform_actions()> will not recognize new |
| 58 |
action. |
| 59 |
|
| 60 |
|
| 61 |
=head2 Documentation |
| 62 |
|
| 63 |
Add an entry for the new action to the C<SYNOPSIS> (in the same order you |
| 64 |
used when creating the new code section), and then add a section for the |
| 65 |
new action with more details in the C<DESCRIPTION> section of the POD. |
| 66 |
|
| 67 |
|
| 68 |
=head2 Tests |
| 69 |
|
| 70 |
C<Plumage::Project> does not have a test suite yet. |
| 71 |
|
| 72 |
|
| 73 |
=head2 Next Step |
| 74 |
|
| 75 |
Once the new action is implemented, documented, and tested, continue with |
| 76 |
L<Adding a New Command|add-command.pod> to add a command for this action to |
| 77 |
the C<plumage> command-line tool. |
| 78 |
|
| 79 |
|
| 80 |
=end |