Maaaaaaaaaaaaajor sanity check needed. I wrote a simple little plugin, and it wouldn''t load. I put some comments in it''s init.rb, and it didn''t even spit those out. So, I dug into the initializer.rb (/vendor/rails/railties/lib/initializer.rb) to see wtf is going on, and found the problem... but... can''t explain it. Here is the code in question: lib_path = File.join(directory, ''lib'') init_path = File.join(directory, ''init.rb'') has_lib = File.directory?(lib_path) #raise LoadError, "Dude, this path is ok: " + has_lib# => public/../config/../vendor/plugins/my_plugin/init.rb has_init = File.file?(init_path) #raise LoadError, "WTF !...." + has_init.to_s# => False !!!!!!!!! I''ve loaded the same situation up in IRB, and it works fine. Why is File.file?(init_path) returning false !? Permissions are fine, the path is fine: public/../config/../vendor/plugins/my_plugin/init.rb. I''m losing my mind. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060224/0e7e3884/attachment.html
What version of rails are you running? Plugins don''t work before 0.14releases... On 2/24/06, Dylan Stamat <dylans@gmail.com> wrote:> > Maaaaaaaaaaaaajor sanity check needed. > I wrote a simple little plugin, and it wouldn''t load. I put some comments > in it''s init.rb, and it didn''t even spit those out. So, I dug into the > initializer.rb (/vendor/rails/railties/lib/initializer.rb) to see wtf is > going on, and found the problem... but... can''t explain it. Here is the > code in question: > > lib_path = File.join(directory, ''lib'') > init_path = File.join(directory, ''init.rb'') > has_lib = File.directory?(lib_path) > #raise LoadError, "Dude, this path is ok: " + has_lib# => > public/../config/../vendor/plugins/my_plugin/init.rb > has_init = File.file?(init_path) > #raise LoadError, "WTF !...." + has_init.to_s# => > False !!!!!!!!! > > > I''ve loaded the same situation up in IRB, and it works fine. Why is > File.file?(init_path) returning false !? > Permissions are fine, the path is fine: > public/../config/../vendor/plugins/my_plugin/init.rb. > > I''m losing my mind. > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060224/cde01c51/attachment.html
I''m running Edge. On 2/24/06, Steve Longdo <steve.longdo@gmail.com> wrote:> > What version of rails are you running? Plugins don''t work before 0.14releases... > > On 2/24/06, Dylan Stamat <dylans@gmail.com > wrote: > > > Maaaaaaaaaaaaajor sanity check needed. > > I wrote a simple little plugin, and it wouldn''t load. I put some > > comments in it''s init.rb, and it didn''t even spit those out. So, I dug > > into the initializer.rb (/vendor/rails/railties/lib/initializer.rb) to > > see wtf is going on, and found the problem... but... can''t explain it. Here > > is the code in question: > > > > lib_path = File.join(directory, ''lib'') > > init_path = File.join(directory, ''init.rb'') > > has_lib = File.directory?(lib_path) > > #raise LoadError, "Dude, this path is ok: " + has_lib# => > > public/../config/../vendor/plugins/my_plugin/init.rb > > has_init = File.file?(init_path) > > #raise LoadError, "WTF !...." + has_init.to_s# > > => False !!!!!!!!! > > > > > > I''ve loaded the same situation up in IRB, and it works fine. Why is > > File.file?(init_path) returning false !? > > Permissions are fine, the path is fine: > > public/../config/../vendor/plugins/my_plugin/init.rb. > > > > I''m losing my mind. > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060224/5d093eed/attachment.html
So, I was able to hack this to work when I "hardcode" my absolute path in here... however, that is obviously the biggest hack ever. Problem is, the path it''s getting from #{RAILS_ROOT} is a relative path, and when it''s being applied within the context of the initializer.rb directory (which is actually in the /vendor/ directory), it''s not a valid URL anymore. So, it looks as if you''re running Edge, and want plugins to work, your out of luck. Am I crazy ? On 2/24/06, Dylan Stamat <dylans@gmail.com> wrote:> > I''m running Edge. > > > On 2/24/06, Steve Longdo <steve.longdo@gmail.com> wrote: > > > > What version of rails are you running? Plugins don''t work before 0.14releases... > > > > On 2/24/06, Dylan Stamat <dylans@gmail.com > wrote: > > > > > Maaaaaaaaaaaaajor sanity check needed. > > > I wrote a simple little plugin, and it wouldn''t load. I put some > > > comments in it''s init.rb, and it didn''t even spit those out. So, I > > > dug into the initializer.rb(/vendor/rails/railties/lib/initializer.rb) to see wtf is going on, and > > > found the problem... but... can''t explain it. Here is the code in question: > > > > > > > > > lib_path = File.join(directory, ''lib'') > > > init_path = File.join(directory, ''init.rb'') > > > has_lib = File.directory?(lib_path) > > > #raise LoadError, "Dude, this path is ok: " + has_lib# => > > > public/../config/../vendor/plugins/my_plugin/init.rb > > > has_init = File.file?(init_path) > > > #raise LoadError, "WTF !...." + has_init.to_s# > > > => False !!!!!!!!! > > > > > > > > > I''ve loaded the same situation up in IRB, and it works fine. Why is > > > File.file?(init_path) returning false !? > > > Permissions are fine, the path is fine: > > > public/../config/../vendor/plugins/my_plugin/init.rb. > > > > > > I''m losing my mind. > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060224/137afe11/attachment.html
Dylan... don''t know if this will help you here or not, but I was commenting on the strange relative path that RAILS_ROOT produces and Kris Leech pointed out that one can do "File.expand_path(RAILS_ROOT)" to get the full path. b Dylan Stamat wrote:> So, I was able to hack this to work when I "hardcode" my absolute path > in here... however, that is obviously the biggest hack ever. > > Problem is, the path it''s getting from #{RAILS_ROOT} is a relative path, > and when it''s being applied within the context of the initializer.rb > directory (which is actually in the /vendor/ directory), it''s not a > valid URL anymore. > > So, it looks as if you''re running Edge, and want plugins to work, your > out of luck. > Am I crazy ? > > > > On 2/24/06, *Dylan Stamat* <dylans@gmail.com <mailto:dylans@gmail.com>> > wrote: > > I''m running Edge. > > > > On 2/24/06, *Steve Longdo* < steve.longdo@gmail.com > <mailto:steve.longdo@gmail.com>> wrote: > > What version of rails are you running? Plugins don''t work > before 0.14 releases... > > On 2/24/06, *Dylan Stamat* <dylans@gmail.com > <mailto:dylans@gmail.com>> wrote: > > Maaaaaaaaaaaaajor sanity check needed. > I wrote a simple little plugin, and it wouldn''t load. I put > some comments in it''s init.rb, and it didn''t even spit those > out. So, I dug into the initializer.rb > (/vendor/rails/railties/lib/initializer.rb) to see wtf is > going on, and found the problem... but... can''t explain it. > Here is the code in question: > > lib_path = File.join(directory, ''lib'') > init_path = File.join(directory, ''init.rb'') > has_lib = File.directory?(lib_path) > #raise LoadError, "Dude, this path is ok: " + > has_lib# => > public/../config/../vendor/plugins/my_plugin/init.rb > has_init = File.file?(init_path) > #raise LoadError, "WTF !...." + > has_init.to_s# => False !!!!!!!!! > > > I''ve loaded the same situation up in IRB, and it works > fine. Why is File.file?(init_path) returning false !? > Permissions are fine, the path is fine: > public/../config/../vendor/plugins/my_plugin/init.rb. > > I''m losing my mind. > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks a bunch Ben. I just did a little test, and think I may have a possible bug in hand... but not sure. Here is what I did: =============================1) rails -v (rails 1.0.0) 2) rails test (in my home dir, now ive got /home/dylan/test/) 3) create plugin: (/home/dylan/test/vendor/plugins/custom/lib/custom.rb and /home/dylan/test/vendor/plugins/custom/lib/init.rb) 4) rake freeze_edge 5) put debug in: (/home/dylan/test/vendor/rails/railties/lib/initializer.rb ... line 311: "raise LoadError, init_path") 6) output: "public/../config/../vendor/plugins/custom/init.rb" 7) put debug in: (/home/dylan/test/vendor/rails/railties/lib/initializer.rb ... line 312: "raise LoadError, has_init.to_s") 8) output: "false" ============================= So, normal 1.0.0 install, froze edge, threw a valid plugin in /vendor/plugins, and initializer.rb can''t pick it up due to an invalid URL. Do I have a point here, or am I doing something wrong ? On 2/24/06, Ben Munat <bent@munat.com> wrote:> > Dylan... don''t know if this will help you here or not, but I was > commenting on the strange > relative path that RAILS_ROOT produces and Kris Leech pointed out that one > can do > "File.expand_path(RAILS_ROOT)" to get the full path. > > b > > Dylan Stamat wrote: > > So, I was able to hack this to work when I "hardcode" my absolute path > > in here... however, that is obviously the biggest hack ever. > > > > Problem is, the path it''s getting from #{RAILS_ROOT} is a relative path, > > and when it''s being applied within the context of the initializer.rb > > directory (which is actually in the /vendor/ directory), it''s not a > > valid URL anymore. > > > > So, it looks as if you''re running Edge, and want plugins to work, your > > out of luck. > > Am I crazy ? > > > > > > > > On 2/24/06, *Dylan Stamat* <dylans@gmail.com <mailto:dylans@gmail.com>> > > wrote: > > > > I''m running Edge. > > > > > > > > On 2/24/06, *Steve Longdo* < steve.longdo@gmail.com > > <mailto:steve.longdo@gmail.com>> wrote: > > > > What version of rails are you running? Plugins don''t work > > before 0.14 releases... > > > > On 2/24/06, *Dylan Stamat* <dylans@gmail.com > > <mailto:dylans@gmail.com>> wrote: > > > > Maaaaaaaaaaaaajor sanity check needed. > > I wrote a simple little plugin, and it wouldn''t load. I put > > some comments in it''s init.rb, and it didn''t even spit those > > out. So, I dug into the initializer.rb > > (/vendor/rails/railties/lib/initializer.rb) to see wtf is > > going on, and found the problem... but... can''t explain it. > > Here is the code in question: > > > > lib_path = File.join(directory, ''lib'') > > init_path = File.join(directory, ''init.rb'') > > has_lib = File.directory?(lib_path) > > #raise LoadError, "Dude, this path is ok: " + > > has_lib# => > > public/../config/../vendor/plugins/my_plugin/init.rb > > has_init = File.file?(init_path) > > #raise LoadError, "WTF !...." + > > has_init.to_s# => False !!!!!!!!! > > > > > > I''ve loaded the same situation up in IRB, and it works > > fine. Why is File.file?(init_path) returning false !? > > Permissions are fine, the path is fine: > > public/../config/../vendor/plugins/my_plugin/init.rb. > > > > I''m losing my mind. > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org <mailto: > Rails@lists.rubyonrails.org> > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060225/ba66e586/attachment-0001.html
Apparently Analagous Threads
- make install not creating lib entries in /usr/lib under Ubunu 11.10
- [PATCH] tools/check: check for yajl (needed by libxl)
- [PATCH] tools: don't expand prefix and exec_prefix too early
- passing model data to a plugin called within that model
- accessing a variable inside a plugin