【发布时间】:2014-01-22 14:54:36
【问题描述】:
我想在 Heroku 上部署一个 angular+rails 应用程序。该应用基于 Emmanual Oda's example code 构建,并使用 Grunt 编译其资产。
与其在本地编译我的资产然后将它们提交到 git,我更愿意在 Heroku 上编译它们。也就是说,我想在部署我的应用程序时自动在 Heroku 上运行 grunt build。
有谁知道我可以如何配置 Heroku 来做到这一点?
编辑
我知道使用 Node.js 应用程序可以进行服务器端资产编译,例如使用 mbuchetics' fork of the heroku nodejs buildpack。但是,当我按照该站点上的说明推送到 Heroku 时,出现以下错误
-----> Fetching custom git buildpack... done
! Push rejected, no Cedar-supported app detected
编辑 2
目前我正在使用在本地运行 grunt build 的 Rake 任务进行部署。
task :deploy do
system("rm -rf ./public/*") # empty the public directory
system("cd ngapp; grunt build")
# make a bogus manifest file to turn off asset compilation on heroku
# see here: https://devcenter.heroku.com/articles/rails-asset-pipeline
system("mkdir public/assets; touch public/assets/manifest-098f6bcd4621d373cade4e832627b4f6.json")
system("git add public/")
system("git commit -m \"deploying...\"")
system("git push heroku master")
end
最好使用服务器端解决方案!
【问题讨论】:
-
您需要使用 Heroku grunt buildpack。好久没用了,可能帮不上什么忙。
-
我试过这个,我得到一个
push rejected错误。请参阅上面的我的编辑。知道我做错了什么吗?
标签: ruby-on-rails git angularjs heroku gruntjs