Changeset 5756 for inc

Show
Ignore:
Timestamp:
07/22/05 19:08:32 (3 years ago)
Author:
gaal
svk:copy_cache_prev:
7758
Message:

cleanups for default config.yml. Note that we need an empty makefile target
so that when the user edits their config.yml pugs gets recompiled. But the
initialization can't be in the rule because of the circular dependency that
would entail.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • inc/PugsBuild/Config.pm

    r5755 r5756  
    3737    my($class, $filename) = @_; 
    3838    my $stream; 
    39     my $fh; 
    4039     
    41     unless (open $fh, ($filename ||= "config.yml")) { 
    42         if (-e $filename) { die "open: $!"; } # real error 
    43          
    44         # Makefile.PL uses PugsBuild::Config, which needs to read config.yml. 
    45         # However, config.yml is generated by a Makefile target. 
    46         # This whole block is a temporary workaround for the problem. 
     40    if (!-e ($filename ||= "config.yml")) { 
    4741        require File::Copy; 
    48          
    49         File::Copy::copy ('util/config-template.yml', 'config.yml') or die "Copy failed"; 
    50         warn "Default build config file created. Edit your settings in config.yml."; 
    51          
    52         open $fh, "config.yml" or die "open: $!"; 
    53     }; 
    54      
     42        File::Copy::copy ('util/config-template.yml', $filename) or 
     43            die "copy: $!"; 
     44        warn <<"."; 
     45Default build config file created. Edit your settings in $filename. 
     46. 
     47    }        
     48 
     49    open my $fh, $filename or die "open: $filename: $!"; 
    5550    { local $/; $stream = <$fh> } 
    5651    my $conf = $YAML->load($stream);