Sha256: 8bfe0102662cf11304f40fc5d361de16a8da881361e59edb7aba4af0dcf84bd3

Contents?: true

Size: 1.42 KB

Versions: 23

Compression:

Stored size: 1.42 KB

Contents

#!/usr/bin/env bash

#!/usr/bin/env bash
rvm_base_except="selector"
source "$rvm_path/scripts/base"

usage()
{
  printf "Usage: 'rvm disk-usage {all,archives,repos,sources,logs,packages,rubies,gemsets}'\n"
  printf "       Lists the space rvm uses for a given item.\n"
  exit 1
}

disk_usage_for_directory()
{
  du -hs "$1" | awk '{print $1}'
}

disk_usage()
{
  local current_path="$rvm_path/$2"
  if [[ -n "$current_path" && -d "$current_path" && "$current_path" != "/" ]]; then
    echo "$1 Usage: $(disk_usage_for_directory "$current_path")"
  fi
  return 0
}

all_disk_usage()
{
  archives_disk_usage
  repos_disk_usage
  sources_disk_usage
  logs_disk_usage
  packages_disk_usage
  rubies_disk_usage
  gemsets_disk_usage
  total_disk_usage
}

total_disk_usage()
{
  echo "Total Disk Usage: $(disk_usage_for_directory "$rvm_path")"
}

archives_disk_usage() { disk_usage "Downloaded Archives" "archives"; }
repos_disk_usage()    { disk_usage "Repositories" "repos"; }
sources_disk_usage()  { disk_usage "Extracted Source Code" "src"; }
logs_disk_usage()     { disk_usage "Log Files" "log"; }
packages_disk_usage() { disk_usage "Packages" "usr"; }
rubies_disk_usage()   { disk_usage "Rubies" "rubies"; }
gemsets_disk_usage()  { disk_usage "Gemsets" "gems"; }


# Exit when there is no argument.
[[ -z "$1" ]] && usage

case "$1" in
  all|archives|repos|sources|logs|total|packages|rubies|gemsets) eval "$1_disk_usage" ;;
  *)        usage ;;
esac

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
gemrage-0.1.2 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/disk-usage
rvm-1.0.14 scripts/disk-usage
rvm-1.0.13 scripts/disk-usage