#!/bin/bash #/ NAME #/ build-gem -- upload the latest (timestamp) rubygem to rubygems.org #/ #/ SYNOPSIS #/ build gem -n gem_name # figure out the project root under which bin, lib live shome="$(unset CDPATH; cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)" # load a jason bourne library source "$shome/libexec/_jason" # entry point function main { if [[ "$#" = 0 ]]; then set -- "$shome/$(basename "$shome").gemspec" fi cd "$shome" for pth_gemspec in "$@"; do if [[ -d "$pth_gemspec" ]]; then local a for a in $(set +f; ls -d $pth_gemspec/*); do if [[ -d "$a" ]]; then pushd $a > /dev/null (set +f; rm -f *.gem) (export EDIT_$(basename ${a//-/_})=1; gem build $(basename $(pwd)).gemspec) (set +f; mv *.gem $shome/vendor/cache/) popd > /dev/null fi done elif [[ -e "$pth_gemspec" ]]; then gem build "$pth_gemspec" else logger_fatal "could not find gemspec $pth_gemspec" exit 1 fi done } require sub "$BASH_SOURCE" "$@"