| 1 | package Enbld::Definition::Nginx; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use parent qw/Enbld::Definition/; | ||
| 7 | |||
| 8 | use File::Spec; | ||
| 9 | |||
| 10 | sub initialize { | ||
| 11 | my $self = shift; | ||
| 12 | |||
| 13 | $self->SUPER::initialize; | ||
| 14 | |||
| 15 | $self->{defined}{ArchiveName} = 'nginx'; | ||
| 16 | $self->{defined}{WebSite} = 'http://nginx.org'; | ||
| 17 | $self->{defined}{VersionForm} = '1\.\d\.\d{1,2}'; | ||
| 18 | $self->{defined}{DownloadSite} = 'http://nginx.org/download/'; | ||
| 19 | |||
| 20 | $self->{defined}{AdditionalArgument}= \&set_argument; | ||
| 21 | |||
| 22 | $self->{defined}{CommandConfigure} = './configure'; | ||
| 23 | $self->{defined}{CommandTest} = ''; | ||
| 24 | |||
| 25 | return $self; | ||
| 26 | } | ||
| 27 | |||
| 28 | sub set_argument { | ||
| 29 | my $attributes = shift; | ||
| 30 | |||
| 31 | require Enbld::Definition; | ||
| 32 | my $pcre = Enbld::Definition->new( 'pcre' )->parse; | ||
| 33 | $pcre->add( 'VersionCondition', 'latest' ); | ||
| 34 | |||
| 35 | require Enbld::HTTP; | ||
| 36 | require Enbld::Home; | ||
| 37 | my $path = File::Spec->catfile( Enbld::Home->dists, $pcre->Filename ); | ||
| 38 | my $archivefile = Enbld::HTTP->download_archivefile( $pcre->URL, $path ); | ||
| 39 | my $build = $archivefile->extract( Enbld::Home->build ); | ||
| 40 | |||
| 41 | my $argument = "--with-http_ssl_module --with-pcre=" . $build; | ||
| 42 | |||
| 43 | require Enbld::Feature; | ||
| 44 | if ( ! Enbld::Feature->is_deploy_mode ) { | ||
| 45 | $argument .= ' --user=nginx'; | ||
| 46 | $argument .= ' --group=nginx'; | ||
| 47 | $argument .= ' --pid-path=' . | ||
| 48 | File::Spec->catfile( Enbld::Home->log, 'nginx.pid' ); | ||
| 49 | $argument .= ' --error-log-path=' . | ||
| 50 | File::Spec->catfile( Enbld::Home->log, 'error.log' ); | ||
| 51 | $argument .= ' --http-log-path=' . | ||
| 52 | File::Spec->catfile( Enbld::Home->log, 'access.log' ); | ||
| 53 | $argument .= ' --conf-path=' . | ||
| 54 | File::Spec->catfile( Enbld::Home->conf, 'nginx.conf' ); | ||
| 55 | } | ||
| 56 | |||
| 57 | return $argument; | ||
| 58 | } | ||
| 59 | |||
| 60 | 1; | ||
| 61 | |||
| 62 | =pod | ||
| 63 | |||
| 64 | =head1 NAME | ||
| 65 | |||
| 66 | Enbld::Definition::Nginx - definition module for nginx | ||
| 67 | |||
| 68 | =head1 SEE ALSO | ||
| 69 | |||
| 70 | L<nginx|http://nginx.org> | ||
| 71 | |||
| 72 | L<Enbld::Definition> | ||
| 73 | |||
| 74 | =head1 COPYRIGHT | ||
| 75 | |||
| 76 | copyright 2013- Magnolia C<< <magnolia.k@me.com> >>. | ||
| 77 | |||
| 78 | =head1 LICENSE | ||
| 79 | |||
| 80 | This is free software; you can redistribute it and/or modify it under | ||
| 81 | the same terms as the Perl 5 programming language system itself. | ||
| 82 | |||
| 83 | =cut |