Skip to content

Commit

Permalink
Added github-upload script to upload from command line. Added depende…
Browse files Browse the repository at this point in the history
…ncies to Makefile.PL

Signed-off-by: Daisuke Murase <typester@gmail.com>
  • Loading branch information
miyagawa authored and typester committed Jun 13, 2009
1 parent 04bcffe commit e7e4cb8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile.PL
Expand Up @@ -2,6 +2,15 @@ use inc::Module::Install;
name 'Net-GitHub-Upload';
all_from 'lib/Net/GitHub/Upload.pm';

requires 'URI';
requires 'LWP::UserAgent';
requires 'Web::Scraper';
requires 'Path::Class';
requires 'XML::Simple';
requires 'Pod::Usage';

install_script 'scripts/github-upload';

test_requires 'Test::More';
use_test_base;
auto_include;
Expand Down
46 changes: 46 additions & 0 deletions scripts/github-upload
@@ -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

0 comments on commit e7e4cb8

Please sign in to comment.