I need to run a bunch of ruby scripts that I have written on a server that I don't have sudo access to.
On my own machine, I have installed a bunch of gems using 'sudo gem install ..' and used them in my code..
Is there any mechanism which would let me use these gems without formally installing them on a remote machine?
相关问题
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
- ruby 1.9 wrong file encoding on windows
- gem cleanup shows error: Unable to uninstall bundl
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- uninitialized constant Mysql2::Client::SECURE_CONN
- ruby - simplify string multiply concatenation
You can install them in a user directory: http://docs.rubygems.org/read/chapter/3#page83
This looks like it lets you install the gems anywhere you want.
You can, but it's tricky.
First, install them using the
--install-dir
option, i.e.:Second, make sure you have a
.gemrc
file in your home directory that looks something like this:gemhome
is where gems should look first when seeking a gem.gempath
is all the paths it should check in when seeking a gem. So in the.gemrc
above, I'm telling my code to look first in the local directory, and if not found, check the system gem directory.Third, be aware that some code - even code within gems - can make assumptions about where gems are located. Some code may programmatically alter
gempath
orgemhome
. You may need to "alter it back" in your own code.There's not a lot (read: no) documentation on how to do that - the best way to figure it out is to read the tests that are included with the RubyGems source. Here's how I hack the gem paths in a rake task to point to my frozen version of capistrano: