Reputation: 44842
I'm new to ruby gems and I'm wondering.. if I was using an API from Ruby gems to write a script and I then exported the script to a server for it to run there, would I have to install the gem on the server? Is there know way for me to bundle it up into 1 file I just run? (like a Java jar)
Upvotes: 0
Views: 374
Reputation: 961
I usually just create a vendor directory in my application and extract your gems there. gem unpack gem_name
will do it for you or you can use Rails' rake gem:unpack GEM=gem_name
.
Bundler is another great solution but if you just want a quick and dirty solution then just unpack the gem into your application and be done with it.
Upvotes: 0
Reputation: 3844
Simply include your gem in your gem file, then when you deploy and run bundle install
on the server it will get all your dependencies including your gem
Upvotes: 2
Reputation: 42178
bundle package
will package all your gems into your rails app.
Upvotes: 2
Reputation: 3505
Bundler install your gem for you , but it dosn't include the gem in your script. if you dont have many dependencies you could try to simple unpack the gem in to a folder , you have to require the gem following your relative path , the main problem is if some of your gem have to compile native code (like hpricot) . use
gem unpack GEMNAME
into your script folder and then locate the main file to require in your code (usualy in a lib direcotory into the unpacked gem) . this work easly only for simple gems without chain dependencies.
Upvotes: 1