LoadError, requiring a stone with: path or: git

I have a really strange problem here.

I forked gemub on github to make some changes, cloned my repo on my local machine, made changes and changed the Gemfile of another project to extract the stone from my local repository to test it. Unfortunately, I get a LoadError by requiring this gem to be in my ruby ​​script.

rvm current => ruby-1.9.3-p448 ruby --version => ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux] bundle --version => Bundler version 1.3.5 

The contents of my gemfile:

 source 'http://rubygems.org gem 'steps', :path => "/home/benny/workspace/steps" 

Package Output:

 $ bundle --no-cache Resolving dependencies... Using colored (1.2) Using highline (1.6.19) Using steps (1.0.2) from source at /home/benny/workspaces/steps Using bundler (1.3.5) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. $ bundle show steps /home/benny/workspaces/steps 

Testing through irb works fine:

 $ bundle exec irb 1.9.3-p392 :001 > require 'rubygems' => false 1.9.3-p392 :002 > require 'steps' => true 

Testing via script does not work:

 $ cat test.rb require 'rubygems' require 'steps' $ ruby test.rb /home/benny/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- steps (LoadError) from /home/benny/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from test.rb:2:in `<main>' 

I'm very confused right now. The same thing happens if I use: git instead: a path with a local git repository or github rep.

Any ideas?

+6
source share
2 answers

Before running test.rb, you need to load the provider environment.

 bundle exec ruby test.rb 
+12
source

You can work with the provider environment through: bundle exec ruby script.rb

Or try installing the package in a script in front of the stone (s) causing the problem. require 'bundler/setup'

Most of the links I learned about this pointed to the documentation on the Bundler website, but unfortunately most of the links are already dead.

0
source

Source: https://habr.com/ru/post/951549/


All Articles