Sha256: d7c04c5f3aa2aa4942d2421d73f0c734734febe60810a29c60fec708cc4f2c12

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 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"

# entry point
function main {
  if [[ "$FLAGS_public" = "$FLAGS_TRUE" ]]; then
    push_gem "$@"
  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 http://localhost:9292 "$@"
  fi
}

# push the latest gem to rubygems.org
function push_gem {
  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

10 entries across 5 versions & 3 rubygems

Version Path
ghp-0.0.2 libexec/publish-gem
ghp-0.0.2 libexec/publish
opsdb-0.0.1 libexec/publish
opsdb-0.0.1 libexec/publish-gem
alpha_omega-1.5.15 libexec/publish-gem
alpha_omega-1.5.15 libexec/publish
alpha_omega-1.5.14 libexec/publish-gem
alpha_omega-1.5.14 libexec/publish
alpha_omega-1.5.12 libexec/publish
alpha_omega-1.5.12 libexec/publish-gem