App-Dex

 view release on metacpan or  search on metacpan

scripts/dex  view on Meta::CPAN

  attach extra information that could be useful in debugging stack traces.
  
  This function was copied from C<Sub::Name::subname> and renamed to the naming
  convention of this module.
  
  =cut
  
  =head1 AUTHOR
  
  The general structure of this module was written by Paul Evans
  <leonerd@leonerd.org.uk>.
  
  The XS implementation of L</set_subname> was copied from L<Sub::Name> by
  Matthijs van Duin <xmath@cpan.org>
  
  =cut
  
  1;
X86_64-LINUX-GNU-THREAD-MULTI_SUB_UTIL

s/^  //mg for values %fatpacked;

my $class = 'FatPacked::'.(0+\%fatpacked);
no strict 'refs';
*{"${class}::files"} = sub { keys %{$_[0]} };

if ($] < 5.008) {
  *{"${class}::INC"} = sub {
    if (my $fat = $_[0]{$_[1]}) {
      my $pos = 0;
      my $last = length $fat;
      return (sub {
        return 0 if $pos == $last;
        my $next = (1 + index $fat, "\n", $pos) || $last;
        $_ .= substr $fat, $pos, $next - $pos;
        $pos = $next;
        return 1;
      });
    }
  };
}

else {
  *{"${class}::INC"} = sub {
    if (my $fat = $_[0]{$_[1]}) {
      open my $fh, '<', \$fat
        or die "FatPacker error loading $_[1] (could be a perl installation issue?)";
      return $fh;
    }
    return;
  };
}

unshift @INC, bless \%fatpacked, $class;
  } # END OF FATPACK CODE

use warnings;
use strict;
use App::Dex;
use Pod::Usage qw(pod2usage);
use Try::Tiny;

if ( @ARGV && ( $ARGV[0] eq '--help' || $ARGV[0] eq '-h' ) ) {
    pod2usage( -verbose => 2 );
}

my $app = App::Dex->new;

# Throw an error if we couldn't find a config file.
try { $app->config_file } catch { die "Error: No config file found.\n" };

if ( @ARGV ) {
    my $block = $app->resolve_block( [ @ARGV ] );

    if ( ! $block ) {
        if ( $ENV{DEX_FALLBACK_CMD} ) {
            exec $ENV{DEX_FALLBACK_CMD}, @ARGV;
        } else {
            print STDERR "Error: No such command.\n\n";
            $app->display_menu;
            exit -1;
        }
    }

    $app->process_block( $block );
} else {
    $app->display_menu;
}

=pod

=encoding utf8

=head1 NAME

dex - Directory Exec

=head1 DESCRIPTION

B<dex> is a command line utility to simply repeative tasks by defining them in
the specific directory you should be in when running them.

Running dex from a directory with a F<.dex.yaml> or F<dex.yaml> file will
present you with the list of named commands.


 dev                     : Control a local development server.
     start                   : Start a local development server on docker.
     stop                    : Stop a local development server on docker.
     status                  : Show the status of the local development server.
     reset                   : Delete the database volume.
 test                    : Run the tests.


Top level commands have no indentation. Each level of indentation is a child 
command.  For instance you would run C<dex dev start> to trigger 
I<Start a local development server on docker>, but only C<dex test> to trigger 
I<Run the tests>.

=head1 DEX FILE SPEC



( run in 1.288 second using v1.01-cache-2.11-cpan-39bf76dae61 )