8fc2147
#!/bin/bash -e
ad14f1b
ad14f1b
# Created by argbash-init v2.8.1
ad14f1b
# ARG_POSITIONAL_SINGLE([version])
ad14f1b
# ARG_DEFAULTS_POS()
ad14f1b
# ARG_HELP([Download and cache all build dependencies for jquery])
ad14f1b
# ARGBASH_GO()
ad14f1b
# needed because of Argbash --> m4_ignore([
ad14f1b
### START OF CODE GENERATED BY Argbash v2.8.1 one line above ###
ad14f1b
# Argbash is a bash code generator used to get arguments parsing right.
ad14f1b
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
ad14f1b
ad14f1b
ad14f1b
die()
ad14f1b
{
ad14f1b
	local _ret=$2
ad14f1b
	test -n "$_ret" || _ret=1
ad14f1b
	test "$_PRINT_HELP" = yes && print_help >&2
ad14f1b
	echo "$1" >&2
ad14f1b
	exit ${_ret}
ad14f1b
}
ad14f1b
ad14f1b
ad14f1b
begins_with_short_option()
ad14f1b
{
ad14f1b
	local first_option all_short_options='h'
ad14f1b
	first_option="${1:0:1}"
ad14f1b
	test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
ad14f1b
}
ad14f1b
ad14f1b
# THE DEFAULTS INITIALIZATION - POSITIONALS
ad14f1b
_positionals=()
ad14f1b
_arg_version=
ad14f1b
# THE DEFAULTS INITIALIZATION - OPTIONALS
ad14f1b
ad14f1b
ad14f1b
print_help()
ad14f1b
{
ad14f1b
	printf '%s\n' "Download and cache all build dependencies for jquery"
ad14f1b
	printf 'Usage: %s [-h|--help] <version>\n' "$0"
ad14f1b
	printf '\t%s\n' "-h, --help: Prints help"
ad14f1b
}
ad14f1b
ad14f1b
ad14f1b
parse_commandline()
ad14f1b
{
ad14f1b
	_positionals_count=0
ad14f1b
	while test $# -gt 0
ad14f1b
	do
ad14f1b
		_key="$1"
ad14f1b
		case "$_key" in
ad14f1b
			-h|--help)
ad14f1b
				print_help
ad14f1b
				exit 0
ad14f1b
				;;
ad14f1b
			-h*)
ad14f1b
				print_help
ad14f1b
				exit 0
ad14f1b
				;;
ad14f1b
			*)
ad14f1b
				_last_positional="$1"
ad14f1b
				_positionals+=("$_last_positional")
ad14f1b
				_positionals_count=$((_positionals_count + 1))
ad14f1b
				;;
ad14f1b
		esac
ad14f1b
		shift
ad14f1b
	done
ad14f1b
}
ad14f1b
ad14f1b
ad14f1b
handle_passed_args_count()
ad14f1b
{
ad14f1b
	local _required_args_string="'version'"
ad14f1b
	test "${_positionals_count}" -ge 1 || _PRINT_HELP=yes die "FATAL ERROR: Not enough positional arguments - we require exactly 1 (namely: $_required_args_string), but got only ${_positionals_count}." 1
ad14f1b
	test "${_positionals_count}" -le 1 || _PRINT_HELP=yes die "FATAL ERROR: There were spurious positional arguments --- we expect exactly 1 (namely: $_required_args_string), but got ${_positionals_count} (the last one was: '${_last_positional}')." 1
ad14f1b
}
ad14f1b
ad14f1b
ad14f1b
assign_positional_args()
ad14f1b
{
ad14f1b
	local _positional_name _shift_for=$1
ad14f1b
	_positional_names="_arg_version "
ad14f1b
ad14f1b
	shift "$_shift_for"
ad14f1b
	for _positional_name in ${_positional_names}
ad14f1b
	do
ad14f1b
		test $# -gt 0 || break
ad14f1b
		eval "$_positional_name=\${1}" || die "Error during argument parsing, possibly an Argbash bug." 1
ad14f1b
		shift
ad14f1b
	done
ad14f1b
}
ad14f1b
ad14f1b
parse_commandline "$@"
ad14f1b
handle_passed_args_count
ad14f1b
assign_positional_args 1 "${_positionals[@]}"
ad14f1b
ad14f1b
# OTHER STUFF GENERATED BY Argbash
ad14f1b
ad14f1b
### END OF CODE GENERATED BY Argbash (sortof) ### ])
ad14f1b
# [ <-- needed because of Argbash
ad14f1b
ad14f1b
version=$_arg_version
ad14f1b
rm -rf jquery-$version jquery-$version.tar.gz jquery_${version}_node_modules.tar.gz
ad14f1b
wget https://github.com/jquery/jquery/archive/$version/jquery-$version.tar.gz
ad14f1b
ad14f1b
tar xf jquery-$version.tar.gz
ad14f1b
ad14f1b
pushd jquery-$version
ad14f1b
npm install --save-dev
ad14f1b
tar cfz ../jquery_${version}_node_modules.tar.gz node_modules
ad14f1b
ad14f1b
# Husky tries to install a git hook that doesn't play well with dist-git
ad14f1b
npm uninstall husky
ad14f1b
popd
ad14f1b
ad14f1b
fedpkg new-sources jquery-$version.tar.gz jquery_${version}_node_modules.tar.gz
ad14f1b
ad14f1b
# ] <-- needed because of Argbash