Created
December 26, 2017 04:55
-
-
Save tim42/810b1ed33fe57e1916d587ce9df7e9c8 to your computer and use it in GitHub Desktop.
neam's prig config file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# neam prig config file | |
# | |
# NOTE: This file adds some global command line options. prig --help (when the file is loaded) | |
# or ./neam-prig --help will display them | |
# | |
## bootstrap | |
gbl_opt_prig_repo='https://github.com/tim42/prig.git' | |
raw_prig_file='https://raw.githubusercontent.com/tim42/prig/master/prig' | |
# in the case we run outside prig: | |
[ -z "$prig_file" ] && { echo 'bootstrapping prig...'; curl -# "$raw_prig_file" | bash -s -- --load-config="$0" "$@"; exit $? ; } | |
## conf chunk | |
# List of space-separated generator names that will serve as project generators. (order is important). | |
conf_project_generator="grab github scaffold" | |
# generators urls | |
conf_generator_grab_url="$gbl_opt_prig_repo" | |
conf_generator_grab_branch="grab-generator" | |
conf_generator_github_url="$gbl_opt_prig_repo" | |
conf_generator_github_branch="github-generator" | |
#conf_generator_scaffold_url="file:///$HOME/projects/scaffold" | |
conf_generator_scaffold_url="https://github.com/CruizeMissile/scaffold.git" | |
conf_generator_scaffold_branch="prig" | |
# generators configuration | |
conf_github_project_list="" | |
conf_scaffold_third_party=third_party | |
conf_github_third_party="${conf_scaffold_third_party}" | |
## custom options chunk | |
help_gbl_opt_add_dep="Add a github project to the submodule list" | |
function gbl_opt_add_dep # (gh-repo) | |
{ | |
if [ "$1" = "true" ] || [ "$1" = "false" ] | |
then | |
return | |
fi | |
conf_github_project_list+=" $1" | |
} | |
help_gbl_opt_add_ndep="Add a neam's (tim42) github project to the submodule list" | |
function gbl_opt_add_ndep # (gh-repo) | |
{ | |
if [ "$1" = "true" ] || [ "$1" = "false" ] | |
then | |
return | |
fi | |
gbl_opt_add_dep "tim42/$1" | |
} | |
help_gbl_opt_grab_file="Add a file to be grabbed. Format is the following: url;local-path" | |
function gbl_opt_grab_file # (url:local-path) | |
{ | |
if [ "$1" = "true" ] || [ "$1" = "false" ] | |
then | |
return 1 | |
fi | |
pth="${1##*;}" | |
url="${1%;*}" | |
# make sure the path is a safe var name | |
safe_pth="$(base64 <<<"$pth")" | |
safe_pth="${safe_pth//\//_1_}" # // -> _1_ | |
safe_pth="${safe_pth//+/_2_}" # + -> _2_ | |
safe_pth="${safe_pth//=/_3_}" # = -> _3_ | |
declare -g "help_conf_grab_file_url_${safe_pth}=URL for $pth" | |
declare -g "conf_grab_file_url_${safe_pth}=$url" | |
declare -g "help_conf_grab_file_path_${safe_pth}=path for $pth" | |
declare -g "conf_grab_file_path_${safe_pth}=$pth" | |
} | |
# add a new --test option that will override $gbl_opt_prig_repo | |
# this allow me to have a test mode (local) and a real one (remote) | |
orig_gbl_opt_prig_repo="${gbl_opt_prig_repo}" | |
help_gbl_opt_test="Toggle local mode (test) or external mode (no-test)" | |
function gbl_opt_test # (activate) | |
{ | |
if [ "$1" = "true" ] | |
then | |
debug_log 'activating test mode for prig' | |
# The git repository of prig. Prig and its commands will be checked out from there. | |
gbl_opt_prig_repo="file:///$HOME/projects/prig" | |
else | |
# The git repository of prig. Prig and its commands will be checked out from there. | |
gbl_opt_prig_repo="$orig_gbl_opt_prig_repo" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment