KDevelop/Ruby

From KDE Community Wiki
 
Important
Hi there! I'm sorry to tell you that this page is still under construction. The responsible for this mess is Miquel (mssola on IRC).


How to compile

First of all, you need to compile KDevelop and KDevPlatform. There are instructions on how to do this here: KDevelop4/HowToCompile. If you have succeeded in installing KDevelop and KDevPlatform, you can install the Ruby plugin in pretty much the same way. First, download the source code:

   git clone git://anongit.kde.org/kdev-ruby

Then you can compile it by doing the following:

   mkdir build
   cd build
   cmake -DCMAKE_INSTALL_PREFIX=$HOME/kdevelop4 ../
   make
   make install

Last but not least, make sure to run kbuildsycoca4 after the installation process.

Testing

Testing manually

First of all, go to your build directory, all the testing has to be done in this directory. Now, there are two mechanisms to test this plugin: RSpec and QtTest. RSpec is used to test the parser, and QtTest to test everything else. If you want to test the parser, you'll have to run the following commands:

   cd parser/tools
   rspec -c -f doc parser_spec.rb

For the other components, there is an executable file for each of them. You just have to go inside its test directory and execute the tests. For example, to test the DUChain:

   cd duchain/tests
   ./duchain

Testing using Guard

To do.

Generating the documentation

This plugin needs to have a file with all the Ruby built-in modules, classes, constants, etc. This file is called builtins.rb and you can find it in the documentation/ directory. This file will always be available, but if you want to generate it again, you have to follow some simple steps. First of all, you need to get the Ruby source code (the MRI implementation). You can download it here or, alternatively, you can use svn or git like this:

   svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby
   git clone https://github.com/ruby/ruby.git

This is a necessary step because the documentation/kdevruby_doc.rb script needs the path of the Ruby source code as the first parameter. The second parameter to be passed to this script will be the name of the output file. Therefore, to generate the builtins.rb file we just have to execute:

   cd documentation
   ruby kdevruby_doc.rb /absolute/path/to/the/ruby/source/code builtins.rb

Note that this process can take a while. After this, we'll have a brand new builtins.rb file.