Sha256: 109465c7d47e36f242f827937a328a22359105d274f4e3e0afbfbfbe36e9e1fc

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

#!/usr/bin/env bash

rvm_base_except="selector"

source "$rvm_path/scripts/base"

source "$rvm_path/scripts/patches"

lookup_patchset() {

  local paths lookup_path

  if [[ -z "$1" ]]; then
    echo "Usage: rvm patchset show name"
    return 1
  fi

  paths=($(__rvm_ruby_string_paths_under "$rvm_path/patchsets"))

  for lookup_path in "${paths[@]}" ; do

    if [[ -s "$lookup_path/$1" ]]; then

      cat "$lookup_path/$1"

      return 0
    fi
  done

  return 1
}

# Return the full patch for a given patch.
__rvm_lookup_full_patch_path() {

  local directory directories extension patch_path

  directories=($(__rvm_patch_lookup_path))

  # Absolute path, pwd and then finally the rvm patches path.
  for directory in "${directories[@]}" ; do

    for extension in {"",.patch,.diff}; do

      patch_path="${directory}${1}${extension}"

      if [[ -s "$patch_path" ]]; then
        echo "$patch_path"
        return
      fi

    done

  done

  return 1
}

usage() {
  printf "

  Usage:

    rvm patchset {show,lookup} [patchset]

  Description:

    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

5 entries across 5 versions & 1 rubygems

Version Path
rvm-1.0.11 scripts/patchsets
rvm-1.0.10 scripts/patchsets
rvm-1.0.9 scripts/patchsets
rvm-1.0.8 scripts/patchsets
rvm-1.0.7 scripts/patchsets