External Tools

Squore uses a menus folder in its configuration so you can add functionality that will be available in the user interface to run external tools. These external scripts are launched in Squore Server's context, and can therefore benefit from Squore's authentication and permission mechanism. They are launched from the web interface via a Tools menu visible to the users whose profile grants access to the Use External Tools feature.

Each external tool is defined within its own sub-folder in menus and appears as a link in the main Squore toolbar, as shown below:

A Tools menu containing an external tool to create a demo environment, and the associated page to configure and launch the script.

The menu in the image above was added using a form.xml and form_en.properties files. Clicking the Execute button passes the user selections to a script called execute.tcl.

<SQUORE_HOME>/configuration/menus/CreateDemo/form.xml

<?xml version="1.0" encoding="UTF-8"?>
<tags baseName="Generic" multiUsers="true" users="demo" groups="demo" image="earth.png">
	<tag type="multipleChoice" key="demo" displayType="comboBox" defaultValue="ANALYTICS">
		<value key="ANALYTICS" />
		<value key="ANALYTICS_C" />
		<value key="ANALYTICS_MILESTONES" />
		<value key="ANALYTICS_JAVA" />
	</tag>		
	<tag type="multipleChoice" key="useAccountCredentials" displayType="radioButton" 
			defaultValue="USE_ACCOUNT_CREDENTIALS" credentialType="USE_ACCOUNT_CREDENTIALS" hide="true">
		<value key="NO_CREDENTIALS" />
		<value key="USE_ACCOUNT_CREDENTIALS" />
		<value key="PERSONAL_CREDENTIALS" />
	</tag>	
	<tag type="text" key="username" credentialType="LOGIN" hide="true"/>
	<tag type="password" key="password" credentialType="PASSWORD" hide="true"/>
</tags>

<SQUORE_HOME>/configuration/menus/CreateDemo/form_en.properties

FORM.GENERAL.NAME=Build demo projects
FORM.GENERAL.DESCR=Menu to create sample projects for demo purposes.
FORM.GENERAL.URL=http://www.squoring.com/

TAG.demo.NAME=Demo:
OPT.ANALYTICS.NAME=Software Analytics - All samples
OPT.ANALYTICS_C.NAME=Software Analytics - C samples
OPT.ANALYTICS_MILESTONES.NAME=Software Analytics - Milestones demo
OPT.ANALYTICS_JAVA.NAME=Software Analytics - Java samples

<SQUORE_HOME>/configuration/menus/CreateDemo/execute.tcl

set demo [set ${::toolName}::demo]
set csv [file join [file dirname [info script]] csv]
set today [clock seconds]

proc clock_add {num} {
	set days [expr {3600 * 24}]
	return [clock format [expr {$::today + ($num * $days)}] -format {%Y-%m-%d}]
}

if {[string equal $demo ANALYTICS] || [string equal $demo ANALYTICS_C]} {
	# Earth
	create_project --group "C" --teamUser=$user,PROJECT_MANAGER\;$user,QUALITY_ENGINEER\;$user,TESTER\;$user,DEVELOPER --name=Earth --version=V1 "--versionDate=[clock_add -228]T01:00:00" --wizardId=ANALYTICS --color=rgb(130,196,240) -d type=CPPCheck,xml=$squore_home/samples/c/Earth/V1/cppcheck.xml -r type=FROMPATH,path=$squore_home/samples/c/Earth/V1
	# ...
}

if {[string equal $demo ANALYTICS] || [string equal $demo ANALYTICS_C] || [string equal $demo ANALYTICS_MILESTONES]} {

	# Test Milestone
	set project_name Sun
	create_project --group "C" --name=$project_name --version=V1 "--versionDate=[clock_add -148]T01:00:00" --teamUser=$user,PROJECT_MANAGER\;$user,QUALITY_ENGINEER\;$user,TESTER\;$user,DEVELOPER \
	-M "id=SPRINT1,date=[clock_add -148]T02:00:00,D.TECH_DEBT=1000.0,D.ROKR_SUBSET=50%,D.ISSUE_BLOCKER=10,D.ISSUE_CRITICAL=15,D.ISSUE_MAJOR=20,D.SDESCR=0%"
	--wizardId=ANALYTICS --color=rgb(130,196,240) -d type=CPPCheck,xml=$squore_home/samples/c/Earth/V6/cppcheck.xml -r type=FROMPATH,path=$squore_home/samples/c/Earth/V6
	# ...
}

if {[string equal $demo ANALYTICS] || [string equal $demo ANALYTICS_JAVA]} {
	# JAVA
	create_project --group "Java" --teamUser=$user,PROJECT_MANAGER\;$user,QUALITY_ENGINEER\;$user,TESTER\;$user,DEVELOPER --name=Freemind 		--version=0.9.0 	"--versionDate=[clock_add -47]T01:00:00" 	--wizardId=ANALYTICS --color=rgb(130,196,240) 	-d type=CheckStyle,xml=$squore_home/samples/java/Freemind/0.9.0/checkstyle.xml 		-d type=PMD,xml=$squore_home/samples/java/Freemind/0.9.0/pmd.xml 	-r type=FROMPATH,path=$squore_home/samples/java/Freemind/0.9.0
	# ...
}

The forms element accepts the following attributes:

You can then add a series of tag elements that follow the same specification as the one described in the section called “Attributes” to use as parameters on your custom page, with two extra types available:

Tip

Each tag element accepts the attribute required (optional, default value: false), which allows marking the field as required and displays a red asterisk next to the field label. The required attribute is also valid in the form.xml files you create for your custom Data Providers and Repository Connectors.

The following variables are injected in the script execute.tcl before execution:

External Tools allow using several functions like create_project, which are covered in more details in Appendix C, External Tools Reference.