Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rewrite tests without using Pinto::Tester.
  • Loading branch information
Jeffrey Ryan Thalhammer committed Jan 22, 2014
1 parent ed90ad1 commit b24daba
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 122 deletions.
17 changes: 13 additions & 4 deletions lib/Dist/Zilla/Plugin/Pinto/Add.pm
Expand Up @@ -65,7 +65,7 @@ has username => (
has password => (
is => 'ro',
isa => Str,
default => sub { $ENV{PINTO_PASSWORD} || shift->zilla->chrome->prompt_str('Pinto password: ', { noecho => 1 }) },
default => sub { $ENV{PINTO_PASSWORD} || shift->_ask_for_password },
lazy => 1,
);

Expand Down Expand Up @@ -130,7 +130,7 @@ sub before_release {
$self->authenticate ? (-password => $self->password) : (),
);

$self->log("checking if pinto repository at $root is available");
$self->log("checking if repository at $root is available");
my ($ok, $output) = $self->RUN_PINTO( nop => @args );

if (not $ok) {
Expand All @@ -143,7 +143,7 @@ sub before_release {
push @live_roots, $root;
}

$self->log_fatal('none of your pinto repositories are available') if not @live_roots;
$self->log_fatal('none of your repositories are available') if not @live_roots;
$self->_set_live_roots(\@live_roots);

return $self;
Expand Down Expand Up @@ -180,6 +180,16 @@ sub release {
return 1;
}

#------------------------------------------------------------------------------

sub _ask_for_password {
my ($self) = @_;

my $prompt = sprintf 'Pinto password for %s: ', $self->username;
my $password = $self->zilla->chrome->prompt_str($prompt, { noecho => 1 });

return $password;
}

#------------------------------------------------------------------------------

Expand All @@ -195,7 +205,6 @@ sub RUN_PINTO {
my @cmd = ($self->pinto_exe, @args);
my $timeout = IPC::Run::timeout(300);
my $ok = IPC::Run::run(\@cmd, \$input, \$output, \$output, $timeout);
$self->log("Command (pinto @args) failed: $!") if not $ok;
return ($ok, $output);
}

Expand Down

0 comments on commit b24daba

Please sign in to comment.