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;
11 use Hash::Merge 'merge';
13 sub abstract { 'provision a new Oyster VM' }
16 [ 'name=s' => 'the name of the VM to create' ],
20 my ($self, $opt, $arg) = @_;
22 my $zilla = $self->zilla;
25 or die "No name provided!";
26 my @config_files = ( './oyster.conf' ); # TODO make configurable
28 my $cfg = Config::Any->load_files({ files => \@config_files, use_ext => 0 });
29 ($cfg) = values %{ $cfg->[0] }; # FIX with ::JFDI or similar
31 my $Provision = $cfg->{Provision} or die "No <Provision> section";
33 my @hashes = grep $_, $Provision->{Default}, $Provision->{$name}
34 or die "No section for <Provision> <$name>, and no <default>";
36 my %hash = @hashes > 1 ? %{ merge( @hashes ) } : $hashes[0];
38 $hash{provision_backend} = delete $hash{type} || 'Rackspace';
39 $hash{pub_ssh} ||= "$ENV{HOME}/.ssh/id_rsa.pub";
41 $hash{image} ||= 'meerkat'; # TODO, should this be determined on backend?
43 use Oyster::Provision;
44 my $server = Oyster::Provision->new(
49 print "Instance $name created! ($server)\n";
59 Dist::Zilla::App::Command::provision - provision a new Oyster VM
73 =head1 COPYRIGHT AND LICENSE
75 This software is copyright (c) 2010 by CONTRIBUTORS
77 This is free software; you can redistribute it and/or modify it under
78 the same terms as the Perl 5 programming language system itself.