github.com/blixtra/rkt@v0.8.1-0.20160204105720-ab0d1add1a43/scripts/godep-save (about)

     1  #!/bin/bash -e
     2  
     3  # make sure we are running in a toplevel directory
     4  if ! [[ "$0" =~ "scripts/godep-save" ]]; then
     5  	echo "This script must be run in a toplevel rkt directory"
     6  	exit 255
     7  fi
     8  
     9  # make sure that we have the fixed version of godep, which vendors
    10  # external projects, but does not modify them.
    11  REQGV=41
    12  GV=$(godep version | sed -e 's/^godep v\([0-9]\+\).*/\1/')
    13  if [[ "${GV}" -lt "${REQGV}" ]]; then
    14  	echo "The godep tool is too old (${GV}), must be at least version ${REQGV}"
    15  	exit 255
    16  fi
    17  
    18  VA=vendoredApps
    19  APPS=''
    20  if [[ -r "${VA}" ]]; then
    21  	# grep filters all empty lines and all lines with comments
    22  	# only, sed removes the comments from the other lines
    23  	APPS=$(cat "${VA}" \
    24  		      | grep -v '^\([[:space:]]*#.*\)\?$' \
    25  		      | sed -e 's/[[:space:]]*#.*//g')
    26  else
    27  	echo "No file '${VA}' found"
    28  fi
    29  
    30  CMD="godep save ./... ${APPS}"
    31  
    32  echo Running ${CMD}
    33  exec ${CMD}