Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package Oyster::Deploy::Git; | ||
|
||
use Moose; | ||
use Git::Wrapper; | ||
use Error::Simple; | ||
|
||
use Data::Dumper; | ||
|
||
sub create { | ||
my $self = shift; | ||
my $location = shift; | ||
|
||
if( -f $location || -d $location ) { | ||
Error::Simple->throw("$location already exists"); | ||
} | ||
|
||
mkdir($location); | ||
my $git = Git::Wrapper->new($location); | ||
|
||
return 1; | ||
} | ||
|
||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/local/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More qw/no_plan/; | ||
use Test::Exception; | ||
|
||
use File::Temp qw/tempdir/; | ||
|
||
BEGIN { use_ok( 'Oyster::Deploy::Git' ); } | ||
|
||
my $tmpdir = tempdir(); | ||
|
||
my $deploy = new_ok 'Oyster::Deploy::Git'; | ||
|
||
#create | ||
is($deploy->create("${tmpdir}/testapp"), 1, 'Create returned okay'); | ||
|
||
ok((-d "${tmpdir}/testapp"), "App directory created"); | ||
|
||
throws_ok(sub {$deploy->create("${tmpdir}/testapp")}, 'Error::Simple', "Directory already exists"); |