App-gh

 view release on metacpan or  search on metacpan

README.mkd  view on Meta::CPAN


By specifing `--into` option, you can clone these 
repositories into a specific directory, for example:

```bash
    $ gh all facebook owner --into path/to/facebook

    $ gh all perl6 --into perl6-stuff
```

To prompt before cloning each repository:

```bash
    $ gh all perl6 --prompt
```

To also fetch tags, you can specify `--tags` option:

```bash
    $ gh all facebook --tags
```

You can also specify a prefix to each repo:

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

        }
        elsif ( $arg =~ /^--test(?:only)?$/ ) {
            $TestOnly = 1;
        }
        elsif ( $arg =~ /^--all(?:deps)?$/ ) {
            $AllDeps = 1;
        }
    }
}

# overrides MakeMaker's prompt() to automatically accept the default choice
sub _prompt {
    goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;

    my ( $prompt, $default ) = @_;
    my $y = ( $default =~ /^[Yy]/ );

    print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
    print "$default\n";
    return $default;
}

# the workhorse
sub import {
    my $class = shift;
    my @args  = @_ or return;
    my $core_all;

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

              map  {
                ref($_)
                  ? ( ( ref($_) eq 'HASH' ) ? keys(%$_) : @{$_} )
                  : ''
              }
              map { +{@args}->{$_} }
              grep { /^[^\-]/ or /^-core$/i } keys %{ +{@args} }
        )[0]
    );

    # We want to know if we're under CPAN early to avoid prompting, but
    # if we aren't going to try and install anything anyway then skip the
    # check entirely since we don't want to have to load (and configure)
    # an old CPAN just for a cosmetic message

    $UnderCPAN = _check_lock(1) unless $SkipInstall || $InstallDepsTarget;

    while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
        my ( @required, @tests, @skiptests );
        my $default  = 1;
        my $conflict = 0;

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


        my $mandatory = ( $feature eq '-core' or $core_all );

        if (
            !$SkipInstall
            and (
                $CheckOnly
                or ($mandatory and $UnderCPAN)
                or $AllDeps
                or $InstallDepsTarget
                or _prompt(
                    qq{==> Auto-install the }
                      . ( @required / 2 )
                      . ( $mandatory ? ' mandatory' : ' optional' )
                      . qq{ module(s) from CPAN?},
                    $default ? 'y' : 'n',
                ) =~ /^[Yy]/
            )
          )
        {
            push( @Missing, @required );
            $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
        }

        elsif ( !$SkipInstall
            and $default
            and $mandatory
            and
            _prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
            =~ /^[Nn]/ )
        {
            push( @Missing, @required );
            $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
        }

        else {
            $DisabledTests{$_} = 1 for map { glob($_) } @tests;
        }
    }

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

}

sub _update_to {
    my $class = __PACKAGE__;
    my $ver   = shift;

    return
      if _version_cmp( _version_of($class), $ver ) >= 0;  # no need to upgrade

    if (
        _prompt( "==> A newer version of $class ($ver) is required. Install?",
            'y' ) =~ /^[Nn]/
      )
    {
        die "*** Please install $class $ver manually.\n";
    }

    print << ".";
*** Trying to fetch it from CPAN...
.

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


*** Cannot bootstrap myself. :-( Installation terminated.
.
}

# check if we're connected to some host, using inet_aton
sub _connected_to {
    my $site = shift;

    return (
        ( _load('Socket') and Socket::inet_aton($site) ) or _prompt(
            qq(
*** Your host cannot resolve the domain name '$site', which
    probably means the Internet connections are unavailable.
==> Should we try to install the required module(s) anyway?), 'n'
          ) =~ /^[Yy]/
    );
}

# check if a directory is writable; may create it on demand
sub _can_write {

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

    mkdir( $path, 0755 ) unless -e $path;

    return 1 if -w $path;

    print << ".";
*** You are not allowed to write to the directory '$path';
    the installation may fail due to insufficient permissions.
.

    if (
        eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
            qq(
==> Should we try to re-execute the autoinstall process with 'sudo'?),
            ((-t STDIN) ? 'y' : 'n')
        ) =~ /^[Yy]/
      )
    {

        # try to bootstrap ourselves from sudo
        print << ".";
*** Trying to re-execute the autoinstall process with 'sudo'...

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


        return
          unless system( 'sudo', $^X, $0, "--config=$config",
            "--installdeps=$missing" );

        print << ".";
*** The 'sudo' command exited with error!  Resuming...
.
    }

    return _prompt(
        qq(
==> Should we try to install the required module(s) anyway?), 'n'
    ) =~ /^[Yy]/;
}

