Hi JJ Merelo,

Everything is ok now, I can install newest version. Thank you very much for finding this error.

In the mean time I've been busy making an uploader yesterday which saves me some handwork making the git archive and uploading it to PAUSE using its webinterface. It makes use of CPAN::Uploader::Tiny to get it there. As a side effect I will never make this mistake again because the name of the archive is the name of the directory with the version attached to it. The version is retrieved from the META6.json file. For anyone interested, the code is in the attachement of this mail. It is free to use and to make modifications but without any warranties.

Regards,
Marcel
#!/usr/bin/env perl6

use v6;
use JSON::Fast;
use CPAN::Uploader::Tiny;

#-------------------------------------------------------------------------------
sub MAIN ( *@p6-dirs is copy ) {

  @p6-dirs //= ();

  for @p6-dirs -> $p6-dir {
    next unless "$p6-dir".IO.d;

    # Check for a Meta file and if there is a git directory
    if "$p6-dir/META6.json".IO.r and "$p6-dir/.git".IO.d {
      archive($p6-dir);
    }
  }
}

#-------------------------------------------------------------------------------
sub archive ( Str $p6-dir is copy ) {

  # remove trailing slash if any
  $p6-dir ~~ s/ '/' $ //;
  chdir($p6-dir);

  # Read the meta file and get the version
  my Hash $meta = from-json('META6.json'.IO.slurp);
  my Str $version = $meta<version>;

  # Remove a leading 'v' if it is used, then keep only 3 version parts
  # separated by 2 dots. CPAN does not like more dots than two.
  $version ~~ s:i/ ^ 'v' //;
  $version ~~ s/ \. \d+ $ // while $version.comb(/\./).join.chars > 2;

  note "Build git archive $p6-dir-$version.tar.gz";
  run 'git', 'archive', "--prefix=$p6-dir-$version/",
      '-o', "../$p6-dir-$version.tar.gz", 'HEAD';

  chdir('..');

  # A file $HOME/.pause must exist with username and password.
  # This file may be encrypted. Two rows are in this file;
  #   user <username>
  #   password <password>
  my $uploader = CPAN::Uploader::Tiny.new-from-config($*HOME.add: '.pause');

  try {
    $uploader.upload("$p6-dir-$version.tar.gz");
    note "$p6-dir-$version.tar.gz is uploaded to PAUSE";

    CATCH {
      default {
        note "Error: $_.message";
      }
    }
  }

  note "Remove $p6-dir-$version.tar.gz";
  unlink "$p6-dir-$version.tar.gz";
}

Reply via email to