Skip to content

Setting up for JRubyArt

Martin Prout edited this page Oct 25, 2015 · 15 revisions

Lets assume you have installed jEdit, new you will need to install the console plugin (Plugins/Plugin Manager/Install). To create a nice button under Macros menu create a macro:-

Put the macro k9.bsh in .jedit/macros folder setenv may not be required so comment out // to start with, then if required adjust for your OS (you can choose which jdk to use and or specify GEM_HOME).

/**
* k9.bsh by monkstone 25 October 2015
* A jedit bean shell macro, to load environment, and call
* k9 commando menu
*
* You must edit JAVA_HOME/GEM_HOME/GEM_PATH to match your system
*
*/
// setenv("JAVA_HOME", "/opt/jdk1.8.0_66");
// setenv("GEM_HOME", "/home/tux/.gem/ruby/2.2.0");
// setenv("GEM_PATH", "/home/tux/.gem/ruby/2.2.0");
// setenv("JRUBY_HOME", "/opt/jruby-9.0.3.0");
new console.commando.CommandoDialog(view,"commando.k9");

Next install the all important commando file k9.xml put in .jedit/console/commando folder

<?xml version="1.0"?>
<!DOCTYPE COMMANDO SYSTEM "commando.dtd">
<!-- Monkstone, 2015-October-25 for JRubyArt-1.0.0+ -->
<COMMANDO>
<UI>
<CAPTION LABEL="Run">
<FILE_ENTRY LABEL="ruby file" VARNAME="file" EVAL="buffer.getName()"/>
</CAPTION>
<CAPTION LABEL="Path to k9">
<ENTRY LABEL="path" VARNAME="k9path" DEFAULT=""/>
</CAPTION>
<CAPTION LABEL="Choose Run/Watch/Version">
<CHOICE LABEL="Select" VARNAME="type" DEFAULT="run" >
<OPTION  LABEL="run" VALUE="run"/>
<OPTION LABEL="watch" VALUE="watch"/>
<OPTION LABEL="version" VALUE="setup"/>
</CHOICE>
</CAPTION>
<CAPTION LABEL="JRuby Opt">
<TOGGLE LABEL="jruby-complete" VARNAME="jruby" DEFAULT="FALSE"/>
</CAPTION>
</UI>

<COMMANDS>
<COMMAND SHELL="System" CONFIRM="FALSE">
<!-- cd to working dir -->

	  buf = new StringBuilder("cd ");
	  buf.append(MiscUtilities.getParentOfPath(buffer.getPath()));
	  buf.toString();
	
</COMMAND>
<COMMAND SHELL="System" CONFIRM="FALSE">

	  buf = new StringBuilder(k9path);
	  buf.append("k9 ");
	  if (jruby){
	      buf.append("--nojruby ");
	  }	 
	  buf.append(type);
	  buf.append(" "); 
	  switch(type){
	  case "run":
	  case "watch":
	      buf.append(file);
	      break;
	  case "setup":
              buf.append("check");
	      break;	  
	  }
	  buf.toString();
	
</COMMAND>
</COMMANDS>
</COMMANDO>

Here is the commando menu that pops up, you only have to enter path to k9 once (it gets 'remembered' for you), note that you can readily toggle using jruby-complete using the jruby-complete checkbox widget which adds the --nojruby flag required for some sketches.

Console

Clone this wiki locally