Skip to content

Instantly share code, notes, and snippets.

@pahagon
Created August 15, 2012 18:34
Show Gist options
  • Save pahagon/3362194 to your computer and use it in GitHub Desktop.
Save pahagon/3362194 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
function update_gem_ref {
__rails_root=$1
__gemfile=$__rails_root/Gemfile
__gem_name=$2
__gem_path=$3
__old_ref=$(grep $__gem_name $__gemfile | grep ref | cut -d ',' -f3 | sed 's/^ *//g')
__new_ref=$(cd $__gem_path && git log --pretty=format:%h -1)
cd $__rails_root
__cmd="sed -i '' 's/$__old_ref/:ref => \"$__new_ref\"/' $__gemfile"
echo $__cmd | sh
echo "$__gem_name from $__old_ref to $__new_ref"
}
update_gem_ref $PWD "eden_account" ${1-"../account"}
update_gem_ref $PWD "abacos_wms" ${2-"../abacos_wms"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment