我有一个 sinatra 应用程序。 (Heroku 确实支持 Sinatra)。
heroku 博文中的说明不完整
https://blog.heroku.com/32_deploy_merb_sinatra_or_any_rack_app_to_heroku
我的程序在本地运行良好,但在尝试推送到 heroku 时出现错误。
heroku 博文不包括制作 gemfile 和进行捆绑安装的需要。该程序在本地运行良好,但要使其在 heroku 上运行,它需要一个 Gemfile 并在其上安装包。
https://teamtreehouse.com/community/how-can-i-make-my-sinatra-app-public 这里的这个链接提到我需要一个 Gemfile,并提到了 Gemfile 的内容。然后进行捆绑安装。然后,一旦完成,然后按照该 heroku 博客文章中的说明制作程序文件,以及 config.ru 和 git repo 并执行 heroku create(这也创建远程),然后 git push heroku master。
即
树屋链接中提到的 Gemfile
# define our source to look for gems
source "http://rubygems.org/"
# declare the sinatra dependency
gem "sinatra"
然后 bundle install 来安装 Gemfile。
bundle install
hello.rb(如 heroku 博文中所述)
require 'rubygems'
require 'sinatra'
get '/' do
"Hello from Sinatra on Heroku!"
end
config.ru
require './hello'
run Sinatra::Application
混帐
$ git init
Initialized empty Git repository in /Users/adam/hello/.git/
$ git add .
$ git commit -m "sinatra and heroku, two great tastes"
[master (root-commit)]: created 93a9e6d: "sinatra and heroku, two great tastes"
2 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 config.ru
create mode 100644 hello.rb
heroku 创建
$ heroku create
Created http://severe-spring-77.heroku.com/ | git@heroku.com:severe-spring-77.git
Git remote heroku added
向heroku推送
$ git push heroku master
Counting objects: 4, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 385 bytes, done.
Total 4 (delta 0), reused 0 (delta 0)
-----> Heroku receiving push
-----> Verifying repository integrity... done, looks like a Rack app.
Compiled slug size is 0.1MB
-----> Launching....... done
App deployed to Heroku
To git@heroku.com:severe-spring-77.git
* [new branch] master -> master