2016-12-27 10 views
0

私はを最初に実行しようとしています Ruby/Sinatra deploy(yay!)、"to do list" appウェブサイトへ。コードはこのRuby/SinatraアプリケーションをHerokuにどのように配備できますか?

My humble app

のWindowsとUbuntuの環境で正常に動作が、私は悩み、実際に成功した展開を抱えています。

私自身のコードを使用してthis tutorialに従ってみました。 sudo git push heroku masterを実行すると、アプリがHerokuにデプロイされていると言われますが、URLに移動すると実行されません。 my (one-line) Procfileで助けが必要な場合があります。また、「警告」(展開が行われなかったということですか?)では、Rubyのバージョンを宣言していないと言います。私はrvm 2.2.5を使用し、Gemfilegem 'ruby', '2.2.5'を入れてみましたが、Rubyのバージョンを宣言してもバンドラはインストールされません(Rubyのバージョンがインストールされていないと言えます。

sudo git push heroku master 
Counting objects: 5, done. 
Compressing objects: 100% (4/4), done. 
Writing objects: 100% (5/5), 419 bytes | 0 bytes/s, done. 
Total 5 (delta 3), reused 1 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Ruby app detected 
remote: -----> Compiling Ruby/Rack 
remote: -----> Using Ruby version: ruby-2.2.6 
remote: -----> Installing dependencies using bundler 1.13.6 
remote:  Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment 
remote:  Warning: the running version of Bundler (1.13.6) is older than the version that created the lockfile (1.13.7). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. 
remote:  Fetching gem metadata from https://rubygems.org/......... 
remote:  Fetching version metadata from https://rubygems.org/. 
remote:  Using diff-lcs 1.2.5 
remote:  Using rack 1.6.5 
remote:  Using rspec-support 3.5.0 
remote:  Using ruby 0.1.0 
remote:  Using tilt 2.0.5 
remote:  Using bundler 1.13.6 
remote:  Using rspec-core 3.5.4 
remote:  Using rspec-expectations 3.5.0 
remote:  Using rspec-mocks 3.5.0 
remote:  Using rack-protection 1.5.3 
remote:  Using sinatra 1.4.7 
remote:  Bundle complete! 7 Gemfile dependencies, 11 gems now installed. 
remote:  Gems in the groups development and test were not installed. 
remote:  Bundled gems are installed into ./vendor/bundle. 
remote:  Bundle completed (1.79s) 
remote:  Cleaning up the bundler cache. 
remote:  Warning: the running version of Bundler (1.13.6) is older than the version that created the lockfile (1.13.7). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. 
remote:  Removing dbm (0.5) 
remote: -----> Detecting rake tasks 
remote: 
remote: ###### WARNING: 
remote:  You have not declared a Ruby version in your Gemfile. 
remote:  To set your Ruby version add this line to your Gemfile: 
remote:  ruby '2.2.6' 
remote:  # See https://devcenter.heroku.com/articles/ruby-versions for more information. 
remote: 
remote: -----> Discovering process types 
remote:  Procfile declares types  -> web 
remote:  Default types for buildpack -> console, rake 
remote: 
remote: -----> Compressing... 
remote:  Done: 17.3M 
remote: -----> Launching... 
remote:  Released v5 
remote:  https://gentle-sea-73583.herokuapp.com/ deployed to Heroku 
remote: 
remote: Verifying deploy... done. 
To https://git.heroku.com/gentle-sea-73583.git 
    995b763..014acd8 master -> master 

私はまた、(todo.rbが私のサーバーアプリです)sudo heroku run ruby todo.rbを実行しようとした、と私はこれを取得:たぶん私は何とかHerokuの上でYAMLを設定する必要があり

sudo heroku run ruby todo.rb 
Running ruby todo.rb on ⬢ gentle-sea-73583... up, run.3103 (Free) 
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/yaml/dbm.rb:2:in `require': cannot load such file -- dbm (LoadError) 
    from /app/vendor/ruby-2.2.6/lib/ruby/2.2.0/yaml/dbm.rb:2:in `<top (required)>' 
    from /app/lib/task_store.rb:2:in `require' 
    from /app/lib/task_store.rb:2:in `<top (required)>' 
    from todo.rb:7:in `require' 
    from todo.rb:7:in `<main>' 

を?あなたのGemfileからgem 'dbm'を削除してください。

答えて

1

このdbm gemはjrubyでのみ動作し、yaml/dbmを使用しているので必要ありません。

+0

まあ、私はすでに私のGemfileから宝石「dbm」を取り出していました。しかし、あなたは私にアイデアをくれました。実際、私はyaml/dbm依存関係をオンラインで見つけたものからコピーしていただけで、なぜそれが必要なのか分からなかった。だから私はtask_store.rbからそれを削除して再デプロイしました。 http://simple-to-do.herokuapp.com/を参照してください。 – globewalldesk

関連する問題