Sha256: c0127a880671579acef204319fc1ca88546841c4918c245720534001639d2ce3

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env bash

rvm_base_except="selector"
source "$rvm_scripts_path/base"
source "$rvm_scripts_path/patches"

lookup_patchset() {
  if [[ -z "$1" ]]; then
    echo "Usage: rvm patchset show name"
    return 1
  fi
  for lookup_path in $(__rvm_ruby_string_paths_under "$rvm_patchsets_path") ; do
    if [[ -s "$lookup_path/$1" ]]; then
      cat "$lookup_path/$1"
      return
    fi
  done; unset lookup_path
  return 1
}

# Return the full patch for a given patch.
__rvm_lookup_full_patch_path() {
  # Absolute path, pwd and then finally the rvm patches path.
  for directory in $(__rvm_patch_lookup_path) ; do
    for extension in {"",.patch,.diff}; do
      patch_path="${directory}${1}${extension}"
      if [[ -s "$patch_path" ]]; then
        echo "$patch_path"
        return
      fi
    done; unset extension patch_path
  done; unset directory
  return 1
}

usage() {
  echo "Usage: 'rvm patchset {show,lookup} [patchset]'"
  echo "        Tools for manipulating patchsets."
  return 1
}

args=($*)
action="${args[0]}"
patchset="${args[1]}"
args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.

case "$action" in
  show|lookup) lookup_patchset "$patchset" ;;
  *) usage ;;
esac

exit $?

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rvm-1.0.6 scripts/patchsets
rvm-1.0.5 scripts/patchsets
rvm-1.0.4 scripts/patchsets
rvm-1.0.3 scripts/patchsets