load-path

Error running rake task from IDE

I am having a problem running the 'test' Rake task from IntelliJ Idea in Ruby On Rails application: *Error running test: File 'test/unit/autorunner.rb' wasnt found in $LOAD_PATH of Ruby SDK with interpreter: '{1}'* But the file is located at %RUBY_HOME%/lib/ruby/1.8/test/unit and I have no problems when running other rake tasks. Plea...

Why does my rails project not have the ruby standard lib in $LOAD_PATH on OSX?

I need to do a: require 'generator' Inside of a rails project, but it is not working for me on OSX, because the ruby standard library (which is located in my /usr/lib/ruby/1.8) is not in my $LOAD_PATH once rails boots. If I just run irb outside of rails it is there. Where/What do I need to config? ...

Why does Ruby 1.9.2 remove "." from LOAD_PATH, and what's the alternative?

The latest changesets to Ruby 1.9.2 no longer make the current directory . part of your LOAD_PATH. I have a non-trivial number of Rakefiles that assume that . is part of the LOAD_PATH, so this broke them. Was there a particular justification for doing this? As for a fix, adding $: << "." everywhere works, but seems incredibly hacky and ...

How are $LOAD_PATH and $: different?

I needed to know what was in my Ruby load path, so I did this: $ ruby -e "puts $LOAD_PATH" It didn't print anything out, which I didn't expect. So I tried this: $ ruby -e "puts $:" /usr/local/lib/site_ruby/1.8 /usr/local/lib/site_ruby/1.8/i486-linux /usr/local/lib/site_ruby/1.8/i386-linux /usr/local/lib/site_ruby /usr/lib/ruby/vendo...

Rails: load_paths for directory and all subdirectories

In environment.rb I can add the line config.load_paths += %W( #{RAILS_ROOT}/app/models/foos ) where 'foos' is a folder. This loads all files inside the foos folder. However it doesn't load any of its subdirectories. If I knew the names of all the subdirectories in the 'foos' folder, this problem would have an easy solution: %W[fold...

Why does ruby's '$:' or '$LOAD_PATH' change when I run it with sudo?

I am trying to run a ruby script as root. When I try to require a gem, ruby says it can't be found. This is because of $: $ ruby -e "puts $:" /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.beta4/lib /opt/local/lib/ruby/gems/1.9.1/gems/cgi_multipart_eof_fix-2.5.0/lib /opt/local/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib /opt/loc...

How do I retain installed gems after updating rubygems?

After a recent reinstallation of Ubuntu, I reinstalled RubyGems. The Ubuntu repository grabbed version 1.3.5. Later I found I need the latest version. So I installed the RubyGems update to get to version 1.3.7. The trouble is, upon upgrading gem list returns only a small subset of all my originally installed gems. In the past, I've ...

How can I configure gem to only ever use system gems?

I want to configure gem to only use system gems - never those in $HOME/.gem. This is because I'm writing a script that will access Gem.path and I don't want it to return the path to gems in my home directory. I'm pretty sure I haven't explicitly set GEM_HOME or anything like that in my .bashrc, .bash_login etc. But Gem.path returns my ...

adding a subpackage from a different path

I have a python package called zypp. It is generated via swig and the rpm package (called python-zypp) puts it in: rpm -ql python-zypp /usr/lib64/python2.6/site-packages/_zypp.so /usr/lib64/python2.6/site-packages/zypp.py Now, I have a different project which provides an additional sets of APIs. Pure python. Plus some scripts. The la...

In Rails, I thought once the "Foo.all" is executed, then "models/foo.rb" is loaded?

In Rails, if I create a scaffold foo, and do rake db:migrate, then now app/models/foo.rb is created. So if I go to script/console (or rails console for Rails 3) and type $".grep /foo/i it is empty. $" is the loaded files. So foo.rb is not loaded yet. Now I do a Foo.all, and foo.rb should be loaded now. But when I repeat ...

Ruby require "no such file to load" error yet clearly in path.

I've been trying to get a ruby file to require another ruby file and I feel like I'm going crazy. My setup is as follows Two files in '/raid1/ruby-code/benchmark/' CommandRunner Benchmarker Benchmarker is the main program at this point and wants to require CommandRunner, I've tried a bunch of different things and none of them work....