1 Star 8 Fork 0

RubyMetric/rbenv-for-windows

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rbenv-global.ps1 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
曾奥然 提交于 2023-09-25 21:42 +08:00 . Fix rbenv global
# Usage: rbenv global [<version>]
# Summary: Set or show the global Ruby version
param($cmd)
function get_global_version() {
# common.d will ensure a global.txt (but empty)
$cont = Get-Content $GLOBAL_VERSION_FILE
if (!$cont) {
warn "rbenv: No global version has been set, use rbenv global <version>"
} else {
$cont
}
}
function set_global_version($version) {
$version = auto_fix_version_for_installed $version
$version | Out-File $GLOBAL_VERSION_FILE -NoNewline -Encoding ascii
success "rbenv: Change to global version '$version'"
# <2023-05-05> Although I've fixed the bug of bundler process to successfully trigger
# the post-install hook in the share/rubygems_plugins.rb
# And then, `rbenv rehash` after a `rbenv global` is no longer needed.
#
# But I think it now can be a second safeguard to ensure all gems' executables are there
# in the shims dir. So I keep this statement.
rbenv rehash version $version
}
if (! $cmd) {
get_global_version
} else {
set_global_version $cmd
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PowerShell
1
https://gitee.com/RubyMetric/rbenv-for-windows.git
git@gitee.com:RubyMetric/rbenv-for-windows.git
RubyMetric
rbenv-for-windows
rbenv-for-windows
main

搜索帮助