App-GitHub-create
view release on metacpan or search on metacpan
lib/App/GitHub/create.pm view on Meta::CPAN
if ( $private and $public ) {
usage <<_END_;
github-create: Repository cannot be both private AND public
_END_
}
$public = $public ? 1 : 0;
eval {
my $owner = $login;
$owner = '<username>' unless defined $owner;
unless ( $dry_run ) {
my $response = $self->create(
login => $login, token => $token,
name => $name, description => $description, homepage => $homepage, public => $public,
);
print $response->as_string;
eval {
no warnings;
require JSON;
my $data = JSON->new->decode( $response->decoded_content );
$_ and $owner = $_ for $data->{repository}->{owner};
};
}
print <<_END_;
Repository $name created. To track it, run the following:
# git remote add origin git\@github.com:$owner/$name.git
# git push origin master
_END_
};
if ($@) {
usage <<_END_;
github-create: $@
_END_
}
}
# for my $option (keys %options) {
# next unless $options{$option};
# push @arguments, "values[has_$option]" => 'true';
# }
# --enable ... Enable wiki, issues, and/or the downloads page
# Can be a series of options separated by a comma:
#
# all Enable everything
# none Disable everything
# wiki Enable the wiki
# issues Enable issues
# downloads Enable downloads
# The default is 'none'
# my %options;
# my @enable = split m/\s*,\s*/, $enable;
# for ( @enable ) {
# s/^\s*//, s/\s*$//;
# next unless $_;
# if ( m/^none$/i ) { undef %options }
# elsif ( m/^all$/i ) { %options = qw/ wiki 1 issues 1 downloads 1 / }
# elsif ( m/^wiki$/i ) { $options{lc $_} = 1 }
# elsif ( m/^issues$/i ) { $options{lc $_} = 1 }
# elsif ( m/^downloads$/i ) { $options{lc $_} = 1 }
# else { usage <<_END_ }
#github-create: Unknown enable option: $_
#_END_
# }
1;
__END__
=pod
=head1 NAME
App::GitHub::create - Create a github repository from the commandline
=head1 VERSION
version 0.0012
=head1 SYNOPSIS
# Create the repository github:alice/xyzzy
github-create --login alice --token 42fe60... xyzzy
# Pulling login and token from $HOME/.github
github-create xyzzy
# With description and homepage
github-create xyzzy --description "The incredible Xyzzy" --homepage http://example/xyzzy
# Print out usage
github-create --help
=head1 DESCRIPTION
A simple tool for creating a new github repository
=head1 GitHub identity format ($HOME/.github or $HOME/.github-identity)
login <login>
token <token>
(Optionally GnuPG encrypted; see L<Config::Identity>)
=head1 SEE ALSO
L<App::GitHub::update>
L<Config::Identity>
=head1 AUTHOR
Robert Krimen <robertkrimen@gmail.com>
( run in 1.942 second using v1.01-cache-2.11-cpan-140bd7fdf52 )