(Quick Reference)

3 Integration with Editors and IDEs - Reference Documentation

Authors: Yasuharu NAKANO

Version: 0.3

3 Integration with Editors and IDEs

If the editor which you uses supports for external tools, you can immediately execute the code on the current editor by one action. To do it, you have to set up something.

3.1 IntelliJ IDEA

External Tools

  1. Open Settings dialog from "Preferences" menu.
  2. Select "External Tools" at left pane.
  3. Click the below "+" button to show "Edit Tool" dialog:
  4. Set the fields as follows if shell script is available in your environment:
    FieldValueRemarks
    NameImprox: SmartInvoker [sh] 
    GroupGrails 
    Program/path/to/improxSmartInvoker.sh 
    Parameters$FilePath$ 
    Working directory$FileDir$ 
    Else:
    FieldValueRemarks
    NameImprox: SmartInvoker [Groovy] 
    GroupGrails 
    Program/path/to/groovyclientYou can use normal groovy command, but it needs a global JAVA_HOME environment variable and your patience.
    Parameters/path/to/improxSmartInvoker.groovy $FilePath$using a white space as delimiter
    Working directory$FileDir$ 
  5. Click "OK" button to save.

Keymap

  1. Open Settings dialog from "Preferences" menu.
  2. Select "Keymap" at left pane.
  3. Right-click "External Tools > Grails > Improx: SmartInvoker (which you want)" item at right pane and select "Add Keyboard Shortcut" item:
  4. Push your favorite key at "First Stroke" field on the "Enter Keyboard Shortcut" dialog:
  5. Click "OK" button to save.

Try to run

  1. Open a test class in the editor.
  2. Push the key which you set, for example, F9.
  3. Improx plugin run only the active test file and output the result to "Run" view in real time:

In case of using GroovyServ, you should run groovyserver command at once in advance.

3.2 Eclipse (STS/GGTS)

External Tools

  1. Open "External Tools Configurations" dialog from "Run > External Tools > External Tools Configurations..." menu.
  2. Right click on "Program" item at left pane and select "New" item:
  3. Set the fields as follows if shell script is available in your environment:
    FieldValueRemarks
    NameGrails Improx SmartInvoker [sh] 
    Location/path/to/improxSmartInvoker.sh 
    Working Directory${container_loc} 
    Arguments${resource_loc} 
    Else:
    FieldValueRemarks
    NameGrails Improx SmartInvoker [Groovy] 
    Location/path/to/groovyclientYou can use normal groovy command, but it needs a JAVA_HOME environment variable at "Environment" tab and your patience.
    Working Directory${container_loc} 
    Arguments/path/to/improxSmartInvoker.groovy ${resource_loc}using a white space as delimiter
  4. Click "OK" button to save.

Try to run

  1. Open a test class in the editor.
  2. Open "External Tools Configurations" dialog from "Run > External Tools > External Tools Configurations..." menu.
  3. Select "Grails Improx SmartInvoker (which you want)" item at left pane and click "Run" button.
  4. Improx plugin run only the active test file and output the result to "Console" view in real time:

In case of using GroovyServ, you should run groovyserver command at once in advance.

After second time, you can easily run the external tool from the submenu of "Run > External Tools" .

3.3 Sublime Text 2

Build System

  1. Select "Tools > Build System > New Build System..." menu to open new file.
  2. Edit as follows and save the file as Groovy.sublime-build (in Packages/User directory as default).

If shell script is available in your environment:

{
    "cmd": [
        "/path/to/improxSmartInvoker.sh",
        "$file"
    ],
    "file_regex": "\\((.*?):([0-9]*)\\)",
    "selector": "source.groovy"
}

Else:

{
    "cmd": [
        "/path/to/groovyclient", // OR /path/to/groovy
        "/path/to/improxSmartInvoker.groovy",
        "$file"
    ],
    "file_regex": "\\((.*?):([0-9]*)\\)",
    "selector": "source.groovy"
}

Try to run

  1. Open a test class in the editor.
  2. Select "Tools > Build" menu (or push a shortcut key, like super+b)
  3. Improx plugin run only the active test file and output the result to Bulid Results pane in real time:

In case of using GroovyServ, you should run groovyserver command at once in advance.

3.4 Vim + QuickRun

quickrun.vim

  1. Install quickrun.vim plugin if you hasn't done so. (cf. Invoking Groovy Script Directly on Vim using quickrun.vim and GroovyServ)
  2. Add the following lines into your .vimrc and save.

If shell script is available in your environment:

let g:quickrun_config = {}
let g:quickrun_config.groovy = {'command' : '/path/to/improxSmartInvoker.sh', 'cmdopt': ''}

Else:

let g:quickrun_config = {}
let g:quickrun_config.groovy = {'command' : '/path/to/groovyclient', 'cmdopt': '/path/to/improxSmartInvoker.groovy'}

Try to run

  1. Open a test class in the editor.
  2. Execute ex command :QuickRun (or type <Leader> r.)
  3. Improx plugin run only the active test file and output the result to a buffer after it completely finishes:

In case of using GroovyServ, you should run groovyserver command at once in advance.