App-git-ship

 view release on metacpan or  search on metacpan

lib/App/git/ship/perl.pm  view on Meta::CPAN

  require CPAN::Uploader;
  $uploader = CPAN::Uploader->new(CPAN::Uploader->read_config_file);

  unless ($dist_file) {
    $self->build;
    $self->abort(
      "Project built. Run 'git ship' again to post dist to CPAN and remote repostitory.");
  }
  unless ($self->config('next_version')) {
    close ARGV;
    local @ARGV = $changelog;
    while (<>) {
      /^$VERSION_RE\s*/ or next;
      $self->config(next_version => $1);
      last;
    }
  }

  $self->run_hook('before_ship');
  $self->system(qw(git add Makefile.PL), $changelog);
  $self->system(qw(git add README.md)) if -e 'README.md';

t/perl-build.t  view on Meta::CPAN

done_testing;

sub create_main_module {
  open my $MAIN_MODULE, '>', File::Spec->catfile(qw(lib Perl Build.pm));
  print $MAIN_MODULE
    "package Perl::Build;\n=head1 NAME\n\nPerl::Build\n\n=head1 VERSION\n\n0.00\n\n=cut\n\nour \$VERSION = '42';\n\n1";
}

sub add_version_to_changes {
  my $version = shift;
  local @ARGV = ('Changes');
  local $^I   = '';
  while (<>) {
    print "$version\n       * Some other cool feature for $version.\n\n" if $. == 3;
    print;
  }
}

sub touch {
  open my $FH, '>>', shift;
}

t/perl-ship-changelog-md.t  view on Meta::CPAN

ok -e 'Changes', 'Changes was generated by start';
unlink 'Changes';
write_alien_files();

diag 'Build';
$app->config(new_version_format => '## %v (%F)');
eval { $app->ship };
like $@, qr{Project built}, 'Project built';
is $upload_file, '', 'CPAN::Uploader did not upload anything';

local @ARGV = ('CHANGELOG.md');
my $changes = do { local $/; <>; };

like $changes, qr{^\#\#\s0\.04\s\(\w+}s, 'changes was updated with timestamp';

diag 'Ship';
$upload_file = '';
eval { $app->ship };
is $@, '', 'no ship error';
like $upload_file, qr{\bPerl-Changelogmd-0\.04\.tar\.gz$}, 'CPAN::Uploader uploaded version 0.04';

t/perl-ship.t  view on Meta::CPAN

$app = App::git::ship->new;
bless $app, $app->detect;
$upload_file = '';

ok !$app->config('next_version'), 'no next_version yet';

eval { $app->ship };
like $@, qr{Unable to add timestamp}, 'Unable to add timestamp';

{
  local @ARGV = ('Changes');
  local $^I   = '';
  while (<>) {
    print "0.02 Not Released\n - Some other cool feature\n\n" if $. == 3;
    print;
  }
}

$app->build->ship;
is $app->config('next_version'), '0.02', 'next_version is 0.02';
like $upload_file, qr{\bPerl-Ship-0\.02\.tar\.gz$}, 'CPAN::Uploader uploaded version 0.01';

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.679 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )