Difference between revisions of "FreeplaneJrubyInstaller Addon"

From Freeplane - free mind mapping and knowledge management software
m
 
(62 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== What is FreeplaneJrubyInstaller ===
+
__TOC__
  
Its an addon to '''add support for .rb (ruby) scripts in Freeplane''', so that you can use .groovy .js '''and .rb''' scripts
 
  
 +
== Introduction ==
  
 +
Freeplane supports groovy (.groovy) and javascript (.js) scripts out-of-the-box.
  
Freeplane supports .groovy and .js (javascript) scripts out-of-the-box. This addon adds support for .rb (ruby) scripts, enabling you to use:
+
This addon '''adds support for ruby (.rb) scripts''', enabling you to '''run ruby scripts''' (ex: <code><freeplane-user-dir>/scripts/my_ruby_script.rb</code>) alongside the out-of-the-box .groovy and .js scripts.
  
<code>&lt;freeplane-user-dir&gt;/scripts/my_ruby_script.rb</code> besides .groovy and .js scripts
 
  
It does this by using internally the [http://jruby.org/ Jruby interpreter], which is capable of running ruby scripts with access to Java objects (Freeplane-java-objects!)
 
  
=== Install FreeplaneJrubyInstaller in Freeplane ===
+
The addon was made with 2 purposes:
 +
 
 +
* To '''''enable Freeplane to use/run ruby scripts'''''. <br /> To run a ruby script, you first need to '''install the FreeplaneJrubyInstaller-addon'''. <br /> Once the FreeplaneJrubyInstaller-addon is installed, you can then '''use ruby scripts in Freeplane''' <br /> This wiki page shows [[FreeplaneJrubyInstaller_Addon#How_to_install_the_FreeplaneJrubyInstaller-Addon_in_Freeplane|How to install the FreeplaneJrubyInstaller-Addon in Freeplane]] and [[FreeplaneJrubyInstaller_Addon#How_to_use_ruby_scripts_in_Freeplane|How to use ruby scripts in Freeplane ]], in a step-by-step fashion. 
 +
 
 +
* To '''''be helpfull for non-programmers who want to try first-steps-of-programming with Ruby and make simple Freeplane ruby scripts'''''.  <br /> Ruby is easy to learn, has many tutorials/books written for new programmers, and the RubyLiveDebugger (included in this addon) gives an instant-gratification-labtest for ruby and freeplane scripting ([https://www.youtube.com/watch?v=dy6kDGApaKw#t=08m05s demo video]) <br /> Start by installing the addon as explained in this page, and then switch to the  [[FreeplaneJrubyInstaller_-_developers|FreeplaneJrubyInstaller - developers]] wiki page. Hope you have fun :)
 +
 
 +
 +
 
 +
 
 +
 
 +
 
 +
 
 +
== How to install the FreeplaneJrubyInstaller-Addon in Freeplane ==
 +
 
 +
To run a freeplane '''ruby''' script, you first need to '''install the FreeplaneJrubyInstaller-addon''' in Freeplane
 +
 
 +
 
 +
 
 +
To install the addon follow the instructions bellow (click on any image to enlarge it):
 +
 
 +
You dont need to manually download anything, all downloads are automatic.
 +
 
  
* You dont need to manually download anything, all downloads are automatic, just follow the instructions bellow :)
 
 
* Check that your Java version is &gt;= 1.7 (Jruby requires it). If you want to update your Java, goto https://java.com/en/download/
 
* Check that your Java version is &gt;= 1.7 (Jruby requires it). If you want to update your Java, goto https://java.com/en/download/
  
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img0.png]]
+
[[File:img0.png|frame|400x200px|none|link={{filepath:img0.png}}]]
 +
 
 +
* Copy to your clipboard THE-URL-TO-THE-ADDON (without any leading/trailing spaces! or it fails):
  
* Copy to your clipboard THE-URL-TO-THE-ADDON: <code>https://raw.githubusercontent.com/zipizap/FreeplaneJrubyInstaller/master/addon_lab/FreeplaneJrubyInstaller-v1.6.addon.mm</code>
+
THE-URL-TO-THE-ADDON:
* Follow me:
+
 
 +
'''<nowiki>https://raw.githubusercontent.com/zipizap/FreeplaneJrubyInstaller/master/addon_lab/FreeplaneJrubyInstaller-v1.7.0.addon.mm</nowiki>'''
 +
 
 +
'''<small><strike><nowiki>https://raw.githubusercontent.com/zipizap/FreeplaneJrubyInstaller/master/addon_lab/FreeplaneJrubyInstaller-v1.6.2.addon.mm</nowiki></strike></small>'''
 +
 
 +
 
 +
 
 +
 
 +
 
 +
* Follow the images:
 +
 
 +
[[File:img1.png|frame|400x200px|none|link={{filepath:img1.png}}]]<br />
 +
[[File:img2.png|frame|400x200px|none|link={{filepath:img2.png}}]]<br />
 +
[[File:img3.png|frame|400x200px|none|link={{filepath:img3.png}}]]<br />
 +
[[File:img4.png|frame|400x200px|none|link={{filepath:img4.png}}]]<br />
 +
[[File:img5.png|frame|400x200px|none|link={{filepath:img5.png}}]]<br />
 +
[[File:img6.png|frame|400x200px|none|link={{filepath:img6.png}}]]<br />
  
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img1.png]]<br />
 
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img2.png]]<br />
 
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img3.png]]<br />
 
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img4.png]]<br />
 
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img5.png]]<br />
 
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img6.png]]
 
  
 
* Open Freeplane for a second-time, and:
 
* Open Freeplane for a second-time, and:
 +
[[File:img6_2.png|frame|400x200px|none|link={{filepath:img6_2.png}}]]<br />
 +
[[File:img6_3.png|frame|400x200px|none|link={{filepath:img6_3.png}}]]<br />
 +
[[File:img6_4.png|frame|400x200px|none|link={{filepath:img6_4.png}}]]<br />
 +
 +
[[File:img7.png|frame|400x200px|none|link={{filepath:img7.png}}]]<br />
 +
[[File:img8.png|frame|400x200px|none|link={{filepath:img8.png}}]]<br />
 +
[[File:img9.png|frame|400x200px|none|link={{filepath:img9.png}}]]<br />
 +
[[File:img10.png|frame|400x200px|none|link={{filepath:img10.png}}]]<br />
  
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img7.png]]<br />
 
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img8.png]]<br />
 
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img9.png]]<br />
 
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img10.png]]
 
  
 
* Open Freeplane for a third-time, and:
 
* Open Freeplane for a third-time, and:
  
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img11.png]]
+
[[File:img11.png|frame|400x200px|none|link={{filepath:img11.png}}]]<br />
 +
 
 +
 
 +
* The following final window should appear, which indicates that the FreeplaneJrubyInstaller-addon is now installed! Hurray!
 +
 
 +
[[File:img12.png|frame|400x200px|none|link={{filepath:img12.png}}]]<br />
 +
 
 +
==== Youtube demo video: install FreeplaneJrubyInstaller Addon ====
 +
 
 +
https://youtu.be/sJUWTcPhOk0
 +
 
 +
 
 +
 
 +
 
 +
 
 +
==  How to use ruby scripts in Freeplane ==
 +
 
 +
Once the FreeplaneJrubyInstaller-addon is installed, you can then '''use ruby scripts in Freeplane'''
 +
 
 +
Lets take as an example, that you have a '''my_ruby_script.rb''' file, that you got from the wiki or the forum or from a friend, and you want to use it in Freeplane.
 +
 
 +
Do this:
 +
 
 +
# In Freeplane goto '''Tools/Open user directory''' to open the <code><freeplane-user-dir></code> in a new window
 +
# Inside the new window, open the subdirectory <code>scripts</code>
 +
# Copy/paste the new file into that subdirectory <br /> You should end up with: <code><freeplane-user-dir>/scripts/my_ruby_script.rb</code>
 +
# Freeplane only detects new ruby scripts after a restart. So now close Freeplane.
 +
# Open Freeplane again, and you will see that there is a new entry in the menu '''Tools/Scripts'''/'''''My_Ruby_Script''''' - click on it to run the new ruby script!
 +
 
 +
You now have the ruby script in freeplane: from now on whenever you want to run this script, just click again '''Tools/Scripts'''/'''''My_Ruby_Script'''''
 +
 
 +
==== Youtube demo video: how to use ruby scripts in Freeplane ====
 +
 
 +
