| 1 | package Bundler::MultiGem::Utl::Directories; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | Bundler::MultiGem::Util::Directories - Wrapper of utility functions for directories | ||||||||||
| 10 | |||||||||||
| 11 | =head1 VERSION | ||||||||||
| 12 | |||||||||||
| 13 | Version 0.02 | ||||||||||
| 14 | |||||||||||
| 15 | =cut | ||||||||||
| 16 | |||||||||||
| 17 | 3 | our $VERSION = '0.02'; | |||||||||
| 18 | |||||||||||
| 19 | 3 | ▶ | use Exporter qw(import); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 3 | our @EXPORT = qw(mk_dir rm_dir); | |||||||||
| 21 | |||||||||||
| 22 | 3 | ▶ | use File::Path qw( make_path remove_tree ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | Wrapper of utility functions for directories | ||||||||||
| 27 | |||||||||||
| 28 | use Bundler::MultiGem::Directories qw(mk_dir rm_dir); | ||||||||||
| 29 | |||||||||||
| 30 | mk_dir($path); # create path if not exists | ||||||||||
| 31 | rm_dir($path); # remove path if exists | ||||||||||
| 32 | |||||||||||
| 33 | =head1 EXPORT | ||||||||||
| 34 | |||||||||||
| 35 | =head2 mk_dir | ||||||||||
| 36 | |||||||||||
| 37 | creates a path if not exists | ||||||||||
| 38 | |||||||||||
| 39 | =cut | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | sub mk_dir { | ||||||||
|
Subroutine
mk_dir: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 42 | 0 | my $dir = shift; | |||||||||
| 43 | 0 | ▶ | if ( !-d $dir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | ▶ | make_path $dir or die "Failed to create path: ${dir}"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | } | ||||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | =head2 rm_dir | ||||||||||
| 49 | |||||||||||
| 50 | removes a path if exists | ||||||||||
| 51 | |||||||||||
| 52 | =cut | ||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub rm_dir { | ||||||||
|
Subroutine
rm_dir: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 55 | 0 | my $dir = shift; | |||||||||
| 56 | 0 | ▶ | if ( -d $dir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 0 | ▶ | remove_tree $dir or die "Failed to remove path: ${dir}"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | } | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | =head1 AUTHOR | ||||||||||
| 62 | |||||||||||
| 63 | Mauro Berlanda, C<< <kupta at cpan.org> >> | ||||||||||
| 64 | |||||||||||
| 65 | =head1 BUGS | ||||||||||
| 66 | |||||||||||
| 67 | Please report any bugs or feature requests to L<https://github.com/mberlanda/Bundler-MultiGem/issues>, or through | ||||||||||
| 68 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=.>. I will be notified, and then you'll | ||||||||||
| 69 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 70 | |||||||||||
| 71 | =head1 SUPPORT | ||||||||||
| 72 | |||||||||||
| 73 | You can find documentation for this module with the perldoc command. | ||||||||||
| 74 | |||||||||||
| 75 | perldoc Bundler::MultiGem::Directories | ||||||||||
| 76 | |||||||||||
| 77 | |||||||||||
| 78 | You can also look for information at: | ||||||||||
| 79 | |||||||||||
| 80 | =over 2 | ||||||||||
| 81 | |||||||||||
| 82 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||
| 83 | |||||||||||
| 84 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=Bundler-MultiGem> | ||||||||||
| 85 | |||||||||||
| 86 | =item * Github Repository | ||||||||||
| 87 | |||||||||||
| 88 | L<https://github.com/mberlanda/Bundler-MultiGem> | ||||||||||
| 89 | |||||||||||
| 90 | =back | ||||||||||
| 91 | |||||||||||
| 92 | |||||||||||
| 93 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 94 | |||||||||||
| 95 | |||||||||||
| 96 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 97 | |||||||||||
| 98 | Copyright 2018 Mauro Berlanda. | ||||||||||
| 99 | |||||||||||
| 100 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 101 | under the terms of the the Artistic License (2.0). You may obtain a | ||||||||||
| 102 | copy of the full license at: | ||||||||||
| 103 | |||||||||||
| 104 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||
| 105 | |||||||||||
| 106 | Any use, modification, and distribution of the Standard or Modified | ||||||||||
| 107 | Versions is governed by this Artistic License. By using, modifying or | ||||||||||
| 108 | distributing the Package, you accept this license. Do not use, modify, | ||||||||||
| 109 | or distribute the Package, if you do not accept this license. | ||||||||||
| 110 | |||||||||||
| 111 | If your Modified Version has been derived from a Modified Version made | ||||||||||
| 112 | by someone other than you, you are nevertheless required to ensure that | ||||||||||
| 113 | your Modified Version complies with the requirements of this license. | ||||||||||
| 114 | |||||||||||
| 115 | This license does not grant you the right to use any trademark, service | ||||||||||
| 116 | mark, tradename, or logo of the Copyright Holder. | ||||||||||
| 117 | |||||||||||
| 118 | This license includes the non-exclusive, worldwide, free-of-charge | ||||||||||
| 119 | patent license to make, have made, use, offer to sell, sell, import and | ||||||||||
| 120 | otherwise transfer the Package with respect to any patent claims | ||||||||||
| 121 | licensable by the Copyright Holder that are necessarily infringed by the | ||||||||||
| 122 | Package. If you institute patent litigation (including a cross-claim or | ||||||||||
| 123 | counterclaim) against any party alleging that the Package constitutes | ||||||||||
| 124 | direct or contributory patent infringement, then this Artistic License | ||||||||||
| 125 | to you shall terminate on the date that such litigation is filed. | ||||||||||
| 126 | |||||||||||
| 127 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||||||||||
| 128 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||||||||||
| 129 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||||||||||
| 130 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||||||||||
| 131 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||||||||||
| 132 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||||||||||
| 133 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||||||||||
| 134 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||
| 135 | |||||||||||
| 136 | |||||||||||
| 137 | =cut | ||||||||||
| 138 | |||||||||||
| 139 | 3 | 1; | |||||||||