문제

I am a beginner in ruby, and i have a problem using my ruby script, that work on my computer, on a server.

My problem is that i don't become to require 'rack/cors' and require 'grape'

On my computer it works, without using any trick. But on the server ruby is installed on home directory. I became to require cors using require '../ruby/gems/gems/rack-cors-0.2.7/lib/rack/cors', but it feels like it's dirty so i would like to know if there is a better way to do this.

I did not became to use RUBYLIB env variable or -I of ruby.

My final goal is to use rack, so using rackup to launch my server.

도움이 되었습니까?

해결책

If you were using Bundler, none of this would be an issue.

It allows you to install gems into arbitrary locations, but more importantly, loads them from whatever location you've installed them in automatically.

다른 팁

By adding new dir into $LOAD_PATH

$LOAD_PATH.unshift YOUR_RACK_PATH unless $LOAD_PATH.include? YOUR_RACK_PATH
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top