I’ve got a wrapper for my Gem, socks, inside socks.rb. The entire file is made up of require statements, and a module declaration:
# lib/socks.rb
require 'socks/version'
require 'socks/base_controller'
require 'socks/templates'
require 'socks/tasks'
require 'socks/rake_tasks'
module Socks
end
However, require 'socks/tasks' and socks/rake_tasks is giving me a LoadError: no such file to load -- socks/tasks / rake_tasks error.
Is this a problem with the alignment of the require statements, or just the code?
Code is on Github: https://github.com/Beakr/socks
EDIT: require './socks/tasks' is now working, however require './socks/rake_tasks' is not.
Ruby load files using its
$LOAD_PATH. This global array is changed by e.g. rubygems and bundler to allow to find libraries in various locations. In yoursock.gemspecyou have definedwhich means that rubygems will add the
libdirectory of your gem to ruby’s$LOAD_PATH. But it odes so only if you have installed the gem and the gemspec is thus evaluated. If you don’t want to install your gem, you can test your gem usingin your gem directory, or alternatively by first adapting your
$LOAD_PATHin your irb session like so: