[Kde-bindings] KDevelop ruby support

Thibauld Favre tfavre at mandrakesoft.com
Fri Oct 22 13:16:31 UTC 2004


Le Vendredi 22 Octobre 2004 13:08, Richard Dale a écrit :
> > I've seen that you've been enhancing KDevelop ruby support lately.
> > I wanted to give you a few feedbacks about your Korundum template :
> > - First, it seems weird that we have to "build" a project based on a
> > scripting language :) I suppose there's no choice if you want to fit in
> > the kdevelop framework.
>
> Yes, it uses automake and it took me a bit of puzzling out how all that
> worked. It needs some install rules so that you can run the app like a
> normal KDE one. I wondered if it might be a good idea to have a top level
> shell script to start the ruby code, install that in the KDE bin dir with
> the ruby under $KDEDIR/share/apps/<appname>..
That would definitely be cool because so far we cannot execute the program 
without calling ruby. This would definitely be a plus to be able to 
transparently run ruby apps.

> I would say the advantage of the build step is that you can invoke the make
> rules to generate ruby source from the .ui files via rbuic. I think there
> is a run button, so that probably builds and runs. It doesn't quite work
> yet because I think it is expecting the ruby scripts to be in the top level
> of the project, rather than under src.
Ok but I have another pb with executing my app (==clicking first button on the 
left) that you might have already faced : Even if I set up kdevelop to 
execute the app from the app directory ("where the executable is"), KDevelop 
launches "ruby /home/[path]/project.rb" and of course it cannot start as the 
program doesn't find its required classes. The solution I found is to use the 
other button (there are 2 "KDE wheel" button, I'm talking about the one on 
the right) which launches "./main.rb" but from the BUILD directory. To make 
that work, I had to change a project option to have KDevelop call ruby with 
"-C" argument : "ruby -C [path]"
Did you have the same problem ? If yes, how did you solve it ?
By the way, what is the name of those 2 buttons in english ? In french, the 
translation is bad because they both have the same name : one is "execute" 
and the other one is "execute the program" ...... eh ??? :)

> > - Then I had problems running the application because your class names
> > all begin with a small letter ("testPreferences") instead of a capital
> > letter ("TestPreferences"). On my system, ruby refuses to execute with
> > this type error :
> > -------------------
> > main.rb:5:in `require': ./testiface.rb:1: class/module name must be
> > CONSTANT (SyntaxError)
> > class testIface < KDE::DCOPObject
> >                  ^      from main.rb:5
>
> You need to type a name starting with upper case, in the Application Name
> field in the Create New Project wizard. It should then convert that to
> lower case for the project directory, but leave it as it is for the class
> names.
Oh ok ! I didn't notice that Kdevelop was using the name I gave to the project 
to generate the template classes.

> > main.rb:10: undefined method `I18N_NOOP' for main:Object (NoMethodError)
> > --------------------
> > I suppose it's working on your system, what am I supposed to do to have
> > it work on mine ?
> Yes, I've only recently added that to the HEAD branch - you'll need to
> update your cvs.
Ok fine ! Works great !

> Thanks. I've only spent about a day or so on it, but I think I already
> prefer it to Kate because class browser makes it so much easier to find
> things. Next I want to add slots/signals declaration navigation to the
> class browser, and allow multi-line attr declarations. And a few more
> templates, like a DCOP service, and improve the existing qtruby one so it
> is a port of the C++ qmakeapp with a main window and menus etc.

Great ! I also put I list of features I'd like to implement in Kdevelop when I 
have time. That includes :
- Support ruby code folding in kate.(that will be the first thing I'll do)
- Doc generation
- Code completion : do you think it's doable with ruby ? So far I have 
absolutely no clue about how that works so I really can't tell if it's 
realistic
- Being able to execute the last version launched that didn't crash (even if 
we changed some code since then). It's a normal behavior for compiled 
language (as long as you don't try to rebuild) but it's a feature for 
scripting languages...
- Manage cross references in an entire project to be able to quickly see if 
you wrote a wrong variable name. Indeed, the error I do most when I code is 
mispelling (ex : I use "@ContratLbl" instead of "@ContratsLbl"...). As 
there's no compile time check, it's difficult to spot these errors and worst 
of all, as long as you don't execute the portion of code with an error, you 
don't even notice that your program has a bug. This scares me and I try to 
find ways to check that my code seems to be correct without having to code 
and run a lot of tests :
1) Code completion, this way you're sure you're using the right variable. But 
you cannot use code completion everywhere....
2) Cross references : I'd like to have a left panel in kdevelop where I can 
see the number of occurences of each variable I use in my code. This way we 
can immediatly see the variables used only once : they are probably variables 
mispelled.

I'd be interested to have your views on this problem. Script languages are 
great but they become a lot more error prone to  sleeping bugs due to syntax 
errors when code grows. Of course we can fix the problem real quick but "only 
once we found it".

thanks,

thibs



More information about the Kde-bindings mailing list