1 package Oyster::Deploy::Git;
5 #use Git::Wrapper; # sorry fails tests!
11 /usr/bin/git reset --hard HEAD
12 dzil listdeps | xargs cpanm --local-lib=~/perl5
17 # This rather relies on being an account with permission to do this.
18 # Who does the script run as? Presumably the owner of the repo as git will
19 # use ssh-keys to get onto the server.
21 # Realistically that user needs to be put in /etc/sudoers
23 # user ALL=NOPASSWD: /etc/init.d/lighttpd
26 sudo /etc/init.d/lighttpd restart
33 if( -f $location || -d $location ) {
34 die("$location already exists");
38 #my $git = Git::Wrapper->new($location);
40 qx{cd $location ; git init};
42 open my $fh_post_receive, '>', "$location/.git/hooks/post-receive"
43 or die "Cannot write to " . "$location/.git/hooks/post-receive: $!";
44 print $fh_post_receive $post_receive;
45 close $fh_post_receive
46 or die "Cannot close " . "$location/.git/hooks/post-receive: $!";
48 open my $fh_post_update, '>', "$location/.git/hooks/post-update"
49 or die "Cannot write to " . "$location/.git/hooks/post-update: $!";
50 print $fh_post_update $post_update;
52 or die "Cannot close " . "$location/.git/hooks/post-update: $!";
54 chmod(0x755, ("$location/.git/hooks/post-receive", "$location/.git/hooks/post-update"));