Changeset 175

Show
Ignore:
Timestamp:
02/23/07 18:06:11 (2 years ago)
Author:
ingy
Message:
 r3461@skinny-2:  ingy | 2007-02-23 18:05:55 -0800
 Config.yaml files ned to override other .yaml files even if they are added
 later.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/core/Kwiki/lib/Kwiki/Boot/V1.pm

    r173 r175  
    1616    $self->config->add_file('config.yaml'); 
    1717    for my $filepath (glob 'config*.*') { 
    18         $self->config->add_filepath($filepath); 
     18        $self->config->add_override_filepath($filepath); 
    1919    } 
    2020} 
  • trunk/src/core/Kwiki/lib/Kwiki/Display.pm

    r87 r175  
    3434 
    3535sub display { 
     36#     $self->hub->users; 
     37#     XXX $self->hub->config; 
    3638    my $page = $self->pages->current; 
    3739    return $self->redirect('') 
  • trunk/src/core/Spoon/lib/Spoon/Config.pm

    r173 r175  
    44const class_id => 'config'; 
    55field plugin_classes => []; 
     6field overrides => {}; 
    67 
    78sub all { 
    89    return %$self; 
     10} 
     11 
     12sub add_override_filepath { 
     13    my $filepath = shift; 
     14    my $hash = $self->hash_from_file($filepath); 
     15    my $overrides = $self->overrides; 
     16    $overrides->{$_} = $hash->{$_} for keys %$hash; 
     17    $self->add_config($hash); 
    918} 
    1019 
     
    2130    my $filepath = shift; 
    2231    my $hash = $self->hash_from_file($filepath); 
    23     for my $key (keys %$hash) { 
    24         $self->add_field($key, $hash->{$key}); 
    25     } 
     32    $self->add_config($hash); 
     33    $self->add_config($self->overrides); 
    2634} 
    2735 
    28 sub add_field { 
    29     my ($field, $value) = @_; 
    30     field $field; 
    31     $self->{$field} = $value; 
    32 
     36# sub add_field { 
     37#     my ($field, $value) = @_; 
     38#     field $field; 
     39#     $self->{$field} = $value; 
     40#
    3341 
    3442sub add_config {