-
Notifications
You must be signed in to change notification settings - Fork 60
Description
I suspect the pedantic stub \ generate-options and other associated behavior hasn't been used in a while, as it's only referenced in one place, in stubbs/commands/add-module/script
starting at line 86, this code checks if the value of TEMPLATE is exactly equal to pedantic. If so, it sets STUB to the pedantic stub path instead of the regular path.
STUB=$RERUN_MODULE_DIR/lib/stub/bash
if [[ -n "${TEMPLATE:-}" ]]
then
[[ ${TEMPLATE} == "pedantic" ]] && STUB=$RERUN_MODULE_DIR/lib/stub/bash-pedantic
fiHowever, later in the file, starting at line 139, TEMPLATE is again checked and analyzed, this time used to validate if there's a module located at TEMPLATE so it can be cloned.
if [[ -n "${TEMPLATE:-}" ]]
then
if [[ "$TEMPLATE" =~ [/]+ ]]
then TEMPLATE_DIR=$(rerun_path_absolute $TEMPLATE)
else TEMPLATE_DIR=$(rerun_module_exists $TEMPLATE)
fi
rerun_log info "Copying files from template: $TEMPLATE..."
stubbs_module_clone $RERUN_MODULE_HOME_DIR $TEMPLATE_DIR
fiThe problem exists when using --template pedantic to satisfy the former behavior, as it causes an error in the latter behavior on this line:
else TEMPLATE_DIR=$(rerun_module_exists $TEMPLATE)Because pedantic is not a valid path to a module, rerun_module_exists errors, and you cannot create a module using --template pedantic.
$ RERUN_MODULES=./modules ./rerun stubbs: add-module --module my-module --description "my test module" --template pedantic
ERROR: *** command failed: stubbs:add-module. ***Possible solution would be to change the second template check to skip if the value is 'pedantic', e.g.:
if [[ -n "${TEMPLATE:-}" && ${TEMPLATE} != "pedantic" ]]
then
if [[ "$TEMPLATE" =~ [/]+ ]]
then TEMPLATE_DIR=$(rerun_path_absolute $TEMPLATE)
else TEMPLATE_DIR=$(rerun_module_exists $TEMPLATE)
fi
rerun_log info "Copying files from template: $TEMPLATE..."
stubbs_module_clone $RERUN_MODULE_HOME_DIR $TEMPLATE_DIR
fi