Changeset 7369 for inc

Show
Ignore:
Timestamp:
10/07/05 03:50:45 (3 years ago)
Author:
autrijus
Message:

* Merge old settings with new ones when a new config.yml template

occurs, but still inform the user. geoffb++

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • inc/PugsBuild/Config.pm

    r7367 r7369  
    4747            die "copy: $!"; 
    4848        warn <<"."; 
    49 *** 
    50 Default build config file created. Edit your settings in $filename. 
     49*** Default build config file created. Edit your settings in $filename. 
    5150. 
    5251    }        
    53  
    54     if (-M $filename > -M $config_template) { 
    55         warn <<"."; 
    56 *** 
    57 Build config file '$filename' is older than template 
    58 '$config_template'. 
    59  
    60 You may wish to check for new settings. 
    61 . 
    62     } 
    6352 
    6453    open my $fh, $filename or die "open: $filename: $!"; 
    6554    { local $/; $stream = <$fh> } 
    6655    my $conf = $YAML->load($stream); 
     56     
     57    if (-M $filename > -M $config_template) { 
     58        warn <<"."; 
     59*** Build config file '$filename' is older than template 
     60    '$config_template'.  I will merge them for you, but 
     61    you may wish to check for new settings. 
     62 
     63. 
     64        open my $tpl, $config_template or die "open: $config_template: $!"; 
     65        my $tpl_stream = do { local $/; <$tpl> }; 
     66        my $tpl_config = $YAML->load($stream); 
     67        $conf = { %$tpl_config, %$conf }; 
     68    } 
     69 
    6770    $class->env_override($conf); 
    68      
    6971    $class->defaults($conf); 
    7072    return $conf;