[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.dltk] Re: Ruby build path

I tried to well-format the message again:

Hi Andrei, I'm sorry but it is hard to understand what you're saying. I'll give you an example to be more clear:

(1) A folder on the filesystem:

/ruby_scripts
   /lessons
       /common
           utils.rb
       file_handling.rb   -->   requires 'arrays'
       arrays.rb          -->   requires 'common/utils'
   not_lesson_script.rb   -->   requires 'lessons/common/utils'



(2) If you run file_handling.rb and arrays.rb in console, Ruby searches the required resources from the same directory of the scripts: (a) file_handling.rb requires 'arrays': arrays.rb will be looked up from /lessons

(b) arrays.rb requires 'common/utils': utils.rb will be looked up from /lessons/common

(c) not_lesson_script.rb requires 'lessons/common/utils': the same as above



(3) Then you create a Ruby project using /ruby_script as a root folder, and want to run those scripts inside the IDE. BUT YOU'LL GET AN ERROR, because:

(a) file_handling.rb requires 'arrays': Eclipse will seek for /ruby_scripts/arrays.rb AND THEREFORE WILL FAIL!!!

(b) arrays.rb requires 'common/utils': Eclipse will seek for /ruby_scripts/common/utils.rb AND THEREFORE WILL FAIL!!!

(c) not_lesson_script.rb requires 'lessons/common/utils': Eclipse will seek
for ruby_scripts/lessons/common/utils.rb and this is the only case where we would not get any errors.



(4) Possible solutions currently (standing we'd never want to make a require from the top /ruby_scripts directory)


(a) Add lessons and common into the project's build path: this way everything would work just like in 2nd item (like outside the IDE).
But this becomes IMHO as weird as the number of sub-folders increases. Besides this makes the appearance of the sub-folder to change, from a pretty package-like to a folder-like structure with a complete path for
each sub-folder (just add your sub-folders to build path and you will see how it changes).


(b) For each script you want to run, go to Run Dialog and change the script's run configuration to set the working directory to the same directory where the script is, instead of the project's root folder. But this is is weird.


I hope you can understand now. My suggestion would be making Eclipse to consider the script folder as a place to look up required required resources, instead of (or not limited by) project's root folder.