Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
20ecca2b
Commit
20ecca2b
authored
May 08, 2019
by
Thomas Kriechbaumer
Committed by
Marc Cornellà
May 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rbenv: improve rbenv loading based on pyenv (#7626)
parent
4cadbcd2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
42 deletions
+47
-42
pyenv.plugin.zsh
plugins/pyenv/pyenv.plugin.zsh
+1
-1
rbenv.plugin.zsh
plugins/rbenv/rbenv.plugin.zsh
+46
-41
No files found.
plugins/pyenv/pyenv.plugin.zsh
View file @
20ecca2b
...
@@ -38,4 +38,4 @@ else
...
@@ -38,4 +38,4 @@ else
}
}
fi
fi
unset
FOUND_PYENV
dir
unset
FOUND_PYENV
pyenvdirs
dir
plugins/rbenv/rbenv.plugin.zsh
View file @
20ecca2b
_homebrew-installed
()
{
# This plugin loads rbenv into the current shell and provides prompt info via
type
brew &> /dev/null
# the 'rbenv_prompt_info' function.
}
FOUND_RBENV
=
$+
commands[rbenv]
FOUND_RBENV
=
0
rbenvdirs
=(
"
$HOME
/.rbenv"
"/usr/local/rbenv"
"/opt/rbenv"
"/usr/local/opt/rbenv"
)
if
[[
$FOUND_RBENV
-ne
1
]]
;
then
if
_homebrew-installed
&&
rbenv_homebrew_path
=
$(
brew
--prefix
rbenv 2>/dev/null
)
;
then
rbenvdirs
=(
"
$HOME
/.rbenv"
"/usr/local/rbenv"
"/opt/rbenv"
"/usr/local/opt/rbenv"
)
rbenvdirs
=(
$rbenv_homebrew_path
"
${
rbenvdirs
[@]
}
"
)
for
dir
in
$rbenvdirs
;
do
unset
rbenv_homebrew_path
if
[[
-d
$dir
/bin
]]
;
then
if
[[
$RBENV_ROOT
=
''
]]
;
then
export
PATH
=
"
$dir
/bin:
$PATH
"
RBENV_ROOT
=
"
$HOME
/.rbenv"
FOUND_RBENV
=
1
break
fi
fi
done
fi
fi
for
rbenvdir
in
"
${
rbenvdirs
[@]
}
"
;
do
if
[[
$FOUND_RBENV
-ne
1
]]
;
then
if
[
-d
$rbenvdir
/bin
-a
$FOUND_RBENV
-eq
0
]
;
then
if
((
$+
commands[brew]
))
&&
dir
=
$(
brew
--prefix
rbenv 2>/dev/null
)
;
then
if
[[
-d
$dir
/bin
]]
;
then
export
PATH
=
"
$dir
/bin:
$PATH
"
FOUND_RBENV
=
1
FOUND_RBENV
=
1
if
[[
$RBENV_ROOT
=
''
]]
;
then
RBENV_ROOT
=
$rbenvdir
fi
fi
export
RBENV_ROOT
fi
export
PATH
=
${
rbenvdir
}
/bin:
$PATH
fi
if
[[
$FOUND_RBENV
-eq
1
]]
;
then
eval
"
$(
rbenv init
--no-rehash
- zsh
)
"
eval
"
$(
rbenv init
--no-rehash
- zsh
)
"
alias
rubies
=
"rbenv versions"
alias
rubies
=
"rbenv versions"
...
@@ -33,7 +37,7 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
...
@@ -33,7 +37,7 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
echo
"
$(
rbenv gemset active 2&>/dev/null |
sed
-e
":a"
-e
'$ s/\n/+/gp;N;b a'
|
head
-n1
)
"
echo
"
$(
rbenv gemset active 2&>/dev/null |
sed
-e
":a"
-e
'$ s/\n/+/gp;N;b a'
|
head
-n1
)
"
}
}
function
gems
{
function
gems
()
{
local
rbenv_path
=
$(
rbenv prefix
)
local
rbenv_path
=
$(
rbenv prefix
)
gem list
$@
|
sed
-E
\
gem list
$@
|
sed
-E
\
-e
"s/
\(
[0-9a-z,
\.
]+( .+)?
\)
/
$fg
[blue]&
$reset_color
/g"
\
-e
"s/
\(
[0-9a-z,
\.
]+( .+)?
\)
/
$fg
[blue]&
$reset_color
/g"
\
...
@@ -49,12 +53,13 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
...
@@ -49,12 +53,13 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
echo
"
$(
current_ruby
)
"
echo
"
$(
current_ruby
)
"
fi
fi
}
}
fi
else
done
alias
rubies
=
"ruby -v"
unset
rbenvdir
function
gemsets
()
{
echo
"not supported"
}
function
current_ruby
()
{
echo
"not supported"
}
if
[
$FOUND_RBENV
-eq
0
]
;
then
function
current_gemset
()
{
echo
"not supported"
}
alias
rubies
=
'ruby -v'
function
gems
()
{
echo
"not supported"
}
function
gemsets
()
{
echo
'not supported'
}
function
rbenv_prompt_info
()
{
echo
"system:
$(
ruby
-v
|
cut
-f-2
-d
' '
)
"
}
function
rbenv_prompt_info
()
{
echo
"system:
$(
ruby
-v
|
cut
-f-2
-d
' '
)
"
}
fi
fi
unset
FOUND_RBENV rbenvdirs
dir
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment