Ruby build path [message #22924] |
Sun, 04 May 2008 16:15  |
Eclipse User |
|
|
|
Originally posted by: renato3110.yahoo.com.br
Out of Eclipse, if you run your script, then Ruby assumes that the
directory where your script is located contains your libraries, so that if
you require 'aaa/bbb', Ruby will search 'aaa' directory on the same
directory of your script.
BUT NOT ECLIPSE. ECLIPSE ONLY SEARCHES THE ROOT PROJECT FOLDER! The ugly
solution is to add EACH OF YOUR SUBFOLDERS TO THE BUILDPATH of the
Project. Anotehr ugly solution is changing the working directory on Run
Dialog for EACH FILE you want to run.
Has anyone noticed that? Is there any plans to make this better? I think
DLTK could make working directory being the same as of the script, not the
project's root folder.
|
|
|
Re: Ruby build path [message #23286 is a reply to message #22924] |
Tue, 06 May 2008 02:16   |
Eclipse User |
|
|
|
Hi Renato,
Lets understand current situation:
I've have following project:
/workspace/asd/
src/
A.rb
src2/
E/
F.rb
B.rb
src3/
E/
F.rb
C.rb
src, src2, src3 are source folders.
With following content:
A.rb:
print "This is A\n"
src/E/F.rb:
print "This is F1\n"
src2/B.rb:
print "This is B\n"
require "A"
src3/E/F.rb:
print "This is F2\n"
src3/C.rb:
print "This is C\n"
require "B"
require "E/F"
Then I execute C by default output will be following:
>>>
This is C
This is B
This is A
This is F1
>>>
By default working dir are set to project location.
Then DLTK run Ruby script all source folders will be passed as arguments for -I parameter.
So we will have following call:
ruby -I/workspace/asd/src -I/workspace/asd/src2 -I/workspace/asd/src3 /workspace/asd/src3/C.rb
As I understand you need what /src3/E/F.rb should be included instead of /src/E/F.rb ?
Is this correct?
But As I understand if you specify working directory to /workspace/src3/ you will receive absolutely same output,
because Ruby will look into src firstly, and then to working directory.
What behavior we should have? Also please provide some example.
> Out of Eclipse, if you run your script, then Ruby assumes that the
> directory where your script is located contains your libraries, so that
> if you require 'aaa/bbb', Ruby will search 'aaa' directory on the same
> directory of your script.
>
> BUT NOT ECLIPSE. ECLIPSE ONLY SEARCHES THE ROOT PROJECT FOLDER! The ugly
> solution is to add EACH OF YOUR SUBFOLDERS TO THE BUILDPATH of the
> Project. Anotehr ugly solution is changing the working directory on Run
> Dialog for EACH FILE you want to run.
>
> Has anyone noticed that? Is there any plans to make this better? I think
> DLTK could make working directory being the same as of the script, not
> the project's root folder.
>
|
|
|
|
|
|
|
|
|
|
|
|
Re: Ruby build path [message #24061 is a reply to message #24030] |
Tue, 13 May 2008 16:45   |
Eclipse User |
|
|
|
Originally posted by: renato3110.yahoo.com.br
Actually, the solution for the bug you had open makes things more
difficult, because istead of Eclipse not adding all the subfolders to the
classpath, we have to add all of them manually or change all the require
commmands inside the IDE to start from the project floder instead of the
script folder.
<<< That is, I think the solution for the bug is only valid if, as I'm
saying, DLTK considers current folder (script folder) automatically when
running scripts. I've downloaded the new M7a, but I'm still not able to,
for example, run a script that requires another script under the same
folder just because that folder (which isn't a src folder itself but a
subfolder of such one) is not on the build path :( >>>
|
|
|
Re: Ruby build path [message #24163 is a reply to message #24061] |
Tue, 20 May 2008 10:41   |
Eclipse User |
|
|
|
Hi Renato,
We corrected launching in DLTK, for now by default script folder will be specified as working directory, and case you
specified will work.
This fix will be available in 1.0RC1 version of DLTK.
Best regards,
Andrei Sobolev.
> Actually, the solution for the bug you had open makes things more
> difficult, because istead of Eclipse not adding all the subfolders to
> the classpath, we have to add all of them manually or change all the
> require commmands inside the IDE to start from the project floder
> instead of the script folder.
>
>
> <<< That is, I think the solution for the bug is only valid if, as I'm
> saying, DLTK considers current folder (script folder) automatically when
> running scripts. I've downloaded the new M7a, but I'm still not able to,
> for example, run a script that requires another script under the same
> folder just because that folder (which isn't a src folder itself but a
> subfolder of such one) is not on the build path :( >>>
>
>
>
>
|
|
|
|
|
Re: Ruby build path [message #24274 is a reply to message #24233] |
Thu, 22 May 2008 15:10  |
Eclipse User |
|
|
|
Originally posted by: renato3110.yahoo.com.br
Hi Andrey,
Yes, the problem was understood and solved well! Very nice job! I was not
really expecting my suggestion to be heard.
Thank you very much for implementing this!!!
|
|
|
Powered by
FUDForum. Page generated in 0.04470 seconds