Changeset 11749 for lang/perl/Punc/trunk
- Timestamp:
- 05/17/08 17:20:45 (6 months ago)
- Location:
- lang/perl/Punc/trunk
- Files:
-
- 19 modified
-
Makefile.PL (modified) (1 diff)
-
lib/Punc.pm (modified) (3 diffs)
-
lib/Punc/Client.pm (modified) (3 diffs)
-
lib/Punc/Client/Request.pm (modified) (1 diff)
-
lib/Punc/Client/Response.pm (modified) (1 diff)
-
lib/Punc/Client/Result.pm (modified) (1 diff)
-
lib/Punc/ConfigLoader.pm (modified) (1 diff)
-
lib/Punc/Daemon.pm (modified) (2 diffs)
-
lib/Punc/Hosts.pm (modified) (1 diff)
-
lib/Punc/Master/CA.pm (modified) (4 diffs)
-
lib/Punc/Master/Daemon.pm (modified) (2 diffs)
-
lib/Punc/Slave/Daemon.pm (modified) (2 diffs)
-
lib/Punc/Slave/Module/File.pm (modified) (1 diff)
-
lib/Punc/Slave/Module/Punc.pm (modified) (2 diffs)
-
lib/Punc/Slave/Module/Service/Debian.pm (modified) (1 diff)
-
lib/Punc/Slave/Module/Service/RedHat.pm (modified) (1 diff)
-
t/00_compile.t (modified) (1 diff)
-
t/97_podspell.t (modified) (1 diff)
-
t/98_perlcritic.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Punc/trunk/Makefile.PL
r11734 r11749 24 24 /); 25 25 26 build_requires 'Test::More'; 26 build_requires $_ for (qw/ 27 Test::More 28 File::Temp 29 /); 30 27 31 use_test_base; 28 32 auto_include; -
lang/perl/Punc/trunk/lib/Punc.pm
r11215 r11749 1 1 package Punc; 2 2 3 use strict;4 use warnings;5 3 our $VERSION = '0.01'; 6 7 4 use Pfacter; 8 5 use UNIVERSAL::require; 6 use Moose; 7 use MooseX::ClassAttribute; 9 8 10 my $context; 11 sub context { 12 $context = $_[1] if $_[1]; 13 return $context; 14 } 9 class_has context => ( 10 is => 'rw', 11 isa => 'Punc', 12 lazy => 1, 13 default => sub { Punc->new }, 14 ); 15 15 16 sub new{17 my $ class= shift;18 my $self = bless {}, $class;19 $self-> context($self);16 sub logger { 17 my $self = shift; 18 require Punc::Logger::StdErr; 19 $self->{logger} ||= 'Punc::Logger::StdErr'; 20 20 } 21 21 … … 43 43 chomp $pfact; 44 44 return $pfact; 45 }46 47 sub logger {48 my $self = shift;49 require Punc::Logger::StdErr;50 $self->{logger} ||= 'Punc::Logger::StdErr';51 45 } 52 46 … … 91 85 # ./bin/puncd 92 86 93 puncmasterd とは別ホスト上で動かす場合、./etc/puncd.yaml の puncmaster_host を適宜変更してから puncd を起動してください。87 puncmasterd とは別ホスト上で動かす場合、./etc/puncd.yaml の puncmaster_host を適宜変更してから puncd を起動してください。 94 88 95 89 =head2 puncmaster-ca コマンドによる証明書への署名 -
lang/perl/Punc/trunk/lib/Punc/Client.pm
r11152 r11749 1 1 package Punc::Client; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 our $VERSION = '0.01'; 6 5 our $AUTOLOAD; … … 9 8 use UNIVERSAL::require; 10 9 use FindBin; 10 11 has 'hosts' => ( is => 'rw', isa => 'ArrayRef' ); 12 has 'conf' => ( is => 'rw', isa => 'HashRef' ); 11 13 12 14 sub new { … … 46 48 47 49 1; 48 __END__49 50 =encoding utf851 52 =head1 NAME53 54 Punc -55 56 =head1 SYNOPSIS57 58 use Punc;59 60 =head1 DESCRIPTION61 62 Punc is63 64 =head1 AUTHOR65 66 Gosuke Miyashita E<lt>gosukenator@gmail.comE<gt>67 68 =head1 SEE ALSO69 70 =head1 REPOSITORY71 72 svn co http://svn.coderepos.org/share/lang/perl/Punc/trunk Punc73 74 Punc is Subversion repository is hosted at L<http://coderepos.org/share/>.75 patches and collaborators are welcome.76 77 =head1 LICENSE78 79 This library is free software; you can redistribute it and/or modify80 it under the same terms as Perl itself.81 82 =cut -
lang/perl/Punc/trunk/lib/Punc/Client/Request.pm
r11181 r11749 1 1 package Punc::Client::Request; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 use JSON; 6 5 use JSON::RPC::Client; -
lang/perl/Punc/trunk/lib/Punc/Client/Response.pm
r11518 r11749 1 1 package Punc::Client::Response; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 use Punc::Client::Result; 6 5 7 sub new { 8 my $self = { 9 index => 0, 10 results => [],11 };12 bless $self, shift;13 } 6 has 'index' => ( isa => 'Int', is => 'rw', default => 0 ); 7 8 has 'results' => ( 9 isa => 'ArrayRef[Punc::Client::Result]', 10 is => 'rw', 11 default => sub { [] }, 12 ); 14 13 15 14 sub add { 16 15 my ( $self, $args ) = @_; 17 push @{$self-> {results}}, Punc::Client::Result->new($args);16 push @{$self->results}, Punc::Client::Result->new($args); 18 17 } 19 18 20 19 sub next { 21 20 my $self = shift; 22 return $self->{results}->[ $self->{index}++ ]; 21 my $current = $self->results->[ $self->index ]; 22 $self->index( $self->index + 1 ); 23 return $current; 23 24 } 24 25 -
lang/perl/Punc/trunk/lib/Punc/Client/Result.pm
r11726 r11749 1 1 package Punc::Client::Result; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 our $AUTOLOAD; 6 5 7 sub new { 8 my ( $class, $args ) = @_; 9 bless $args, $class; 6 has 'response' => ( is => 'rw' ); 7 8 sub result { 9 shift->{response}->{result}; 10 } 11 12 sub error { 13 shift->{response}->{error}; 10 14 } 11 15 12 16 sub as_hash { 13 17 my $self = shift; 14 my %hash = %$self; 18 my %hash = %$self; 15 19 return \%hash; 16 }17 18 sub result {19 my $self = shift;20 return $self->{response}->{result};21 }22 23 sub error {24 my $self = shift;25 return $self->{response}->{error};26 20 } 27 21 -
lang/perl/Punc/trunk/lib/Punc/ConfigLoader.pm
r11215 r11749 1 1 package Punc::ConfigLoader; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 use YAML; 6 7 sub new {8 my $class = shift;9 bless {}, $class;10 }11 5 12 6 sub load { -
lang/perl/Punc/trunk/lib/Punc/Daemon.pm
r11215 r11749 1 1 package Punc::Daemon; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 6 5 use HTTP::Daemon::SSL; … … 61 60 } 62 61 62 package Punc::Daemon::Role; 63 64 use Moose::Role; 65 66 requires 'handle_request'; 67 63 68 1; -
lang/perl/Punc/trunk/lib/Punc/Hosts.pm
r11215 r11749 7 7 use Moose::Role; 8 8 9 require 'get_hosts';9 requires 'get_hosts'; 10 10 11 11 1; -
lang/perl/Punc/trunk/lib/Punc/Master/CA.pm
r11518 r11749 1 1 package Punc::Master::CA; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 use File::Spec; 6 5 use File::Path; 6 7 has 'ssldir' => ( is => 'rw', isa => 'Str' ); 8 has 'csrdir' => ( is => 'rw', isa => 'Str' ); 9 has 'certdir' => ( is => 'rw', isa => 'Str' ); 10 has 'cadir' => ( is => 'rw', isa => 'Str' ); 7 11 8 12 sub new { … … 29 33 my $hostname = $self->get_hostname_from_csr($csr); 30 34 31 my $csrdir = $self-> {csrdir};35 my $csrdir = $self->csrdir; 32 36 mkpath($csrdir) unless -f $csrdir; 33 37 … … 41 45 my ( $self, $csr ) = @_; 42 46 my $hostname = $self->get_hostname_from_csr($csr); 43 return -f File::Spec->catfile($self-> {certdir}, "${hostname}.cert");47 return -f File::Spec->catfile($self->certdir, "${hostname}.cert"); 44 48 } 45 49 46 50 sub sign { 47 51 my ( $self, $hostname ) = @_; 48 my $cakey = File::Spec->catfile($self->{cadir}, 'ca.key'); 49 my $cacert = File::Spec->catfile($self->{cadir}, 'ca.cert'); 50 my $caserial = File::Spec->catfile($self->{cadir}, 'ca.srl'); 51 52 my $certdir = $self->{certdir}; 52 my $cakey = File::Spec->catfile($self->cadir, 'ca.key'); 53 my $cacert = File::Spec->catfile($self->cadir, 'ca.cert'); 54 my $caserial = File::Spec->catfile($self->cadir, 'ca.srl'); 55 my $certdir = $self->certdir; 53 56 mkpath($certdir) unless -f $certdir; 54 57 my $cert = File::Spec->catfile($certdir, "${hostname}.cert"); 55 58 56 my $csr = File::Spec->catfile($self-> {csrdir}, "${hostname}.csr");59 my $csr = File::Spec->catfile($self->csrdir, "${hostname}.csr"); 57 60 die "no csr of $hostname\n" unless -f $csr; 58 61 … … 64 67 sub list { 65 68 my $self = shift; 66 my @csrs = glob(File::Spec->catfile($self-> {csrdir}, '*.csr'));69 my @csrs = glob(File::Spec->catfile($self->csrdir, '*.csr')); 67 70 for my $csr ( @csrs ) { 68 71 my ( $host ) = ( $csr =~ m!([^/]+)\.csr$! ); -
lang/perl/Punc/trunk/lib/Punc/Master/Daemon.pm
r11734 r11749 1 1 package Punc::Master::Daemon; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 use base qw( Punc::Daemon ); 6 5 use File::Spec; … … 9 8 use Crypt::OpenSSL::CA; 10 9 use Crypt::OpenSSL::RSA; 10 11 extends 'Punc::Daemon'; 12 with 'Punc::Daemon::Role'; 11 13 12 14 sub new { -
lang/perl/Punc/trunk/lib/Punc/Slave/Daemon.pm
r11518 r11749 1 1 package Punc::Slave::Daemon; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 use File::Spec; 6 5 use Crypt::OpenSSL::PKCS10 qw( :const ); … … 9 8 use File::Path; 10 9 11 use base qw( Punc::Daemon ); 10 extends 'Punc::Daemon'; 11 with 'Punc::Daemon::Role'; 12 12 13 13 sub new { -
lang/perl/Punc/trunk/lib/Punc/Slave/Module/File.pm
r11518 r11749 1 1 package Punc::Slave::Module::File; 2 2 3 use strict;4 use warnings;5 3 use Path::Class qw( dir file ); 6 4 use Punc::Slave::Module { operatingsystem => [ qw/ .* / ] }; 5 use Moose; 7 6 8 7 sub md5sum { -
lang/perl/Punc/trunk/lib/Punc/Slave/Module/Punc.pm
r11184 r11749 1 1 package Punc::Slave::Module::Punc; 2 2 3 use strict; 4 use warnings; 3 use Moose; 5 4 use Path::Class qw( dir ); 6 5 use Punc::Slave::Module { operatingsystem => [ qw/ .* / ] }; … … 8 7 sub info { 9 8 my ( $self, $args ) = @_; 10 11 9 return { punc_path => dir(`perldoc -l Punc`)->parent->stringify }; 12 10 } -
lang/perl/Punc/trunk/lib/Punc/Slave/Module/Service/Debian.pm
r11521 r11749 1 1 package Punc::Slave::Module::Service::Debian; 2 2 3 use strict;4 use warnings;5 3 use Punc::Slave::Module::Service { operatingsystem => [ qw / debian ubuntu / ] }; 6 4 use Moose; -
lang/perl/Punc/trunk/lib/Punc/Slave/Module/Service/RedHat.pm
r11518 r11749 1 1 package Punc::Slave::Module::Service::RedHat; 2 2 3 use strict;4 use warnings;5 3 use Punc::Slave::Module::Service { operatingsystem => [ qw / redhat centos fedora / ] }; 6 4 use Moose; -
lang/perl/Punc/trunk/t/00_compile.t
r8509 r11749 1 1 use strict; 2 use Test::More tests => 1;2 use Test::More tests => 3; 3 3 4 BEGIN { use_ok 'Punc' } 4 BEGIN { 5 use_ok 'Punc'; 6 use_ok 'Punc::Master::Daemon'; 7 use_ok 'Punc::Slave::Daemon'; 8 } -
lang/perl/Punc/trunk/t/97_podspell.t
r10103 r11749 14 14 puncmaster 15 15 puncmasterd 16 puncd 17 md5sum -
lang/perl/Punc/trunk/t/98_perlcritic.t
r8509 r11749 1 1 use strict; 2 2 use Test::More; 3 eval { use Test::Perl::Critic -profile => 't/perlcriticrc' };3 eval q{ use Test::Perl::Critic -profile => 't/perlcriticrc' }; 4 4 plan skip_all => "Test::Perl::Critic is not installed." if $@; 5 5 all_critic_ok('lib');
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)