bundler - Using a gem in a pure ruby script (not Rails) -


a ruby file:

gem "my-gem", git: "https://github.com/gem123.git", branch: "some-branch" require "my-gem"  var1 = somegem::some_method123 puts var1 

it says could not find 'my-gem' (>= 0) among 330 total gem(s) (gem::loaderror). why not? need special branch of gem , don't want clone repository.

use bundler. create gemfile along side ruby script.

in gemfile, add:

gem "my-gem", git: "https://github.com/gem123.git", branch: "some-branch" 

make sure bundler installed:

gem install bundler 

and install required gems:

bundle install 

now initialize bundler @ top of script:

require 'rubygems' require 'bundler/setup'  # require gems usual require 'my-gem' 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -