[MacRuby-devel] [MacRuby] #558: unable to require files.
MacRuby
ruby-noreply at macosforge.org
Tue Apr 27 16:11:43 PDT 2010
#558: unable to require files.
-----------------------------+----------------------------------------------
Reporter: tvmoore@… | Owner: lsansonetti@…
Type: defect | Status: closed
Priority: blocker | Milestone: MacRuby 0.5
Component: MacRuby | Resolution: invalid
Keywords: |
-----------------------------+----------------------------------------------
Changes (by martinlagardette@…):
* status: new => closed
* resolution: => invalid
Old description:
> lib_file =
> File.join(File.expand_path($0).slice(0,File.expand_path($0).index("dmdnlib")),
> "dmdnlib/lib/lib")
> require "#{lib_file}"
>
> The result from this is students-v-ldap.rb:in `<main>': no such file to
> load /Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb (LoadError)
>
> I have tried to load said lib.rb by requiring in macirb with an explicit
> path.
>
> irb(main):002:0> require '/Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib'
> LoadError: no such file to load --
> /Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb
>
> macruby /Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb runs without
> any errors...
>
> I need this to work as lib.rb apart from some globals puts all of my
> library folders into the load path.
>
> Dir.glob("#{$DMDN_ENV[:root]}/**/**").each do |f|
> next if !File.directory?(f)
> next if f =~ /\.app/
> $LOAD_PATH << f
> end
>
> I then only ever need to use require 'x' instead of an explicit path.
New description:
{{{
#!ruby
lib_file =
File.join(File.expand_path($0).slice(0,File.expand_path($0).index("dmdnlib")),
"dmdnlib/lib/lib")
require "#{lib_file}"
}}}
The result from this is
{{{
students-v-ldap.rb:in `<main>': no such file to load
/Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb (LoadError)
}}}
I have tried to load said lib.rb by requiring in macirb with an explicit
path.
{{{
irb(main):002:0> require '/Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib'
LoadError: no such file to load --
/Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb
}}}
`macruby /Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb` runs without
any errors...
I need this to work as lib.rb apart from some globals puts all of my
library folders into the load path.
{{{
#!ruby
Dir.glob("#{$DMDN_ENV[:root]}/**/**").each do |f|
next if !File.directory?(f)
next if f =~ /\.app/
$LOAD_PATH << f
end
}}}
I then only ever need to use require 'x' instead of an explicit path.
--
Comment:
I'm sorry but I really could not reproduce. I did try reproducing your
path, but no error came on.
You can reopen this bug if this still happens for you with a nightly
build, but for now, I'll be closing it :-)
--
Ticket URL: <http://www.macruby.org/trac/ticket/558#comment:2>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list