Sha256: f14d527c265bbf37076f1c6cf6e89c45a6c7249a2fb8278098563f9b2d9768ba
Contents?: true
Size: 1.56 KB
Versions: 5
Compression:
Stored size: 1.56 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="$(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
5 entries across 5 versions & 1 rubygems