Permalink
Browse files

Added github-upload script to upload from command line. Added depende…

…ncies to Makefile.PL
  • Loading branch information...
1 parent ef5f402 commit 8df50ef7442851cf46c8ff1f68c36471e1abd1dc @miyagawa committed Jun 12, 2009
Showing with 55 additions and 0 deletions.
  1. +9 −0 Makefile.PL
  2. +46 −0 scripts/github-upload
View
@@ -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;
View
@@ -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 8df50ef

Please sign in to comment.