# load a module and return the version it reports
sub _load {
    my $mod  = pop; # method/function doesn't matter
    my $file = $mod;
    $file =~ s|::|/|g;

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

BEGIN {
	$VERSION = '1.06';
	@ISA     = 'Module::Install::Base';
	$ISCORE  = 1;
}

sub Makefile { $_[0] }

my %seen = ();

sub prompt {
	shift;

	# Infinite loop protection
	my @c = caller();
	if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
		die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
	}

	# In automated testing or non-interactive session, always use defaults
	if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) {
		local $ENV{PERL_MM_USE_DEFAULT} = 1;
		goto &ExtUtils::MakeMaker::prompt;
	} else {
		goto &ExtUtils::MakeMaker::prompt;
	}
}

# Store a cleaned up version of the MakeMaker version,
# since we need to behave differently in a variety of
# ways based on the MM version.
my $makemaker = eval $ExtUtils::MakeMaker::VERSION;

# If we are passed a param, do a "newer than" comparison.
# Otherwise, just return the MakeMaker version.

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

    generate_repo_uri 
    run_git_fetch
    build_git_clone_command
    dialog_yes_default
);
use Scope::Guard qw(guard);
use Cwd ();

sub options { (
        "verbose"       => "verbose",
        "prompt"        => "prompt",
        "into=s"        => "into",
        "exclude=s@"    => "exclude",
        "s|skip-exists" => "skip_exists",

        "ssh"    => "protocol_ssh",    # git@github.com:c9s/repo.git
        "http"   => "protocol_http",  # http://github.com/c9s/repo.git
        "https"  => "protocol_https",         # https://github.com/c9s/repo.git
        "git|ro" => "protocol_git",         # git://github.com/c9s/repo.git


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

                run_git_fetch {
                    all => 1, 
                    quiet => $self->{quiet},
                    tags => $self->{tags},
                };
                chdir($into);
                next;
            }
        }

        if( $self->{prompt} ) {
            next unless dialog_yes_default "Clong " . $repo->{name} . ' ?';
        }

        info sprintf "%s Cloning %s (%d/%d) ...", 
            $progress->(),
            $repo->{full_name},
            $repo->{watchers},
            $repo->{forks};
        my $cmd = join " ",@command;
        qx($cmd);

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


Once you have all repos cloned, to update them, you only need to run all
command again:

    $ gh all c9s

=head1 OPTIONS

Genernal Options:

    --prompt
        prompt for each cloning repo.

    --into {path}
        clone repos into a {path}.

    --skip-exists, -s
        skip existed repos.

    --verbose
        verbose output.

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


    print "=========== Current Change Status ===========\n";
    system( qq(git status) );

    print "\n";
    print "=========== GH Commit Interface ===========\n";
    print "diff(d). status(s). status with untracked files (ss).\n";
    print "commit(c). quit(q).\n";

    my $term = Term::ReadLine->new('Simple');
    my $prompt = "Diff(d), Status(s/ss), Commit(c), Quit(q): ";

    my $OUT = $term->OUT || \*STDOUT;
    my $res;
    while ( defined ($res = $term->readline($prompt)) ) {
        chomp($res);

        $res =~ s{^\s*(\S*)\s*$}{$1};

        if ( $res =~ /^d/ ) {
            system( qq(git diff --color=auto) );
        }
        elsif( $res =~ /^ss$/ ) {
            system( qq(git status -unormal) );
        }

lib/App/gh/Git.pm  view on Meta::CPAN

	my $use_color = $self->command_oneline('config', '--get-colorbool',
					       $var, $stdout_to_tty);
	return ($use_color eq 'true');
}

=item get_color ( SLOT, COLOR )

Finds color for SLOT from the configuration, while defaulting to COLOR,
and returns the ANSI color escape sequence:

	print $repo->get_color("color.interactive.prompt", "underline blue white");
	print "some text";
	print $repo->get_color("", "normal");

=cut

sub get_color {
	my ($self, $slot, $default) = @_;
	my $color = $self->command_oneline('config', '--get-color', $slot, $default);
	if (!defined $color) {
		$color = "";



( run in 1.715 second using v1.01-cache-2.11-cpan-6aa56a78535 )