| 1 | package Dist::Zilla::App::Command::mkrpmspec; | ||
| 2 | # ABSTRACT: generate RPM spec file from your template | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | use Carp; | ||
| 7 | |||
| 8 | use Dist::Zilla::App -command; | ||
| 9 | |||
| 10 | our $VERSION = '0.016'; # VERSION | ||
| 11 | |||
| 12 | sub abstract { 'generate RPM spec file from your build template' } | ||
| 13 | |||
| 14 | sub execute { | ||
| 15 | my($self,$opt,$args) = @_; | ||
| 16 | my($filename) = @{$args}; | ||
| 17 | $filename ||= 'dzil.spec'; | ||
| 18 | |||
| 19 | require Path::Class; | ||
| 20 | |||
| 21 | $_->before_build for @{ $self->zilla->plugins_with(-BeforeBuild) }; | ||
| 22 | $_->gather_files for @{ $self->zilla->plugins_with(-FileGatherer) }; | ||
| 23 | $_->prune_files for @{ $self->zilla->plugins_with(-FilePruner) }; | ||
| 24 | $_->register_prereqs for @{ $self->zilla->plugins_with(-PrereqSource) }; | ||
| 25 | |||
| 26 | my $outfile = Path::Class::File->new($filename); | ||
| 27 | my $out = $outfile->openw; | ||
| 28 | print $out $self->zilla->plugin_named('RPM')->mk_spec( | ||
| 29 | sprintf('%s-%s.tar.gz',$self->zilla->name,$self->zilla->version) | ||
| 30 | ); | ||
| 31 | |||
| 32 | $self->log("spec file written to $outfile"); | ||
| 33 | } | ||
| 34 | |||
| 35 | 1; | ||
| 36 | |||
| 37 | __END__ |