Wednesday, April 29, 2009

new DayDayUp

inspired by jrock's Multimethods and Unshortening URLs with Modern Perl, I decided to rewrite my DayDayUp CPAN module.

it's really very cool to write code with KiokuDB and MooseX::Declare. less code. more focus on real.
I'm planing to write more, but it's for now.

even it fails on Win32, it's still worth to try. :)
Enjoy
Tuesday, April 28, 2009

planet you can't miss today

Tuesday, April 21, 2009

CPAN updates

I spent lots of time to write CPAN module in past two days. it's not so fun but enjoyable.

App::GitHub - 8 dists 3 days.
Dist::Zilla::Plugin::MetaResources - DEPERCATED, it will be supported in Dist::Zilla core.
Dist::Zilla::Plugin::Repository
Net::GitHub - also 8 dists 3 days.

To write a CPAN module is really not so hard. please go on and enjoy it.

Thanks.

Labels:

Monday, April 20, 2009

App::GitHub

well, App::GitHub is a command line tool wrapped by Net::GitHub.

for a brief view:
$> github.pl

Welcome to GitHub Command Tools! (Ver: 0.04)
Type '?' or 'h' for help.

github> ?
command argument description
repo :user :repo set owner/repo, eg: 'fayland perl-app-github'
login :login :token authenticated as :login
loadcfg authed by git config --global github.user|token
?,h help
q,exit,quit exit

Repos
rshow more in-depth information for the :repo in repo
rlist list out all the repositories for the :user in repo
rsearch WORD Search Repositories
watch watch repositories (authentication required)
unwatch unwatch repositories (authentication required)
fork fork a repository (authentication required)
create create a new repository (authentication required)
delete delete a repository (authentication required)
set_private set a public repo private (authentication required)
set_public set a private repo public (authentication required)
network see all the forks of the repo
tags tags on the repo
branches list of remote branches

Issues
ilist open|closed see a list of issues for a project
iview :number get data on an individual issue by number
iopen open a new issue (authentication required)
iclose :number close an issue (authentication required)
ireopen :number reopen an issue (authentication required)
iedit :number edit an issue (authentication required)
ilabel add|remove :num :label
add/remove a label (authentication required)

File/Path related
cd PATH chdir to PATH

Others
rshow :user :repo more in-depth information for a repository
rlist :user list out all the repositories for a user

github> loadcfg

github> repo fayland perl-app-github

fayland/perl-app-github> rshow
{
"owner" : "fayland",
"private" : false,
"name" : "perl-app-github",
"description" : "App::GitHub CPAN module",
"homepage" : "",
"watchers" : 2,
"forks" : 0,
"fork" : false,
"url" : "http://github.com/fayland/perl-app-github"
}

fayland/perl-app-github> repo fayland sandbox2

fayland/sandbox2> ilist
[
{
"number" : 1,
"position" : 1,
"state" : "open",
"body" : "Test Issue body.",
"created_at" : "2009/04/19 06:08:30 -0700",
"updated_at" : "2009/04/19 06:09:17 -0700",
"user" : "fayland",
"title" : "Test Issue",
"votes" : 0
},
{
"number" : 2,
"position" : 2,
"state" : "open",
"body" : "new test 3\nnew test 2",
"created_at" : "2009/04/19 18:44:49 -0700",
"updated_at" : "2009/04/19 18:50:44 -0700",
"user" : "fayland",
"title" : "new test 2",
"votes" : 0
},
{
"number" : 3,
"position" : 3,
"state" : "open",
"body" : "s",
"created_at" : "2009/04/19 18:51:17 -0700",
"updated_at" : "2009/04/19 18:51:31 -0700",
"user" : "fayland",
"title" : "sssssssss",
"votes" : 0
}
]

fayland/sandbox2> q

for now, there are ONLY repos and issue related command. but I would add more in next few days.

Thanks and Enjoy.

Labels:

Sunday, April 19, 2009

Net::GitHub 0.06

github just released its V2 API version days ago, I spent some hours to update the Net::GitHub.

it's really not a fun to both support V1 and V2 on the same time, I mean some code like follows:
use Net::GitHub;
my $g2 = Net::GitHub->new( version => 2 ); # use Net::GitHub::V2
my $g2 = Net::GitHub->new( version => 1 ); # use Net::GitHub::V1

after a nice sleep, I come out a solution like:
package Net::GitHub;

use Moose;

our $VERSION = '0.06';
our $AUTHORITY = 'cpan:FAYLAND';

sub new {
my $class = shift;
my $params = $class->BUILDARGS(@_);

my $obj;
if ( $params->{version} == 1 ) {
require Net::GitHub::V1;
$obj = Net::GitHub::V1->new($params);
} else {
require Net::GitHub::V2;
$obj = Net::GitHub::V2->new($params);
}

return $class->meta->new_object(
__INSTANCE__ => $obj,
@_,
);
}

no Moose;
__PACKAGE__->meta->make_immutable;

1;

maybe there is a better way, but it works at least for now.

Thanks and enjoy.

Labels: ,

Sunday, April 05, 2009

Dist::Zilla::Plugin::PerlTidy

I just uploaded the Dist-Zilla-Plugin-PerlTidy to CPAN today.

Dist::Zilla is a distribution builder. with it, you can write less, maintain less files. which means less bugs.
for more information, you can check the slides: http://www.slideshare.net/rjbs/distzilla-presentation

Dist-Zilla-Plugin-PerlTidy contains two parts.
one is the App Command, Dist::Zilla::App::Command::perltidy, which let you perltidy your real code.
the other one is the Plugin, Dist::Zilla::Plugin::PerlTidy. it doesn't affect your working code, it just perltidy the code for release (which means included in the tar.gz)

the code is simple, but it's useful.

Have fun!

Labels: ,