#!/usr/bin/env perl

use warnings;
# vi: set ts=4 sw=4 :

#____________________________________________________________________________
#
#   MusicBrainz -- the open internet music database
#
#   Copyright (C) 2002 Robert Kaye
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#   $Id$
#____________________________________________________________________________

# This script echoes the settings in DBDefs.pm to standard output, in
# a format usable by the shell (e.g. eval `./admin/ShowDBDefs`)

use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/../lib";

use Class::MOP;
use DBDefs;
use String::ShellQuote;

my $export = { map { $_->name => $_ } Class::MOP::Class->initialize('DBDefs')->get_all_methods('CODE') };

my %exclude = map { $_ => 1 }
    qw( COVER_ART_ARCHIVE_UPLOAD_PREFIXER DOES );

printf "export %s=%s\n", $_, shell_quote(join(',', grep { defined } $export->{$_}->body->('DBDefs')))
    for (grep { !exists $exclude{$_} } grep { /^[A-Z]+(_[A-Z]+)*$/ } keys %$export);
