App-gist

 view release on metacpan or  search on metacpan

bin/gist  view on Meta::CPAN

Create a private gist.

=item B<--web>, B<-w>

Only output the web url.

=back

=head1 CONFIGURATION

Configure git with your GitHub credentials:

    $ git config --global github.user LoginName
    $ git config --global github.password GitHubPassword

Alternatively you can install L<Config::Identity> and write your credentials
in the (optionally GPG-encrypted) C<~/.github> file as follows:

    login LoginName
    password GitHubpassword

(if only the login name is set, the password will be asked interactively)

=head1 AUTHOR

Alessandro Ghedini <alexbio@cpan.org>

lib/App/gist.pm  view on Meta::CPAN

BEGIN {
	package App::gist::Auth;
$App::gist::Auth::VERSION = '0.16';
use Moo::Role;
	use Pithub::Base;

	around _request_for => sub {
		my ($orig, $self, @args) = @_;
		my $req = $self -> $orig(@args);

		my ($login, $passwd) = App::gist::_get_credentials();

		$req -> headers -> remove_header('Authorization');
		$req -> headers -> authorization_basic($login, $passwd);

		return $req;
	};

	'Moo::Role' -> apply_roles_to_package(
		'Pithub::Base',
		'App::gist::Auth'

lib/App/gist.pm  view on Meta::CPAN

		gist_id => $id,
		data    => {
			description => $info -> content -> {'description'},
			files       => {
				$name => { content => $data }
			}
		}
	);
}

sub _get_credentials {
	my ($login, $pass, $token);

	my %identity = Config::Identity::GitHub -> load
		if try_load_class('Config::Identity::GitHub');

	if (%identity) {
		$login = $identity{'login'};
	} else {
		$login = `git config github.user`;  chomp $login;
	}



( run in 0.250 second using v1.01-cache-2.11-cpan-a5abf4f5562 )