App-Nopaste

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


1.007   2016-09-16 02:26:28Z
        - fix handling of filename option in the Gist command (Zakariyya
          Mughal, PR#13)

1.006   2016-05-24 02:55:20Z
        - fix failing tests with other locales, environment settings

1.005   2016-05-20 02:39:52Z
        - mark App::Nopaste::Service::Codepeek as deprecated in metadata
        - the Gist command also looks in ~/.github for credentials
        - many additional tests; thanks David J. Shultz!

1.004   2015-03-05 05:18:44Z
        - fix the Gist plugin to work with github's stricter validation
          (PR #11, Tatsuhiko Miyagawa)
        - removed +x permissions on files (RT#102361)
        - mark the Codepeek service as deprecated (RT#101823)

1.003   2015-01-03 20:52:17Z
        - re-release to fix problematic $VERSION declaration (RT#101095)

lib/App/Nopaste/Service/Gist.pm  view on Meta::CPAN


Then, export the resulting token as the the C<GITHUB_OAUTH_TOKEN> environment
variable.  This will grant gist rights to L<App::Nopaste> (or anything else
that Don't worry, you can revoke access rights anytime from the GitHub profile
settings.

Alternatively, you can export the C<GITHUB_USER> and C<GITHUB_PASSWORD>
environment variables, just like for the
L<gist|https://github.com/defunkt/gist> utility.

You can also simply store your credentials in plaintext in F<~/.github> as in:

    login bob
    password ilikeducks

That's it!

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=App-Nopaste>
(or L<bug-App-Nopaste@rt.cpan.org|mailto:bug-App-Nopaste@rt.cpan.org>).

t/004-03-gist.t  view on Meta::CPAN

use warnings;

use Test::More 0.88;
use Test::Deep;
use Test::Fatal;
use Path::Tiny;

use App::Nopaste::Service::Gist;

# clear these first to avoid interfering with tests -- and be sure we don't
# accidentally user's credentials into test results!
local $ENV{GITHUB_USER};
local $ENV{GITHUB_PASSWORD};
local $ENV{GITHUB_OAUTH_TOKEN};

ok(App::Nopaste::Service::Gist->available);
ok(!App::Nopaste::Service::Gist->forbid_in_default);

{
    local $ENV{GITHUB_OAUTH_TOKEN} = 'foo';
    cmp_deeply(
        [ App::Nopaste::Service::Gist->_get_auth() ],
        [ oauth_token => 'foo' ],
        'got OAuth token as credentials',
    );
}

{
    local $ENV{GITHUB_USER}     = 'perl';
    local $ENV{GITHUB_PASSWORD} = 'user';

    cmp_deeply(
        [ App::Nopaste::Service::Gist->_get_auth() ],
        [ username => 'perl', password => 'user' ],
        'got plaintext user, password as credentials',
    );
}

my $has_config_file = -f path('~', '.github');

SKIP:
{
    skip '~/.github exists; cannot test missing GITHUB_PASSWORD', 1 if $has_config_file;

    local $ENV{GITHUB_USER}     = 'perl';



( run in 0.398 second using v1.01-cache-2.11-cpan-4d50c553e7e )