| 1 | package Enbld::Command::Install; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use 5.010001; | ||
| 7 | |||
| 8 | use parent qw/Enbld::Command/; | ||
| 9 | |||
| 10 | use Try::Lite; | ||
| 11 | |||
| 12 | require Enbld::App::Configuration; | ||
| 13 | require Enbld::Error; | ||
| 14 | require Enbld::Exception; | ||
| 15 | require Enbld::Message; | ||
| 16 | require Enbld::Target; | ||
| 17 | require Enbld::Logger; | ||
| 18 | |||
| 19 | sub do { | ||
| 20 | my $self = shift; | ||
| 21 | |||
| 22 | my $target_name = $self->validate_target_name( shift @{ $self->{argv} } ); | ||
| 23 | |||
| 24 | $self->setup; | ||
| 25 | |||
| 26 | my $config = Enbld::App::Configuration->search_config( $target_name ); | ||
| 27 | my $target = Enbld::Target->new( $target_name, $config ); | ||
| 28 | |||
| 29 | my $installed = try { | ||
| 30 | return $target->install; | ||
| 31 | } ( 'Enbld::Error' => sub { | ||
| 32 | Enbld::Message->alert( $@ ); | ||
| 33 | |||
| 34 | if ( $^O ne 'darwin' ) { | ||
| 35 | say "If you run Enbld at Linux or BSD, there is a possibility " . | ||
| 36 | "that the Software which depends is not installed."; | ||
| 37 | } | ||
| 38 | |||
| 39 | say "\nPlease check build logile:" . Enbld::Logger->logfile; | ||
| 40 | |||
| 41 | return; | ||
| 42 | } | ||
| 43 | ); | ||
| 44 | |||
| 45 | if ( $installed ) { | ||
| 46 | Enbld::App::Configuration->set_config( $installed ); | ||
| 47 | } | ||
| 48 | |||
| 49 | $self->teardown; | ||
| 50 | |||
| 51 | return $installed; | ||
| 52 | } | ||
| 53 | |||
| 54 | 1; |