#!/usr/bin/env perl # PODNAME: duckpan # ABSTRACT: Command line tool for using the DuckPAN of DuckDuckGo use strict; use warnings; my @libs; BEGIN { use Getopt::Long qw/:config bundling pass_through/; use Path::Tiny; use Try::Tiny; GetOptions 'include|I=s' => \@libs; @libs = split ',', join ',', @libs; if (my @missing = grep { !$_->exists } map { path($_) } @libs) { my $plural = (scalar @missing == 1) ? '' : 's'; print STDERR '[FATAL ERROR] Missing include path' . $plural . ': ' . join(', ', map { try { $_->realpath } || $_->absolute } @missing) . "\n"; exit 1; } # For other commands, bundling is desirable but pass_through leads to # incomplete validation of command line arguments Getopt::Long::Configure('no_pass_through'); } use lib @libs; $|=1; use App::DuckPAN; App::DuckPAN->new_with_cmd; __END__ =pod =head1 NAME duckpan - Command line tool for using the DuckPAN of DuckDuckGo =head1 VERSION version 1006 =head1 SYNOPSIS duckpan [-I=] [-v|--verbose] [] Commands include: check Check if you fulfill all requirements for the development environment env Add, remove or retrieve values from DuckPAN's Env.ini help View more detailed help information installdeps Install all Perl dependencies new Generate new Instant Answer skeleton publisher Start local web server for DuckDuckGo-Publisher static websites query Test Instant Answer triggers on command line reinstall Reinstalls installed, pinned, or most recent DuckPAN and DDG Perl modules latest Like reintall but ignores installed versions roadrunner Same as installdeps, but skips tests (dangerous!) server Start local web server to test Instant Answer display update Installs newest DuckPAN packages upgrade Installs newest DuckPAN and DDG packages Use 'duckpan help' or 'man duckpan' for more details. =head1 DESCRIPTION DuckPAN is an application built to aid DuckDuckHack contributors with Instant Answer development. It is mainly used by contributors to test Instant Answer triggers and preview their visual design and output. =head1 NAME DuckPAN - The DuckDuckHack Developer Tool =head1 INSTALLATION Please see L for DuckPAN installation instructions =head1 COMMANDS =head2 Help =over 4 =item C OR C OR C Shows you the DuckPAN help page which briefly describes DuckPAN and its features. =back =head2 FOR INSTANT ANSWER DEVELOPERS =over 4 =item C Checks if you fulfill all requirements for the development environment. This will run automatically during a B. =item C [package_name ...] Test Goodie and Spice triggers interactively on the command line. For each query, the Instant Answers triggered will be displayed. This tool should be used to ensure your Instant Answer triggers correctly. [package_name ...]: Loads only the specified Spice or Goodie Instant Answers. Examples: duckpan query Npm duckpan query Twitter IsItUp =item C [--port ] [package_name ...] Starts a local web server, which emulates the DuckDuckGo production environment. Allows for live testing of Goodie and Spice Instant Answers. This tool should be used to ensure your Instant Answer displays correctly. For Spice Instant Answers, this is especially important to verify API calls are successful and no JavaScript errors exist. -p, --port : Forces DuckPAN server to run on the specified port (default port is 5000) [package_name ...]: Loads only the specified Spice or Goodie Instant Answers. Examples: duckpan server Movie duckpan server IDN Sort Morse =item C [package name] Generates all necessary files for a new Spice or Goodie Instant Answer (depending on the current repo). DuckPAN will prompt you for a package name and generate the required files. If the name is already in use, DuckPAN will let you know and no files will be created. =item C Tests your release, by running the tests in the B directory using Dzil (if a dist.ini exists) or prove. This will run automatically during a B. =item C Attempt to install dependencies for the distribution in your current directory using cpanm. =item C Same as installdeps, but without testing them. Meep meep! =item C Starts a local web server which displays static websites created with L. =item C Update DuckPAN to the latest version. =item C Upgrade DuckPAN and DDG to the latest versions. =back =head2 FOR DUCKPAN DEVELOPERS =over 4 =item C Force installation of DuckPAN and DDG modules using the installed, pinned, or latest versions, in that order. =item C Like L except it ignores any installed version. =item C Loads the specified external library. This should be used to test changes made to L and L. Example: loading modified DuckPAN modules C. =back =head1 ENVIRONMENT VARIABLES =over 4 =item C View env commands and shows command usage. =item C View env commands and shows command usage. =item C Add an environment variable that DuckPAN will remember. This is specifically useful for Spice API keys. Variables are stored in ~/.duckpan/config/env.ini =item C Retrieve the matching key for a given env variable. =item C Remove an environment variable from DuckPAN. =item C Lists all the env variables currently stored in ~/.duckpan/config/env.ini. =back =head1 SEE ALSO =over 4 =item L =item L =item L =item L =item L =back =head1 CONTRIBUTION To contribute to DuckPAN, please visit L. We also welcome and encourage contributions from our community. Please visit L to contribute new Instant Answers, or visit L to share your ideas and Instant Answer source suggestions. =head1 SUPPORT =over 4 =item B We invite you to join us on L for any queries and lively discussion. =item B L =item B L =back =head1 AUTHOR Torsten Raudssus L =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2013 by DuckDuckGo, Inc. L. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut