0

Private pub gem需要额外的 Faye 服务器来服务消息队列。它通过以下命令与 rails 服务器并行启动:rackup private_pub.ru -s thin -E production

为了通过某些规范,还需要此服务器。所以我在 .travis.yml 中包含了它的启动命令:

language: ruby
services:
  - postgresql
  - rack

before_script:
  - rackup private_pub.ru -s thin -E production
  - cp config/database.yml.travis config/database.yml
  - psql -c 'create database travis_ci_test;' -U postgres

但是在构建过程中,这个命令会引发错误:

0.00s$ rackup private_pub.ru -s thin -E production
/home/travis/build.sh: line 45: rackup: command not found
The command "rackup private_pub.ru -s thin -E production" failed and exited with 127 during .

我究竟做错了什么?

4

1 回答 1

1

没有找到 rackup 命令。您需要像这样使用 bundler exec 运行 rackup(假设 rack 等在您的 Gemfile 中):

before_script:
  - bundle exec rackup private_pub.ru -s thin -E production &

使用 bundle exec 使用 gemfile 中的内容而不是系统上的内容(在这种情况下,它不在系统上,因此您会收到错误消息)。这是一个很好的链接,它解释了有关 rack 和 bundle exec 的更多信息:https ://robots.thoughtbot.com/but-i-dont-want-to-bundle-exec

在 Travis 上,您也不需要将机架添加到服务中,只需将其放在 Gemfile 中即可。:)

于 2016-04-07T16:02:48.483 回答