#!/bin/sh

# Switch the script's current directory
cd `dirname $0`;

# Neuter the internal field separator
IFS=''

# Formatting variables
BOLD=`tput bold`
BLUE=`tput setaf 12`
RESET=`tput sgr0`

# Include directories that start with a leading dot
shopt -s dotglob


# Cycle through each item in the CWD
for i in *; do
	
	# Ensure the item's really a Git repository
	[ -d "$i/.git" ] && { echo $(

		cd $i;

		# Print a divider to STDOUT to break the feedback up better
		printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";

		# Update!
		git status --porcelain && { git pull; };

	); };
	
	
	# Is this a Subversion repository instead?
	[ -d "$i/.svn" ] && { echo $(
		
		cd $i;
		
		# Drop another divider to break feedback up a little
		printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
		
		# Clear .DS_Store crap if possible
		hash dsclean 2>/dev/null && dsclean;
		
		# Update!
		svn update;
	); };
done;

#!/bin/sh

# Switch the script's current directory
cd `dirname $0`;

# Neuter the internal field separator
IFS=''

# Formatting variables
BOLD=`tput bold`
BLUE=`tput setaf 12`
RED=`tput setaf 9`
RESET=`tput sgr0`

# Include directories that start with a leading dot
shopt -s dotglob


# Print a divider to STDOUT to break up feedback better
marker(){
	printf %s$'\n' "${BOLD}$1==>${RESET}${BOLD} $2${RESET}";
}


# Cycle through each item in the CWD
for i in *; do
	
	# Ensure the item's really a Git repository
	[ -d "$i/.git" ] && { echo $(

		cd $i;
		
		# This repo's been flagged as exempt from updates; skip it
		[ $(git config updates.skip) ] && marker $RED "Skipping: $i" || {
			marker $BLUE "Updating: $i"

			# Update!
			git status --porcelain && { git pull; };
		};

	); };
	
	
	# Is this a Subversion repository instead?
	[ -d "$i/.svn" ] && { echo $(
		
		cd $i;
		
		# Drop another divider to break feedback up a little
		marker $BLUE "Updating: $i"
		
		# Clear .DS_Store crap if possible
		hash dsclean 2>/dev/null && dsclean;
		
		# Update!
		svn update;
	); };
done;

Allow local repos to exempt themselves from updates
Allow local repos to exempt themselves from updates

Running `git config updates.skip true` in a repo will flag it to exclude
it from periodic updates. This might be helpful when working on a forked
Atom package.
