Heroku和Github集成(如何构建项目) [英] Heroku and Github integration (how to structure the project)

查看:112
本文介绍了Heroku和Github集成(如何构建项目)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个webservice,我想将源存储在github上,并在heroku上运行应用程序。我没有看到我的确切情况在net到目前为止的任何地方,所以我会在这里问:



我想要有以下目录结构: / p>

  / project 
.git
README< - 项目自述文件
TODO.otl < - 项目大纲
...< - 其他项目相关的东西
/ my_rails_app
app
config
...
README < - rails'自述文件

在上面,项目对应于 http://github.com/myuser/project ,my_rails_app是应该被推送到heroku的代码。我需要一个单独的分支的rails应用程序,还是有一个更简单的方法,我失踪了?



我想我的项目相关的非rails文件可以生活在my_rails_app中,但是README已经存在了,因此覆盖它似乎不一致。但是,如果我离开,我的github页面的rails应用程序将包含rails自述,这是没有意义的。



另外...我试过只是设置它如上所述,并运行

  git push heroku 

从主项目文件夹。当然,heroku不知道我想要部署子文件夹:

  -----> Heroku收到推
! Heroku推送拒绝,没有检测到Rails或Rack应用程序。


解决方案

这是一个简单的解决方案,可能或可能不适用于你。


  • 在GitHub上创建两个项目。一个项目应该只是Rails应用程序(即Rails应用程序目录中的所有内容)。另一个项目应该是Rails应用程序目录之外的所有内容。


  • 将Rails应用程序项目作为容器项目中的git子模块添加。 >


  • 现在,您可以单独在Rails应用程序存储库中添加Heroku作为远程,并将其推送到heroku。 Heroku将接受推送,因为它只是一个具有预期目录和文件的Rails应用程序。



I'm creating a webservice and I want to store the source on github and run the app on heroku. I haven't seen my exact scenario addressed anywhere on the 'net so far, so I'll ask it here:

I want to have the following directory structure:

/project
  .git
  README <-- project readme file
  TODO.otl <-- project outline
  ... <-- other project-related stuff
  /my_rails_app
     app
     config
     ...
     README <-- rails' readme file 

In the above, project corresponds to http://github.com/myuser/project, and my_rails_app is the code that should be pushed to heroku. Do I need a separate branch for the rails app, or is there a simpler way that I'm missing?

I guess my project-related non-rails files could live in my_rails_app, but the rails README already lives there and it seems inconsistent to overwrite that. However, if I leave it, my github page for the rails app will contain the rails readme, which makes no sense.

Also ... I tried just setting it up as described above and running

git push heroku

from the main project folder. Of course, heroku doesn't know I want to deploy the subfolder:

-----> Heroku receiving push
 !     Heroku push rejected, no Rails or Rack app detected.

解决方案

Here's a simple solution that may or may not work for you.

  • Create two projects on GitHub. One project should be just the Rails app (i.e. everything inside the Rails app directory). The other project should be everything outside the Rails app directory.

  • Add the Rails app project as a git-submodule within the "container" project.

  • Now you can add Heroku as a remote on the Rails app repository separately and push it to heroku. Heroku will accept the push because it is just a Rails app with the expected directories and files.

这篇关于Heroku和Github集成(如何构建项目)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