ruby - 如何在 Travis CI 的 macOS 中更改 Homebrew 的 Ruby 版本?

标签 ruby macos homebrew travis-ci

努力奔跑

if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi

before_install 中,我最终得到了

/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in \`<main>': Homebrew must be run under Ruby 2.3! (RuntimeError)  

The command "if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi" failed and exited with 1 during .

Your build has been stopped.

/Users/travis/.travis/job_stages: line 166: shell_session_update: command not found  

所以我假设这里的问题是 ruby 是 2.0 版,我用 ruby --version 确认了这一点。有趣的是,我的构建突然停止工作,没有对 .travis.yml 进行任何更改。
那么我该如何实际更改 Ruby 版本呢?

可能很重要,但在 git clone 运行之前我得到了这个:

$ rvm use

Warning! PATH is not properly set up, '/Users/travis/.rvm/gems/ruby-2.0.0-p648/bin' is not at first place,

         usually this is caused by shell initialization files - check them for 'PATH=...' entries,

         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',

         to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p648'.

最佳答案

您的选择似乎是使用

brew update
brew install whatever

HOMEBREW_NO_AUTO_UPDATE=1 brew install whatever

travis documentation中的建议如果似乎不需要 brew update ,那么当 brew 的 ruby​​ 要求发生变化时,您将面临随机损坏的风险......

关于ruby - 如何在 Travis CI 的 macOS 中更改 Homebrew 的 Ruby 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46670305/

相关文章:

erlang - 制作rabbitmq需要多长时间?

fortran - 无法通过 Homebrew 软件安装 gfortran

ruby-on-rails - 安装 posix spawn 时出现 UTF-8 设置问题

Ruby EventMachine,终止正在运行的进程?

windows - 如何使用 OS X 创建 MSI 安装程序?

macos - 如何激活不同类别的附件标题栏 View Controller 中的微调器?

macos - 如何格式化 date -u 以便结果包括 Mac OSX 终端 session 中的时区偏移?

mongodb - 在mac中安装mongo shell

ruby-on-rails - 在 ruby​​ 中转义双引号

ruby - 如何打破 while = gets