Skip to content

Commit

Permalink
'writes' -> 'writable', order of arguments changed
Browse files Browse the repository at this point in the history
  • Loading branch information
sitaramc committed Mar 27, 2012
1 parent cc8b104 commit 2bec551
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Gitolite/Rc.pm
Expand Up @@ -94,7 +94,7 @@ $ENV{PATH} = "$ENV{GL_BINDIR}:$ENV{PATH}";
}

# these two are meant to help externally written commands (see
# src/commands/writes for an example)
# src/commands/writable for an example)
$ENV{GL_REPO_BASE} = $rc{GL_REPO_BASE};
$ENV{GL_ADMIN_BASE} = $rc{GL_ADMIN_BASE};

Expand Down Expand Up @@ -282,7 +282,7 @@ __DATA__
'info' => 1,
'desc' => 1,
'perms' => 1,
'writes' => 1,
'writable' => 1,
},
# comment out or uncomment as needed
Expand Down
7 changes: 3 additions & 4 deletions src/commands/writes → src/commands/writable
Expand Up @@ -6,7 +6,7 @@ use lib $ENV{GL_BINDIR};
use Gitolite::Easy;

=for usage
Usage: gitolite writes on|off <reponame>|@all
Usage: gitolite writable <reponame>|@all on|off
'on' enables, 'off' disables, writes (pushes) to the named repo or all repos.
Expand All @@ -16,11 +16,10 @@ from STDIN; this allows longer messages.
=cut

usage() if not @ARGV or @ARGV < 2 or $ARGV[0] eq '-h';

usage() if $ARGV[0] ne 'on' and $ARGV[0] ne 'off';
my $on = ( shift eq 'on' );
usage() if $ARGV[1] ne 'on' and $ARGV[1] ne 'off';

my $repo = shift;
my $on = ( shift eq 'on' );

if ( $repo eq '@all' ) {
die "you are not authorized\n" if $ENV{GL_USER} and not is_admin();
Expand Down
2 changes: 1 addition & 1 deletion t/glt
Expand Up @@ -14,7 +14,7 @@ my %extcmds = (
info => 1,
desc => 1,
perms => 1,
writes => 1,
writable => 1,
);

$ENV{G3T_USER} = $user;
Expand Down
12 changes: 6 additions & 6 deletions t/writes.t → t/writable.t
Expand Up @@ -8,7 +8,7 @@ use Gitolite::Test;
use Cwd;
my $workdir = getcwd();

# 'gitolite writes' command
# 'gitolite writable' command
# ----------------------------------------------------------------------

my $sf = ".gitolite.down";
Expand Down Expand Up @@ -48,7 +48,7 @@ try "
PUSH u2 master; ok;
# disable site with some message
gitolite writes off \@all testing site-wide disable; ok
gitolite writable \@all off testing site-wide disable; ok
# try push foo and see fail + message
cd ../foo; ok
Expand All @@ -67,7 +67,7 @@ try "
cd u4; ok
# enable site
gitolite writes on \@all; ok
gitolite writable \@all on; ok
# try same 3 again
Expand All @@ -88,7 +88,7 @@ try "
cd u6; ok
# disable just foo
gitolite writes off foo foo down
gitolite writable foo off foo down
# try push foo and see the message
cd ../foo; ok
Expand All @@ -101,8 +101,8 @@ try "
PUSH u2; ok; /master -> master/
# enable foo, disable bar/u2
gitolite writes on foo
gitolite writes off bar/u2 the bar is closed
gitolite writable foo on
gitolite writable bar/u2 off the bar is closed
# try both
cd ../foo; ok
Expand Down

0 comments on commit 2bec551

Please sign in to comment.