-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(LoadError) on getting version out of gem cache #21
Comments
Ruby does not ever attempt to require directories. Without more information, I have no way to debug this. Where and how are you doing |
I am just trying to get this working with a basic ruby application before I troubleshoot a larger app. I am not using bundler that I know of. To me there seems to be an issue with RVM and it not linking gems path correctly. I ran "irb" and 'require version' failed until I put 'require rubygems' first. I hope this helps. Sorry I am new to this. The stack below happened when rspec spec/ was called against. /Users/nem/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require': cannot load such file -- version (LoadError)
from /Users/nem/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /Users/nem/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/nem/Development/MyStuff/git/ruby/test_version/lib/test_version/version.rb:1:in `<top (required)>'
from /Users/nem/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/nem/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/nem/Development/MyStuff/git/ruby/test_version/spec/get_version_spec.rb:1:in `<top (required)>'
from /Users/nem/.rvm/gems/ruby-1.9.3-p429/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /Users/nem/.rvm/gems/ruby-1.9.3-p429/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /Users/nem/.rvm/gems/ruby-1.9.3-p429/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /Users/nem/.rvm/gems/ruby-1.9.3-p429/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /Users/nem/.rvm/gems/ruby-1.9.3-p429/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/nem/.rvm/gems/ruby-1.9.3-p429/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /Users/nem/.rvm/gems/ruby-1.9.3-p429/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun' |
This is expected, correct behavior. If you have installed a gem via rubygems, you must require rubygems before you can use it. |
I have loaded the gem via gem install version. The gem is installed as far as I van tell "gem list | grep version" => version 1.0.0. . At the gem directory is code that matches github. I am here because this is the first gem that is not loading for me. My next step is to blow away rvm and reinstall ruby. |
As you have described it, this is not a bug in version. Sorry. If you are using gems, you must require rubygems in your application before requiring the individual gems themselves. |
I just reinstalled ruby with the default rvm installation. I am using Nicholas McCready Personal Email: [email protected] On Thu, Jun 20, 2013 at 8:37 AM, Stephen Touset [email protected]:
|
Should gems be in my $PATH besides rvm magic? |
The rspec version requirement is ~> '1' will rspec's greater than '1' not work correctly? |
I cloned sodium and got all your tests to pass via "rake test". I added a spec/get_version_spec.rb require 'sodium/version'
describe "Version should" do
subject do
Sodium::VERSION
end
describe "version" do
it "extracts version" do
subject.should == "0.5.0"
end
end
end Failed on rspec spec! rspec spec [9:09:55]
/Users/nem/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require': cannot load such file -- version (LoadError)
from /Users/nem/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /Users/nem/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
from /Users/nem/Development/MyStuff/git/ruby/sodium/lib/sodium/version.rb:1:in `<top (required)>'
from /Users/nem/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/nem/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/nem/Development/MyStuff/git/ruby/sodium/spec/get_version_spec.rb:2:in `<top (required)>'
from /Users/nem/.rvm/gems/ruby-2.0.0-p195/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /Users/nem/.rvm/gems/ruby-2.0.0-p195/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /Users/nem/.rvm/gems/ruby-2.0.0-p195/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /Users/nem/.rvm/gems/ruby-2.0.0-p195/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /Users/nem/.rvm/gems/ruby-2.0.0-p195/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/nem/.rvm/gems/ruby-2.0.0-p195/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /Users/nem/.rvm/gems/ruby-2.0.0-p195/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun' This failed until I added "version.rb" require 'version.rb'
require 'sodium/version'
describe "Version should" do
subject do
Sodium::VERSION
end
describe "version" do
it "extracts version" do
subject.should == "0.5.0"
end
end
end rspec spec
~/Development/MyStuff/git/ruby/sodium
master* $ rspec spec [9:04:41]
.
Finished in 0.00036 seconds
1 example, 0 failures To me this has to be an issue with rspec. |
I'm sorry, but this appears to be a configuration issue with your local environment. [stouset:~] % ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]
[stouset:~] % gem -v
1.8.25
[stouset:~] % gem install version
Successfully installed version-1.0.0
1 gem installed
Installing ri documentation for version-1.0.0...
[stouset:~] % irb
irb(main):001:0> require 'version'
=> true
irb(main):002:0> exit
[stouset:~] % gem install sodium
Successfully installed sodium-0.5.0
1 gem installed
Installing ri documentation for sodium-0.5.0...
[stouset:~] % irb
irb(main):002:0> require 'sodium/version'
=> true |
I know this is closed, but this is still bugging me. Is this possibly relevant? http://stackoverflow.com/questions/11499140/weird-loaderror-on-custom-ruby-gem |
This issue has to be due to rspec version 1 being required. I cannot even get the specs of this application to run via rspec 2. So I can't use this library unless I can get both rspecs to work side by side. |
Do you have the |
The gem 'version'
require 'version' which will force the gem to be activated. |
I fam working on the fix. I have upgraded version to rspec 2. That is the problem. I now have all specs working with the changes. Weird thing is the gemspec should have failed on gem install as the version of rspec that version-1.0.0 needs is not there. |
gem list | grep mail Ahh The mail gem is being a bad Ruby citizen by having a file named VERSION..... Thats why my copy of version 1.1.0a is not working either. |
Both gem 'version' and uninstalling mail fixes the issue. Do you want me to do a pull request for rspec upgrade? |
Why? The gem is effectively complete, and switching to rspec 2 would gain little if anything. It's also a development dependency, so it's not a requirement to install the gem and won't cause conflict with projects that require rspec 2 or newer. |
If thats true then no big deal. It's just majorly confusing when your Nicholas McCready Personal Email: [email protected] On Thu, Jun 20, 2013 at 4:31 PM, Stephen Touset [email protected]:
|
Mostly random luck. |
custom_require.rb:60:in `require': cannot load such file -- version (LoadError)
Is produced by:
It seems that the loader is confused with loading version/ or version.rb. Stating 'require version.rb' explicitly fixes the issue as the work around.
The text was updated successfully, but these errors were encountered: