App-gh

 view release on metacpan or  search on metacpan

inc/Module/Install.pm  view on Meta::CPAN

	# we shouldn't really depend on it. See RT #24194 for detail.
	# (Also, this module only supports Perl 5.6 and above).
	eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006;

	# If the script that is loading Module::Install is from the future,
	# then make will detect this and cause it to re-run over and over
	# again. This is bad. Rather than taking action to touch it (which
	# is unreliable on some platforms and requires write permissions)
	# for now we should catch this and refuse to run.
	if ( -f $0 ) {
		my $s = (stat($0))[9];

		# If the modification time is only slightly in the future,
		# sleep briefly to remove the problem.
		my $a = $s - time;
		if ( $a > 0 and $a < 5 ) { sleep 5 }

		# Too far in the future, throw an error.
		my $t = time;
		if ( $s > $t ) { die <<"END_DIE" }

lib/App/gh/Command/Issue/Comment.pm  view on Meta::CPAN

    die "Remote not found\n." unless $remote;
    my ( $user, $repo, $uri_type ) = parse_uri( $remote->{url} );

    my $gh_id = App::gh->config->github_id;
    my $gh_token = App::gh->config->github_token;
    unless( $gh_id && $gh_token ) {
        die "Github authtoken not found. Can not edit issue.\n";
    }

    my $f = File::Temp->new(SUFFIX => ".mkd");
    my $t = stat($f->filename)->mtime;
    system $ENV{EDITOR}, $f->filename;
    if ($t == stat($f->filename)->mtime) {
        info "No changes. Issue was not sent.";
        return;
    }

    open my $fh, '<', $f->filename;
    my $body = do { local $/; <$fh> };
    close $fh;

    if (length($body) == 0) {
        info "Message should have lines at least.";

lib/App/gh/Command/Issue/Edit.pm  view on Meta::CPAN


    my $f = File::Temp->new(SUFFIX => ".mkd");

    if ($number) {
        $data = App::gh->api->issue_get($user, $repo, $number);
        open my $fh, '>', $f->filename;
        printf $fh "%s\n%s", $data->{issue}->{title}, $data->{issue}->{body};
        close $fh;
    }

    my $t = stat($f->filename)->mtime;
    system $ENV{EDITOR}, $f->filename;
    if ($t == stat($f->filename)->mtime) {
        info "No changes. Issue was not sent.";
        return;
    }

    open my $fh, '<', $f->filename;
    my $content = do { local $/; <$fh> };
    close $fh;
    ($title, $body) = split("\n", $content, 2);
    chomp( $title );
    chomp( $body );

lib/App/gh/Command/Pullreq/Send.pm  view on Meta::CPAN


    my $local_repo = App::gh->git;
    open my $fh, '<', $local_repo->wc_path()."/.git/HEAD";
    my $ref = <$fh>;
    close $fh;
    chomp( $ref );

    my ($branch) = ( $ref =~ m{ref:\s\S+?/\S+?/(\S+)} );

    my $f = File::Temp->new(SUFFIX => ".md");
    my $t = stat($f->filename)->mtime;

    open $fh , ">" , $f->filename;
    print $fh "Title\n";
    print $fh "Body (markdown format)\n";
    close $fh;

    # launch editor
    system $ENV{EDITOR}, $f->filename;

    if ($t == stat($f->filename)->mtime) {
        info "No changes. Pull request was not sent.";
        return;
    }

    open $fh, '<', $f->filename;
    my $content = do { local $/; <$fh> };
    close $fh;
    my ($title, $body) = split("\n", $content, 2);
    chomp( $title );
    chomp( $body );



( run in 0.480 second using v1.01-cache-2.11-cpan-49f99fa48dc )