Skip to content

Instantly share code, notes, and snippets.

@alexander-brett
Created August 12, 2015 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexander-brett/4e52a64722cb3f38dcb3 to your computer and use it in GitHub Desktop.
Save alexander-brett/4e52a64722cb3f38dcb3 to your computer and use it in GitHub Desktop.
Create a redistributable .exe file for App-SFDC
perl -x %0 > static_SFDC.pl
perlapp ^
--add MooX::Options::Role^
--add App::SFDC::Role::^
--add Log::Log4perl::Appender::Screen^
--add WWW::SFDC::^
--bind manifests/base.xml[file=C:\perl64\site\lib\auto\Share\dist\App-SFDC-Metadata\manifests\base.xml,text,mode=666]^
--bind manifests/all.xml[file=C:\perl64\site\lib\auto\Share\dist\App-SFDC-Metadata\manifests\all.xml,text,mode=666]^
--bind plugins/retrieve.plugins.pm[file=C:\perl64\site\lib\auto\Share\dist\App-SFDC-Metadata\plugins\retrieve.plugins.pm,text,mode=777]^
--scan C:\perl64\site\lib\auto\Share\dist\App-SFDC-Metadata\plugins\retrieve.plugins.pm^
--bind certs/cafile.crt[file="C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt",text,mode=666]^
--env HTTPS_CA_FILE=certs/cafile.crt^
--info CompanyName=Sophos;LegalCopyright="This software is Copyright (c) 2015 by Sophos Limited https://www.sophos.com/. This is free software, licensed under the MIT (X11) License"^
--norunlib --force --exe SFDC.exe static_SFDC.pl
goto :endofperl
#!perl
use strict;
use warnings;
use 5.12.0;
use App::SFDC;
my $commandArrayDefinition = 'my @commands = ("'
. (join '","', @App::SFDC::commands) . '");';
say <<'HEAD';
package SFDC;
use strict;
use warnings;
HEAD
say "use App::SFDC::Command::$_;" for @App::SFDC::commands;
say 'my @commands = ("' . (join '","', @App::SFDC::commands) . '");';
say <<'BODY';
my $usage = join "\n\n",
"SFDC: Tools for interacting with Salesforce.com",
"Available commands:",
(join "\n", map {"\t$_"} @commands),
"For more detail, run: SFDC <command> --help";
my $command = shift;
exit 1 unless do {
if ($command) {
if (my ($correct_command) = grep {/^$command$/i} @commands) {
"App::SFDC::Command::$correct_command"->new_with_options->execute();
} else {
print $usage;
0;
}
} else {
print $usage;
}
}
BODY
__END__
:endofperl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment