App-SD

 view release on metacpan or  search on metacpan

lib/App/SD/Config.pm  view on Meta::CPAN

            for my $name ( keys %$sources ) {
                my ($url, $uuid) = split(/ \| /, $sources->{$name}, 2);
                push @config_to_set, {
                    key   => "replica.'$name'.url",
                    value => $url,
                }, {
                    key   => "replica.'$name'.uuid",
                    value => $uuid,
                };
            }
            # move the old config file to a backup
            my $backup_file = $file;
            unless ( $self->_deprecated_repo_config_names->{$file} ) {
                $backup_file = "$file.bak";
                rename $file, $backup_file;
            }

            # we want to write the new file to a supported filename if
            # it's from a deprecated config name (replica/prophetrc)
            $file = File::Spec->catfile( $self->app_handle->handle->fs_root, 'config' )
                if $self->_deprecated_repo_config_names->{$file};

            # write the new config file (with group_set)
            $self->group_set( $file, \@config_to_set, 1);

            # tell the user that we're done
            print "done.\nOld config can be found at $backup_file; "
                  ,"new config is $file.\n\n";

}

sub _deprecated_repo_config_names {
    my $self = shift;

    my %filenames = ( File::Spec->catfile( $self->app_handle->handle->fs_root => 'prophetrc' ) => 1 );

    return wantarray ? %filenames : \%filenames;



( run in 1.930 second using v1.01-cache-2.11-cpan-49f99fa48dc )