3 package Dist::Zilla::App::Command::provision;
5 $Dist::Zilla::App::Command::provision::VERSION = '0.1';
7 # ABSTRACT: release your dist to the CPAN
8 use Dist::Zilla::App -command;
12 sub abstract { 'provision a new Oyster VM' }
15 [ 'name=s' => 'the name of the VM to create' ],
19 my ($self, $opt, $arg) = @_;
21 my $zilla = $self->zilla;
24 or die "No name provided!";
25 my @config_files = ( './oyster.conf' ); # TODO make configurable
27 my $cfg = Config::Any->load_files({ files => \@config_files });
28 ($cfg) = values %{ $cfg->[0] }; # FIX with ::JFDI or similar
30 my $Provision = $cfg->{Provision} or die "No <Provision> section";
31 my $target = $Provision->{$name} or die "No section for <Provision> <$name>";
33 my $type = $target->{type} || 'EC2';
35 use Oyster::Provision;
36 my $server = Oyster::Provision->new(
40 pub_ssh => "$ENV{HOME}/.ssh/id_rsa.pub",
41 provision_backend => $type,
44 print "Instance $name created! ($server)\n";
54 Dist::Zilla::App::Command::provision - provision a new Oyster VM
68 =head1 COPYRIGHT AND LICENSE
70 This software is copyright (c) 2010 by CONTRIBUTORS
72 This is free software; you can redistribute it and/or modify it under
73 the same terms as the Perl 5 programming language system itself.