App-Sybil
view release on metacpan or search on metacpan
lib/App/Sybil/Command/auth.pm view on Meta::CPAN
package App::Sybil::Command::auth;
use strict;
use warnings;
use v5.12;
use App::Sybil -command;
use IO::Prompt::Simple 'prompt';
sub abstract { 'Authenticate with github' }
sub execute {
my ($self, $opt, $args) = @_;
if ($self->app->_read_token) {
say STDERR "You already have an authentication token.";
return;
}
# TODO hide password when typing
my $user = prompt('GitHub Username');
my $pass = prompt('GitHub Password');
my $github = Net::GitHub->new(
version => 3,
login => $user,
pass => $pass,
);
eval { $github->user->show(); };
if ($@ =~ /OTP/) {
my $otp = prompt('Authenticator code');
$github = Net::GitHub->new(
version => 3,
login => $user,
pass => $pass,
otp => $otp,
);
}
eval { $github->user->show(); };
lib/App/Sybil/Command/release.pm view on Meta::CPAN
package App::Sybil::Command::release;
use strict;
use warnings;
use v5.12;
use App::Sybil -command;
use Capture::Tiny ':all';
use IO::Prompt::Simple 'prompt';
use File::Slurp;
use File::Temp 'tempfile';
use Net::GitHub;
sub abstract { 'Release your software' }
sub description { 'Publishes your current version as a github release' }
sub execute {
my ($self, $opt, $args) = @_;
my $project = $self->app->project;
my $current = $self->app->version;
(my $suggested = $current) =~ s/^v((?:\d+\.)*)(\d+)-.*/"v$1" . ($2 + 1)/e;
my $version = prompt("Next version [$suggested]?") || $suggested;
unless ($self->app->build_all_targets($project, $version)) {
say STDERR "Incomplete bulid, aborting release";
return;
}
# TODO additional checks
my $token = $self->app->github_token();
( run in 1.158 second using v1.01-cache-2.11-cpan-6aa56a78535 )