Ambrosia

 view release on metacpan or  search on metacpan

script/ambrosia  view on Meta::CPAN

#!/usr/local/bin/perl -w

use strict;
use warnings;

################################################################################
#   INIT
################################################################################
our $VERSION = 0.010;

our $dispatcher;
our $action;
use Data::Dumper;

our $dist_dir;
our $share_dir;
BEGIN
{
    use File::ShareDir 'dist_dir';
    eval
    {
        $dist_dir = dist_dir('Ambrosia');
        $share_dir = $dist_dir;
    };
    if ($@)
    {
        use FindBin;
        if ( -d "$FindBin::Bin/../lib/perl5" )
        {
            $dist_dir = $FindBin::Bin . '/../lib/perl5';
            $share_dir = $dist_dir . '/share/Ambrosia';
        }
        else
        {
            $dist_dir = $FindBin::Bin . '/../lib';
            $share_dir = $FindBin::Bin . '/../share';
        }
    }
}

use lib $dist_dir;
use lib $share_dir;

BEGIN
{
    use XML::LibXML;

    use Ambrosia::core::Nil;
    use Ambrosia::Config;
    use Ambrosia::Context;
    use Ambrosia::DataProvider;

    use Cwd;
    my $cwd = cwd();

    my %optionsConfig = (
        engine_name => 'Options',
        engine_params => {
                options_spec => [
                    'ambrosia %o',
                    [ 'data|d=s',         'the path to xml' ],
                    [ 'config_path|c=s',  'the path to config' ],
                    [ 'install_path|p=s', 'the path where project building' ],
                    [ 'action|a=s',       "what to do:\n\t\configure - create config;\n\t\tdb2xml - make xml from data base structure;\n\t\txml2app - make schema of application" ],
                    [ 'help',             'print usage message and exit' ],
                ]
            }
    );

    instance Ambrosia::Context(%optionsConfig);

    my $config_path = Context->param('config_path') || $cwd . '/ambrosia.conf';
    if (-f $config_path )



( run in 0.946 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )