Sha256: d746d78fc5d5da9822000dddab5efaf01f63b43083e6f576282b27a5837cc625

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

#!/bin/bash

: ${_JASON_RUBY:=}

function sub {
  local bsource="$1"; shift
  local sub_base="$(basename "$bsource")"
  local bsource_cmd="$shome/libexec/${sub_base}"

  local ruby_loader=
  if [[ -n "$_JASON_RUBY" ]]; then
    ruby_loader="rvm-exec $_JASON_RUBY "
  fi

  if [[ "$bsource_cmd" = "$bsource" ]]; then
    FLAGS_SUB="$FLAGS_TRUE"
    parse_command_line "$@" || exit $?
    eval set -- "${FLAGS_ARGV}"
  fi

  if [[ "$#" > 0 ]]; then
    if [[ ! "$1" =~ ^- ]]; then
      local sub_cmd="$(command -v "${sub_base}-$1" || true)"
      if [[ ! -x "$sub_cmd" ]]; then
        sub_cmd="$shome/libexec/${sub_base}-$1"
      fi

      if [[ -x "$sub_cmd" ]]; then
        shift
        exec ${ruby_loader}"$sub_cmd" "$@"
      fi
    fi
  fi

  if [[ -x "$bsource_cmd" && "$bsource_cmd" != "$bsource" ]]; then
    exec ${ruby_loader}"$bsource_cmd" "$@"
  else
    main "$@"
  fi
}

if [[ "$shome/config/deploy.yml" ]]; then
  export _JASON_RUBY="$(ryaml "$shome/config/deploy.yml" "app_ruby")"
fi

if [[ ! -x "$(which rvm-exec 2>&1 || true)" ]]; then
  PATH="$PATH:$HOME/.rvm/bin:/usr/local/rvm/bin"
fi

if [[ "$#" > 0 ]]; then
  sub "$@"  
fi

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alpha_omega-1.3.3 libexec/_sub
alpha_omega-1.3.2 libexec/_sub
alpha_omega-1.3.1 libexec/_sub