Commit 91dbbaf6 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

auto-build: added capability for multiple commands

parent f36b923b
Loading
Loading
Loading
Loading
+19 −19
Original line number Diff line number Diff line
#! /bin/bash

config ()
{
	git config --get auto-build`printf ".%s" "$@"`
}
config () { git config --get auto-build`printf ".%s" "$@"`; }
config-all () { git config --get-all auto-build`printf ".%s" "$@"`; }

profile ()
{
@@ -226,14 +224,15 @@ build ()

	# get the settings for this build
	profile=`config "$confsec" profile || determine_profile`
	cmd=`config "$confsec" command || profile "$profile" build`
	pattern=`config "$confsec" pattern || profile "$profile" pattern`
	replace_cmd=`profile "$profile" replace_cmd`
	backup=`config "$confsec" backup | tr '[:upper:]' '[:lower:]' || echo yes`

	IFS=$'\n' cmds=( `config-all "$confsec" command || profile "$profile" build` )
	for cmd in "${cmds[@]}"; do
		# normalise $cmd
		pushd "$GIT_DIR" >/dev/null
	eval cmd=( $cmd )
		eval "cmd=( $cmd )"
		cmd[0]=`readlink -e "${cmd[0]}" || echo "${cmd[0]}"`
		popd >/dev/null

@@ -246,6 +245,7 @@ build ()
				return 1
			fi
		)
	done

	# find the generated files
	pattern=`$replace_cmd "$pattern"`