Changeset 14214 for lang/perl/App-Nakanobu
- Timestamp:
- 06/18/08 18:02:28 (5 months ago)
- Location:
- lang/perl/App-Nakanobu/trunk
- Files:
-
- 3 modified
-
Makefile.PL (modified) (1 diff)
-
lib/App/Nakanobu.pm (modified) (2 diffs)
-
nakanobu.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/App-Nakanobu/trunk/Makefile.PL
r14195 r14214 5 5 requires 'JSON::RPC::Common' => 0.03; 6 6 requires 'Moose' => 0.50; 7 requires 'MooseX::Daemonize' => 0.05; 7 8 requires 'MooseX::Plaggerize' => 0.04; 8 9 requires 'POE' => 1.0002; -
lang/perl/App-Nakanobu/trunk/lib/App/Nakanobu.pm
r14195 r14214 3 3 use 5.00800; 4 4 our $VERSION = '0.01'; 5 with 'MooseX::Plaggerize' ;5 with 'MooseX::Plaggerize', 'MooseX::Daemonize'; 6 6 use POE; 7 use YAML; 8 use File::Spec; 9 use FindBin; 10 use MooseX::Types::Path::Class; 11 12 has conffile => ( 13 cmd_aliases => 'c', 14 metaclass => 'Getopt', 15 is => 'ro', 16 isa => 'Path::Class::File', 17 default => sub { 18 Path::Class::File->new( $FindBin::Bin, 'config.yaml' ); 19 }, 20 ); 7 21 8 22 has config => ( 9 is => 'ro', 10 isa => 'HashRef', 23 is => 'rw', 24 isa => 'HashRef', 25 lazy => 1, 26 default => sub { 27 my $self = shift; 28 YAML::LoadFile( $self->conffile ) 29 }, 11 30 ); 12 31 … … 14 33 sub context { $context } 15 34 16 sub run{35 after 'start' => sub { 17 36 my ($self, ) = @_; 37 return unless $self->is_daemon; 38 39 $self->config; # evaluate lazy attribute 40 $self->_load_plugins(); 18 41 $context = $self; 19 $self->_load_plugins();20 42 $self->run_hook('run_component'); 21 43 $SIG{INT} = sub { POE::Kernel->stop }; 22 44 POE::Kernel->run(); 23 } 45 }; 24 46 25 47 sub _load_plugins { -
lang/perl/App-Nakanobu/trunk/nakanobu.pl
r14195 r14214 6 6 use lib catfile($FindBin::Bin, 'lib'); 7 7 use App::Nakanobu; 8 use YAML;9 8 10 my $conf = YAML::LoadFile(catfile($FindBin::Bin, 'config.yaml')); 11 my $nakanobu = App::Nakanobu->new(config => $conf); 12 $nakanobu->run(); 9 my $daemon = App::Nakanobu->new_with_options(); 13 10 11 my ($command) = @{$daemon->extra_argv}; 12 defined $command || die "No command specified"; 13 14 $daemon->start if $command eq 'start'; 15 $daemon->status if $command eq 'status'; 16 $daemon->restart if $command eq 'restart'; 17 $daemon->stop if $command eq 'stop'; 18 19 warn($daemon->status_message); 20 exit($daemon->exit_code); 21
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)