| 1 | package App::duino::Command::clean; | ||||||||||
| 2 | { | ||||||||||
| 3 | 1 | $App::duino::Command::clean::VERSION = '0.10'; | |||||||||
| 4 | } | ||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use App::duino -command; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | use File::Path qw(remove_tree); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | =head1 NAME | ||||||||||
| 14 | |||||||||||
| 15 | App::duino::Command::clean - Clean the build directory | ||||||||||
| 16 | |||||||||||
| 17 | =head1 VERSION | ||||||||||
| 18 | |||||||||||
| 19 | version 0.10 | ||||||||||
| 20 | |||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||
| 22 | |||||||||||
| 23 | $ duino clean --board uno | ||||||||||
| 24 | |||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||
| 26 | |||||||||||
| 27 | This command can be used to clean the build directory for a specific Arduino | ||||||||||
| 28 | board. | ||||||||||
| 29 | |||||||||||
| 30 | =cut | ||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | sub abstract { 'clean the build directory' } | ||||||||
|
Subroutine
abstract: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub usage_desc { '%c clean %o' } | ||||||||
|
Subroutine
usage_desc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub opt_spec { | ||||||||
|
Subroutine
opt_spec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 37 | 0 | my ($self) = @_; | |||||||||
| 38 | |||||||||||
| 39 | return ( | ||||||||||
| 40 | 0 | [ 'board|b=s', 'specify the board model', | |||||||||
| 41 | { default => $self -> default_config('board') } ], | ||||||||||
| 42 | ); | ||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | sub is_folder_empty { | ||||||||
|
Subroutine
is_folder_empty: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 46 | 0 | my $dir = shift; | |||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | opendir my $dh, $dir or return 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | return !grep { not /^\.+$/ } readdir $dh; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 53 | 0 | my ($self, $opt, $args) = @_; | |||||||||
| 54 | |||||||||||
| 55 | 0 | my $board_name = $opt -> board; | |||||||||
| 56 | |||||||||||
| 57 | 0 | remove_tree(".build/$board_name/"); | |||||||||
| 58 | 0 | ▶ | remove_tree(".build") if is_folder_empty(".build"); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | =head1 OPTIONS | ||||||||||
| 62 | |||||||||||
| 63 | =over 4 | ||||||||||
| 64 | |||||||||||
| 65 | =item B<--board>, B<-b> | ||||||||||
| 66 | |||||||||||
| 67 | The Arduino board model. The environment variable C<ARDUINO_BOARD> will be used | ||||||||||
| 68 | if present and if the command-line option is not set. If neither of them is set | ||||||||||
| 69 | the default value (C<uno>) will be used. | ||||||||||
| 70 | |||||||||||
| 71 | =back | ||||||||||
| 72 | |||||||||||
| 73 | =head1 AUTHOR | ||||||||||
| 74 | |||||||||||
| 75 | Alessandro Ghedini <alexbio@cpan.org> | ||||||||||
| 76 | |||||||||||
| 77 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 78 | |||||||||||
| 79 | Copyright 2013 Alessandro Ghedini. | ||||||||||
| 80 | |||||||||||
| 81 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 82 | under the terms of either: the GNU General Public License as published | ||||||||||
| 83 | by the Free Software Foundation; or the Artistic License. | ||||||||||
| 84 | |||||||||||
| 85 | See http://dev.perl.org/licenses/ for more information. | ||||||||||
| 86 | |||||||||||
| 87 | =cut | ||||||||||
| 88 | |||||||||||
| 89 | 1 | 1; # End of App::duino::Command::clean | |||||||||