Changeset 12463 for lang/perl/Punc
- Timestamp:
- 05/26/08 22:51:44 (6 months ago)
- Location:
- lang/perl/Punc/trunk
- Files:
-
- 7 modified
-
bin/punc (modified) (1 diff)
-
lib/Punc.pm (modified) (1 diff)
-
lib/Punc/Client.pm (modified) (2 diffs)
-
lib/Punc/Client/Request.pm (modified) (1 diff)
-
lib/Punc/Hosts/File.pm (modified) (1 diff)
-
lib/Punc/Master/Daemon.pm (modified) (3 diffs)
-
lib/Punc/Slave/Module/Service.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Punc/trunk/bin/punc
r11518 r12463 15 15 my $options = get_options(); 16 16 17 my $punc = Punc::Client->new( $target);17 my $punc = Punc::Client->new( target => $target ); 18 18 19 19 my $results = $punc->$module->$method($options); -
lang/perl/Punc/trunk/lib/Punc.pm
r11803 r12463 100 100 101 101 use Punc::Client; 102 my $punc = Punc::Client->new( '*');102 my $punc = Punc::Client->new( target => '*' ); 103 103 my $res = $punc->service->status('httpd'); 104 104 -
lang/perl/Punc/trunk/lib/Punc/Client.pm
r12217 r12463 2 2 3 3 use Moose; 4 use Moose::Util::TypeConstraints; 4 5 our $AUTOLOAD; 5 6 use Punc::ConfigLoader; … … 8 9 use FindBin; 9 10 10 has 'hosts' => ( is => 'rw', isa => 'ArrayRef' );11 11 has 'conf' => ( is => 'rw', isa => 'HashRef' ); 12 12 13 sub new { 14 my ( $class, $target ) = @_; 13 ### TODO: confdir のデフォルト値を変更 14 has 'conf_dir' => ( 15 is => 'rw', 16 isa => 'Str', 17 default => "$FindBin::Bin/../etc", 18 ); 15 19 16 $target =~ s/\*/\.\*/g; 20 has 'conf_file' => ( 21 is => 'rw', 22 isa => 'Str', 23 default => sub { File::Spec->catfile(shift->conf_dir, 'punc.yaml') }, 24 lazy => 1, 25 ); 17 26 18 ### TODO: confdir のデフォルト値を変更 19 my $confdir = "$FindBin::Bin/../etc"; 20 my $yaml = File::Spec->catfile($confdir, 'punc.yaml'); 21 my $conf = -f $yaml ? Punc::ConfigLoader->new->load($yaml) : {}; 22 $conf->{confdir} = $confdir; 27 has 'conf' => ( 28 is => 'rw', 29 isa => 'HashRef', 30 default => sub { 31 my $conf_file = shift->conf_file; 32 -f $conf_file ? Punc::ConfigLoader->new->load($conf_file) : {}; 33 }, 34 lazy => 1, 35 ); 23 36 24 my $hosts_class = ucfirst $conf->{hosts_class} || 'File'; 37 coerce 'Str' 38 => from 'Str' 39 => via { s/\*/\.\*/g }; 40 41 has 'target' => ( 42 is => 'rw', 43 isa => 'Str', 44 default => '.*', 45 coerce => 1, 46 ); 47 48 sub hosts { 49 my $self = shift; 50 51 $self->conf->{conf_dir} = $self->conf_dir unless $self->conf->{conf_dir}; 52 53 my $hosts_class = ucfirst $self->conf->{hosts_class} || 'File'; 25 54 $hosts_class = "Punc::Hosts::$hosts_class"; 26 55 $hosts_class->require; 27 my $hosts = $hosts_class->get_hosts({ target => $target, conf => $conf });28 56 29 bless { 30 hosts => $hosts, 31 conf => $conf, 32 }, $class; 57 my $hosts = $hosts_class->get_hosts({ 58 target => $self->target, 59 conf => $self->conf, 60 }); 61 62 return $hosts; 33 63 } 34 64 -
lang/perl/Punc/trunk/lib/Punc/Client/Request.pm
r11803 r12463 26 26 my ( $self, $args ) = @_; 27 27 28 my $confdir = $self->conf->{conf dir};28 my $confdir = $self->conf->{conf_dir}; 29 29 30 30 $ENV{HTTPS_VERSION} = 3; -
lang/perl/Punc/trunk/lib/Punc/Hosts/File.pm
r11518 r12463 10 10 my ( $class, $args ) = @_; 11 11 12 my $confdir = $args->{conf}->{conf dir};12 my $confdir = $args->{conf}->{conf_dir}; 13 13 my $certdir = File::Spec->catdir($confdir, 'ssl', 'certs'); 14 14 my @files = glob("$certdir/*"); -
lang/perl/Punc/trunk/lib/Punc/Master/Daemon.pm
r12347 r12463 2 2 3 3 use Moose; 4 use base qw( Punc::Daemon );5 4 use File::Spec; 6 5 use File::Path; … … 15 14 is => 'rw', 16 15 isa => 'Punc::Master::CA', 17 default => sub { Punc::Master::CA->new }, 16 default => sub { 17 Punc::Master::CA->new({ 18 ssldir => File::Spec->catdir(shift->confdir, 'ssl'), 19 }); 20 }, 21 lazy => 1, 18 22 ); 19 23 … … 34 38 before 'run' => sub { 35 39 my $self = shift; 36 37 $self->ca(38 Punc::Master::CA->new({39 ssldir => File::Spec->catdir($self->confdir, 'ssl'),40 })41 );42 43 40 $self->_find_or_create_ca_cert($self->context); 44 41 }; -
lang/perl/Punc/trunk/lib/Punc/Slave/Module/Service.pm
r11196 r12463 22 22 23 23 # with Punc::Client module 24 my $punc = Punc::Client->new( $target);24 my $punc = Punc::Client->new( target => $target ); 25 25 my $res = $punc->service->status({ service => 'httpd' }); 26 26
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)