forked from typester/net-github-upload-perl
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github-upload script to upload from command line. Added depende…
…ncies to Makefile.PL Signed-off-by: Daisuke Murase <typester@gmail.com>
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use Net::GitHub::Upload; | ||
use Pod::Usage; | ||
|
||
my($file, $repo) = @ARGV; | ||
|
||
unless ($file && $repo) { | ||
pod2usage(1); | ||
} | ||
|
||
unless (-e $file) { | ||
die "$file doesn't exist.\n"; | ||
} | ||
|
||
chomp(my $user = `git config github.user`); | ||
chomp(my $token = `git config github.token`); | ||
|
||
unless ($user && $token) { | ||
die "git config github.user and github.token are missing.\n"; | ||
} | ||
|
||
my $gh = Net::GitHub::Upload->new( | ||
login => $user, | ||
token => $token, | ||
); | ||
|
||
$gh->upload( | ||
repos => $repo, | ||
file => $file, | ||
); | ||
|
||
print "$file uploaded to $repo\n"; | ||
|
||
__END__ | ||
=head1 NAME | ||
github-upload - Uploads a file to GitHub repository | ||
=head1 SYNOPSIS | ||
github-upload filename repository | ||
github-upload remedie-1.0.tar.bz2 miyagawa/remedie | ||
=end |