Skip to content

Instantly share code, notes, and snippets.

@valer-cara
Created October 6, 2014 19:31
Show Gist options
  • Save valer-cara/6960693bdbc9d9a37287 to your computer and use it in GitHub Desktop.
Save valer-cara/6960693bdbc9d9a37287 to your computer and use it in GitHub Desktop.
#!/bin/bash
tmpfile="/tmp/__our_temp"
scripts_root="$(git root)/app/scripts"
esc_root=${scripts_root//\//\\/}
files=`find $scripts_root -type f -print`
for file in $files; do
line1=$(sed -ne '1p' $file)
if (echo $line1 | grep -q ^App); then
echo File $file matches. Adding default jsdoc comments.
submodule=`dirname $file | sed -e "s/$esc_root//" | cut -f 2 -d '/'`
class=$(echo $line1 | cut -f 1 -d "=" | tr -d ' ')
if [ -z $submodule ]; then continue; fi
cat << END > $tmpfile
###*
# @module App
# @submodule $submodule
###
###*
# @class $class
###
END
cat $file >> $tmpfile
rm $file
mv $tmpfile $file
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment