我有一个如下目录结构:
my-app/
.git/
db/ <-- Database stuff
lib/ <-- Business logic
spec/
web/ <-- Rails
Rails位于存储库的web/
子目录中。 Heroku默认不喜欢这个。
我有partially working heroku buildpack。在运行任何任务之前,它基本上调用Dir.chdir
来更改为APP_SUBDIR
环境变量(如果存在)。
我想部署到Heroku,但我无法让资产管道任务工作。在预编译资产时,定制的buildpack将更改为web/
目录并尝试运行任务。
然而,I get this error,包含以下重要内容:
Could not detect rake tasks
ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
and using the production group of your Gemfile.
Your Ruby version is 1.9.2, but your Gemfile specified 2.0.0 (Bundler::RubyVersionMismatch)
这很奇怪,因为Heroku清楚地说我在同一个牧场上运行2.0。事实上,当我跑:
$ heroku run 'cd web; bundle exec rake -P'
它运作得很好。
TL; DR(摘要)
Heroku认为我的ruby版本是1.9.2
,当它真的是2.0.0
shown in its own build process时。为什么会这样?
答案 0 :(得分:0)
您只能将Rails应用程序所在的子目录推送到Heroku:
git subtree push --prefix web heroku master
web
是子目录。