aboutsummaryrefslogtreecommitdiff
path: root/.config/fish/conf.d/rvm.fish
blob: 0b00091d6dd184371539f038f52b6a6442fd583c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
rvm current 1>/dev/null 2>&1

function __check_rvm --on-variable PWD -d 'Setup rvm on directory change'
  status --is-command-substitution; and return
  if test "$rvm_project_rvmrc" != 0
    set -l cwd $PWD
    while true
      if contains $cwd "" $HOME "/"
        if test "$rvm_project_rvmrc_default" = 1
          rvm default 1>/dev/null 2>&1
        end
        break
      else
        if begin
            test -s ".rvmrc"
            or test -s ".ruby-version"
            or test -s ".ruby-gemset"
            or test -s ".versions.conf"
            or test -s "Gemfile"
          end
          rvm reload 1> /dev/null 2>&1
          rvm rvmrc load 1>/dev/null 2>&1
          break
        else
          set cwd (dirname "$cwd")
        end
      end
    end
    set -e cwd
  end
end