I am slowly learning Ruby as well as Sinatra. Now I would like to have
two different projects on my machine, both using Sinatra, the same
version of Ruby (2.1.2). I have installed Bundler and have separated
vendor/bundle folders inside projects’ folders. I am using .rbenv with
ruby-build plugin.
In the first project I have three files, something like 1) server.rb, 2)
config.ru, 3) Gemfile. It includes basic things needed for running the
very basic project with Sinatra. Bundler worked well as well as
everything at all. It is possible to use “bundle exec rackup -p ‘port’”,
WEBrick is started, everything smooth. I have not tested another server
yet.
The problem is with the second project. There I have even more basic
setting. Later I wish I was able to run it via Thin server.
-
server.rb
#!/usr/bin/ruby
require ‘sinatra’
get ‘/’ do
“Hello, world!”
end -
gems included
rack-protection-1.5.3
rack-1.5.2
sinatra-1.4.5
tilt-1.4.1
Than it says:
ruby server.rb
/home/user/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
require': cannot load such file -- sinatra (LoadError) from /home/user/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require’
from server.rb:3:in `’
Of course I had used rbenv rehash for sure.
When I am trying to run the whole thing after properly installing Thin
via Bundler as bundle exec thin start, it says:
No adapter found for /home/user/git/sinatra-training found for
/home/honza/git/sinatra-training-oreilly
Bundler says everything is ok. I have no idea where could be the
problem…
Any help appreciated!