Sha256: b98723febeb9aaf7b858555b3a3ac6102e43c11d8c29b9a276b74e7a27957f32
Contents?: true
Size: 1.58 KB
Versions: 24
Compression:
Stored size: 1.58 KB
Contents
#!/bin/bash #/ NAME #/ publish-gem -- publish a gem to a local, remote rubygems, geminabox repository #/ #/ SYNOPSIS #/ publish gem [--public | --private | --local] # 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" # define command line options: DEFINE_boolean "private" "$FLAGS_TRUE" "push to a local, private geminabox" DEFINE_boolean "shared" "$FLAGS_FALSE" "push to a shared, private geminabox" DEFINE_boolean "public" "$FLAGS_FALSE" "push to rubygems.org" DEFINE_string "server" "http://localhost:9292" "geminabox server" # entry point function main { if [[ "$FLAGS_public" = "$FLAGS_TRUE" ]]; then if [[ ! -f "$shome/.private" ]]; then push_gem_public "$@" else logger_fatal "This project is marked private" exit 1 fi elif [[ "$FLAGS_private" = "$FLAGS_TRUE" ]]; then push_gem_private else logger_fatal "must specify --public to confirm a gem push to rubygems.org" exit 1 fi } # push a gem locally function push_gem_private { if [[ "$#" = 0 ]]; then set +f local latest_gem="$(ls -td *.gem 2>&- | head -1)" push_gem_private "$latest_gem" set -f else gem inabox -g "$FLAGS_server" "$@" fi } # push the latest gem to rubygems.org function push_gem_public { set +f local latest_gem="$(ls -td *.gem 2>&- | head -1)" set -f if [[ -z "$latest_gem" ]]; then logger_fatal "no gems found" exit 1 fi gem push "$latest_gem" } require sub "$BASH_SOURCE" "$@"
Version data entries
24 entries across 24 versions & 2 rubygems