Changeset 21029 for lang/perl/Archer

Show
Ignore:
Timestamp:
10/09/08 11:37:38 (3 months ago)
Author:
tokuhirom
Message:

specify assets_path by configuration file =)

Location:
lang/perl/Archer/trunk/lib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Archer/trunk/lib/Archer.pm

    r14901 r21029  
    2323    if ( !$$opts{ write_config } ) { 
    2424        my $config_loader = Archer::ConfigLoader->new; 
    25         $self->{ config } = $config_loader->load( $opts->{ config_yaml } ); 
     25        $self->{ config } = $config_loader->load( $opts->{ config_yaml }, $self ); 
    2626    } 
    2727    $self->{ config }->{ global }->{ log } ||= { level => 'debug' }; 
     
    136136} 
    137137 
    138 # TODO: use the log4perl? 
     138# TODO: use the Log::Dispatch? 
    139139sub log { 
    140140    my ( $self, $level, $msg, %opt ) = @_; 
  • lang/perl/Archer/trunk/lib/Archer/ConfigLoader.pm

    r3713 r21029  
    1414    my ( $self, $stuff, $context ) = @_; 
    1515 
    16     my $schema_file = file( $FindBin::Bin, 'assets', 'kwalify', 'schema.yaml' ); 
    17  
     16    # load 
    1817    my $config; 
    1918    if (   ( !ref($stuff) && $stuff eq '-' ) 
     
    3332    } 
    3433 
     34    # setup default value 
     35    $config->{global}->{assets_path} ||= file( $FindBin::Bin, 'assets')->stringify; 
     36    $context->log('debug' => "assets path: $config->{global}->{assets_path}"); 
     37 
     38    # verify 
     39    my $schema_file = file( $config->{global}->{assets_path}, 'kwalify', 'schema.yaml' ); 
    3540    my $res = validate( YAML::LoadFile($schema_file), $config ); 
    3641    $context->log( error => $res ) unless $res == 1;