Godzilla74
Godzilla74

Reputation: 2502

Require forked gem in bundle

I had to fork a gem from github and make some code changes to suit my needs. I then put it in my own github repo using this resource.

Now, for my app, I've added the gem to my Gemfile:

source 'https://rubygems.org'

gem 'openvas-omp', :git => 'git://github.com/godzilla74/openvas-omp-ruby.git'

Ran bundle install and now I'm trying to run my app but it's throwing an error saying that it can't load my gem:

/Users/godzilla74/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- openvas-omp-ruby (LoadError)
    from /Users/godzilla74/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from omp.rb:7:in `<main>'

My app is pretty simple so far. It's just one file omp.rb:

...some other requires....
require 'openvas-omp'

ov = OpenVASOMP::OpenVASOMP.new("host" => "10.10.10.200", "port" => "9390", "user" => 'admin', "password" => 'admin')
puts ov

Here is my current tree of the omp app folder:

.
├── Gemfile
├── Gemfile.lock
├── omp.rb

Have I gone about implementing the gem incorrectly? From what I understand, I can't simply run the command gem install openvas-omp because that will pick up on the original github repo which I forked.

Upvotes: 1

Views: 195

Answers (1)

Alex Kojin
Alex Kojin

Reputation: 5204

You can run you code with bundle exec ruby omp.rb

Or you can define bundler in the top of your code:

# activate bundler
require 'bundler/setup'
# require all gems
Bundler.require

and run it ruby omp.rb

Upvotes: 1

Related Questions