KDevelop/Ruby: Difference between revisions

From KDE Community Wiki
m (update links to repo and build instructions)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Remember|2=Important|1=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).}}
__NOTOC__


= How to compile =
= 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:
First of all, you need to compile KDevelop and its KDevPlatform. There are instructions on how to do this here: [[KDevelop/HowToCompile_v5]]. 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
     git clone https://invent.kde.org/kdevelop/kdev-ruby.git


Then you can compile it by doing the following:
Then you can compile it by doing the following:


     mkdir build
     mkdir build && cd build
    cd build
     cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/install/directory
     cmake -DCMAKE_INSTALL_PREFIX=$HOME/kdevelop4 ../
     make
     make
     make install
     make install
Last but not least, make sure to run <code>kbuildsycoca4</code> after the installation process.


= Testing =
= Testing =
Line 21: Line 18:
=== Testing manually ===
=== Testing manually ===


To do.
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 ===
=== Testing using Guard ===


To do.
All this process can be automated by using the guard gem. Note that there is a Gemfile in the source code of this plugin. So, to get guard and its dependencies, you may want to run the <code>bundle</code> command. And finally, in the root of the source tree you will have to execute the following command:
 
    guard -w /relative/path/to/the/build/directory
 
Now all the tests will be run and you'll get notified. Moreover, if you install the plugin again, all tests will be executed automatically.


= Generating the documentation =
= Generating the documentation =

Latest revision as of 20:05, 23 June 2020


How to compile

First of all, you need to compile KDevelop and its KDevPlatform. There are instructions on how to do this here: KDevelop/HowToCompile_v5. 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 https://invent.kde.org/kdevelop/kdev-ruby.git

Then you can compile it by doing the following:

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

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

All this process can be automated by using the guard gem. Note that there is a Gemfile in the source code of this plugin. So, to get guard and its dependencies, you may want to run the bundle command. And finally, in the root of the source tree you will have to execute the following command:

   guard -w /relative/path/to/the/build/directory

Now all the tests will be run and you'll get notified. Moreover, if you install the plugin again, all tests will be executed automatically.

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.