Skip to content

Commit

Permalink
Initial creation of local repo
Browse files Browse the repository at this point in the history
  • Loading branch information
grim8634 committed Nov 20, 2010
1 parent 1d534f1 commit 4005646
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/Oyster/Deploy/Git.pm
@@ -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;
51 changes: 51 additions & 0 deletions lib/Oyster/Provision.pm
Expand Up @@ -17,3 +17,54 @@ sub BUILD {
}

1;

__END__
=head1 NAME
Oyster::Provision - Provision an Oyster
=head1 SYNOPSIS
my $server = Oyster::Provision->new(
name => 'Ostrica',
size => '256',
image => 'Meerkat',
pub_ssh => "$ENV{HOME}/.ssh/id_rsa.pub",
);
$server->create;
=head1 BACKENDS
By default, the L<Oyster::Provision::Rackspace> backend
will be used.
Each backend needs to accept at least the C<name>,
C<size>, C<image> and C<pub_ssh> parameters. The meaning
of these parameters may differ from one backend to another.
=head1 METHOS
Each backend usually implements the following C<required>
methods:
=over
=item create
Creates a new server by given name, if such server does
not exist.
Installs the required packages for the distribution
=item delete
Gets rid of the server instance
=item resize
Hopefully scales the server
=back
=cut
22 changes: 22 additions & 0 deletions t/Deploy/git.t
@@ -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");

0 comments on commit 4005646

Please sign in to comment.