aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_utils/ruby.sh
blob: abcd9b741b9f700817b6551b681e6ccc8799ec31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash

# Copyright (c) 2016 Egor Tensin <Egor.Tensin@gmail.com>
# This file is part of the "Cygwin configuration files" project.
# For details, see https://github.com/egor-tensin/cygwin-home.
# Distributed under the MIT License.

source "$HOME/.bash_utils/path.sh"

ruby_setup() {
    local user_dir
    local bin_dir

    command -v ruby &> /dev/null                       \
        && command -v gem &> /dev/null                 \
        && user_dir="$( ruby -e 'puts Gem.user_dir' )" \
        && export GEM_HOME="$user_dir"                 \
        && bin_dir="$( ruby -e 'puts Gem.bindir' )"    \
        && path_export "$bin_dir"
}

ruby_setup