https://youtu.be/ExqYF0SLGzI
 +
 
 +
 
  
* The following final window should appear, which indicates that Jruby is now installed in Freeplane. Hurray!
+
The first time you run a ruby-script in freeplane, it takes a while to "warm-up" jruby. Since the second and third and xxx times, the script will already run much faster. This also happens (in a lesser degree) with groovy scripts.
  
[[File:https://github.com/zipizap/FreeplaneJrubyInstaller/raw/gh-pages/images/img12.png]]
+
NOTE: To remove a script (either ruby or groovy), just delete the script from <code><freeplane-user-dir>/scripts/my_ruby_script.rb</code> and restart Freeplane.

Latest revision as of 21:39, 9 October 2017


Introduction

Freeplane supports groovy (.groovy) and javascript (.js) scripts out-of-the-box.

This addon adds support for ruby (.rb) scripts, enabling you to run ruby scripts (ex: <freeplane-user-dir>/scripts/my_ruby_script.rb) alongside the out-of-the-box .groovy and .js scripts.


The addon was made with 2 purposes:

  • To be helpfull for non-programmers who want to try first-steps-of-programming with Ruby and make simple Freeplane ruby scripts.
    Ruby is easy to learn, has many tutorials/books written for new programmers, and the RubyLiveDebugger (included in this addon) gives an instant-gratification-labtest for ruby and freeplane scripting (demo video)
    Start by installing the addon as explained in this page, and then switch to the FreeplaneJrubyInstaller - developers wiki page. Hope you have fun :)




How to install the FreeplaneJrubyInstaller-Addon in Freeplane

To run a freeplane ruby script, you first need to install the FreeplaneJrubyInstaller-addon in Freeplane


To install the addon follow the instructions bellow (click on any image to enlarge it):

You dont need to manually download anything, all downloads are automatic.


Img0.png
  • Copy to your clipboard THE-URL-TO-THE-ADDON (without any leading/trailing spaces! or it fails):

THE-URL-TO-THE-ADDON:

https://raw.githubusercontent.com/zipizap/FreeplaneJrubyInstaller/master/addon_lab/FreeplaneJrubyInstaller-v1.7.0.addon.mm

https://raw.githubusercontent.com/zipizap/FreeplaneJrubyInstaller/master/addon_lab/FreeplaneJrubyInstaller-v1.6.2.addon.mm



  • Follow the images:
Img1.png


Img2.png


Img3.png


Img4.png


Img5.png


Img6.png



  • Open Freeplane for a second-time, and:
Img6 2.png


Img6 3.png


Img6 4.png


Img7.png


Img8.png


Img9.png


Img10.png



  • Open Freeplane for a third-time, and:
Img11.png



  • The following final window should appear, which indicates that the FreeplaneJrubyInstaller-addon is now installed! Hurray!
Img12.png


Youtube demo video: install FreeplaneJrubyInstaller Addon

https://youtu.be/sJUWTcPhOk0



How to use ruby scripts in Freeplane

Once the FreeplaneJrubyInstaller-addon is installed, you can then use ruby scripts in Freeplane

Lets take as an example, that you have a my_ruby_script.rb file, that you got from the wiki or the forum or from a friend, and you want to use it in Freeplane.

Do this:

  1. In Freeplane goto Tools/Open user directory to open the <freeplane-user-dir> in a new window
  2. Inside the new window, open the subdirectory scripts
  3. Copy/paste the new file into that subdirectory
    You should end up with: <freeplane-user-dir>/scripts/my_ruby_script.rb
  4. Freeplane only detects new ruby scripts after a restart. So now close Freeplane.
  5. Open Freeplane again, and you will see that there is a new entry in the menu Tools/Scripts/My_Ruby_Script - click on it to run the new ruby script!

You now have the ruby script in freeplane: from now on whenever you want to run this script, just click again Tools/Scripts/My_Ruby_Script

Youtube demo video: how to use ruby scripts in Freeplane

https://youtu.be/ExqYF0SLGzI


The first time you run a ruby-script in freeplane, it takes a while to "warm-up" jruby. Since the second and third and xxx times, the script will already run much faster. This also happens (in a lesser degree) with groovy scripts.

NOTE: To remove a script (either ruby or groovy), just delete the script from <freeplane-user-dir>/scripts/my_ruby_script.rb and restart Freeplane.