| 1 | package Bundler::MultiGem::Command::setup; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Bundler::MultiGem -command; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use YAML::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Bundler::MultiGem::Model::Directories; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Bundler::MultiGem::Model::Gem; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | =head1 NAME | ||||||||||
| 13 | |||||||||||
| 14 | Bundler::MultiGem::Command::setup - Create multiple gem versions out of a configuration file (alias: install i s) | ||||||||||
| 15 | |||||||||||
| 16 | =head1 VERSION | ||||||||||
| 17 | |||||||||||
| 18 | Version 0.02 | ||||||||||
| 19 | |||||||||||
| 20 | =cut | ||||||||||
| 21 | |||||||||||
| 22 | 1 | our $VERSION = '0.02'; | |||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | This module includes the commands to create multiple versions of the same gem out of a config yml file | ||||||||||
| 27 | |||||||||||
| 28 | bundle-multigem [-f] [long options...] <path> | ||||||||||
| 29 | |||||||||||
| 30 | -f --file provide the yaml configuration file (default: | ||||||||||
| 31 | ./.bundle-multigem.yml) | ||||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | =head1 SUBROUTINES/METHODS | ||||||||||
| 35 | |||||||||||
| 36 | =head2 command_names | ||||||||||
| 37 | |||||||||||
| 38 | Command aliases: C<setup, install, i, s> | ||||||||||
| 39 | |||||||||||
| 40 | =cut | ||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub command_names { | ||||||||
|
Subroutine
command_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 43 | 0 | qw(setup install i s) | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | =head2 usage_desc | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub usage_desc { "bundle-multigem %o <path>" } | ||||||||
|
Subroutine
usage_desc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | |||||||||||
| 52 | =head2 opt_spec | ||||||||||
| 53 | |||||||||||
| 54 | =cut | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub opt_spec { | ||||||||
|
Subroutine
opt_spec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 57 | return ( | ||||||||||
| 58 | 0 | [ "file|f=s", "provide the yaml configuration file (default: ./.bundle-multigem.yml)" ], | |||||||||
| 59 | ); | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | =head2 validate_args | ||||||||||
| 63 | |||||||||||
| 64 | =cut | ||||||||||
| 65 | |||||||||||
| 66 | 0 | ▶ | sub validate_args { | ||||||||
|
Subroutine
validate_args: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 67 | 0 | my ($self, $opt, $args) = @_; | |||||||||
| 68 | |||||||||||
| 69 | 0 | ▶ | if (!defined $opt->{file}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | $opt->{file} = '.bundle-multigem.yml'; | |||||||||
| 71 | } | ||||||||||
| 72 | 0 | ▶ | if (!-f $opt->{file}){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 73 | 0 | $self->usage_error("You should provide a valid path ($opt->{file} does not exists)"); | |||||||||
| 74 | } | ||||||||||
| 75 | 0 | ▶ | $self->usage_error("No args allowed") if @$args; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | =head2 execute | ||||||||||
| 79 | |||||||||||
| 80 | Load the YAML configuration file, validates the directories provided and apply the gem creation | ||||||||||
| 81 | |||||||||||
| 82 | =cut | ||||||||||
| 83 | |||||||||||
| 84 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 85 | 0 | my ($self, $opt, $args) = @_; | |||||||||
| 86 | |||||||||||
| 87 | 0 | my $yaml = YAML::Tiny->read($opt->{file}); | |||||||||
| 88 | |||||||||||
| 89 | 0 | my $gem = Bundler::MultiGem::Model::Gem->new($yaml->[0]{gem}); | |||||||||
| 90 | my $dir = Bundler::MultiGem::Model::Directories->new({ | ||||||||||
| 91 | cache => $yaml->[0]{cache}, | ||||||||||
| 92 | directories => $yaml->[0]{directories}, | ||||||||||
| 93 | 0 | }); | |||||||||
| 94 | |||||||||||
| 95 | 0 | $dir->validates; | |||||||||
| 96 | 0 | $dir->apply_cache; | |||||||||
| 97 | |||||||||||
| 98 | 0 | $gem->apply($dir); | |||||||||
| 99 | |||||||||||
| 100 | 0 | print "Completed!"; | |||||||||
| 101 | } | ||||||||||
| 102 | |||||||||||
| 103 | =head1 AUTHOR | ||||||||||
| 104 | |||||||||||
| 105 | Mauro Berlanda, C<< <kupta at cpan.org> >> | ||||||||||
| 106 | |||||||||||
| 107 | =head1 BUGS | ||||||||||
| 108 | |||||||||||
| 109 | Please report any bugs or feature requests to L<https://github.com/mberlanda/Bundler-MultiGem/issues>, or through | ||||||||||
| 110 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=.>. I will be notified, and then you'll | ||||||||||
| 111 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 112 | |||||||||||
| 113 | =head1 SUPPORT | ||||||||||
| 114 | |||||||||||
| 115 | You can find documentation for this module with the perldoc command. | ||||||||||
| 116 | |||||||||||
| 117 | perldoc Bundler::MultiGem::Directories | ||||||||||
| 118 | |||||||||||
| 119 | |||||||||||
| 120 | You can also look for information at: | ||||||||||
| 121 | |||||||||||
| 122 | =over 2 | ||||||||||
| 123 | |||||||||||
| 124 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||
| 125 | |||||||||||
| 126 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=Bundler-MultiGem> | ||||||||||
| 127 | |||||||||||
| 128 | =item * Github Repository | ||||||||||
| 129 | |||||||||||
| 130 | L<https://github.com/mberlanda/Bundler-MultiGem> | ||||||||||
| 131 | |||||||||||
| 132 | =back | ||||||||||
| 133 | |||||||||||
| 134 | |||||||||||
| 135 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 136 | |||||||||||
| 137 | |||||||||||
| 138 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 139 | |||||||||||
| 140 | Copyright 2018 Mauro Berlanda. | ||||||||||
| 141 | |||||||||||
| 142 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 143 | under the terms of the the Artistic License (2.0). You may obtain a | ||||||||||
| 144 | copy of the full license at: | ||||||||||
| 145 | |||||||||||
| 146 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||
| 147 | |||||||||||
| 148 | Any use, modification, and distribution of the Standard or Modified | ||||||||||
| 149 | Versions is governed by this Artistic License. By using, modifying or | ||||||||||
| 150 | distributing the Package, you accept this license. Do not use, modify, | ||||||||||
| 151 | or distribute the Package, if you do not accept this license. | ||||||||||
| 152 | |||||||||||
| 153 | If your Modified Version has been derived from a Modified Version made | ||||||||||
| 154 | by someone other than you, you are nevertheless required to ensure that | ||||||||||
| 155 | your Modified Version complies with the requirements of this license. | ||||||||||
| 156 | |||||||||||
| 157 | This license does not grant you the right to use any trademark, service | ||||||||||
| 158 | mark, tradename, or logo of the Copyright Holder. | ||||||||||
| 159 | |||||||||||
| 160 | This license includes the non-exclusive, worldwide, free-of-charge | ||||||||||
| 161 | patent license to make, have made, use, offer to sell, sell, import and | ||||||||||
| 162 | otherwise transfer the Package with respect to any patent claims | ||||||||||
| 163 | licensable by the Copyright Holder that are necessarily infringed by the | ||||||||||
| 164 | Package. If you institute patent litigation (including a cross-claim or | ||||||||||
| 165 | counterclaim) against any party alleging that the Package constitutes | ||||||||||
| 166 | direct or contributory patent infringement, then this Artistic License | ||||||||||
| 167 | to you shall terminate on the date that such litigation is filed. | ||||||||||
| 168 | |||||||||||
| 169 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||||||||||
| 170 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||||||||||
| 171 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||||||||||
| 172 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||||||||||
| 173 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||||||||||
| 174 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||||||||||
| 175 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||||||||||
| 176 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||
| 177 | |||||||||||
| 178 | |||||||||||
| 179 | =cut | ||||||||||
| 180 | |||||||||||
| 181 | 1 | 1; | |||||||||