| <?xml version="1.0" encoding="utf-8"?> |
| <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| xmlns:oneclick="org.apacheflex.mustella.oneclick.*" |
| creationComplete="windowedapplication1_creationCompleteHandler(event)" |
| width="800" |
| height="800" > |
| <fx:Declarations> |
| <!-- Place non-visual elements (e.g., services, value objects) here --> |
| </fx:Declarations> |
| <fx:Script> |
| <![CDATA[ |
| import mx.events.FlexEvent; |
| |
| public static const IS_MAC:Boolean = Capabilities.os.indexOf("Windows") == -1; |
| |
| [Bindable] protected var _pathSVNStr:String; |
| [Bindable] protected var _pathFlexStr:String; |
| [Bindable] protected var _pathMustellaTestStr:String; |
| [Bindable] protected var _pathMustellaStr:String; |
| [Bindable] protected var _shellPathStr:String; |
| |
| private const LSO_APACHE_FLEX_SDK:String = "LSO_APACHE_FLEX_SDK"; |
| private const LSO_SVN:String = "LSO_SVN"; |
| private const LSO_SHELL:String = "LSO_SHELL"; |
| private var so:SharedObject = SharedObject.getLocal("savedData"); |
| |
| protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void |
| { |
| maximize(); |
| if(so.data[LSO_APACHE_FLEX_SDK] != null) |
| { |
| setFlexSDKPaths(so.data[LSO_APACHE_FLEX_SDK]); |
| } |
| if(so.data[LSO_SVN] != null) |
| { |
| _pathSVNStr = so.data[LSO_SVN]; |
| } |
| if(so.data[LSO_SHELL] != null) |
| { |
| _shellPathStr = so.data[LSO_SHELL]; |
| } |
| else |
| { |
| _shellPathStr = (IS_MAC) ? "/bin/bash" : "c:\\windows\\system32\\cmd.exe"; |
| } |
| |
| terminal.shellPathStr = _shellPathStr; |
| } |
| |
| protected function setFlexSDKPaths(path:String):void |
| { |
| _pathFlexStr = so.data[LSO_APACHE_FLEX_SDK] = path; |
| _pathMustellaStr = _pathFlexStr + File.separator + "mustella"; |
| _pathMustellaTestStr = _pathMustellaStr + File.separator + "tests"; |
| webserver.setWebRoot(_pathMustellaTestStr); |
| dependencyDB.setMustellaDirectory(_pathMustellaStr); |
| testChooser.setMustellaDirectory(_pathMustellaStr); |
| terminal.pathFlexStr = _pathFlexStr; |
| } |
| |
| protected function handleSVNPathBrowse():void |
| { |
| openBrowseForDirectory("Select SVN location", handleSVNPathSelect); |
| } |
| |
| protected function handleFlexPathBrowse():void |
| { |
| openBrowseForDirectory("Select Apache Flex Directory", handleFlexPathSelect); |
| } |
| |
| protected function handleShellPathBrowse():void |
| { |
| openBrowseForFile("Select Shell Path", handleShellPathSelect); |
| } |
| |
| protected function openBrowseForDirectory(title:String,resultFunction:Function):void{ |
| var f:File = new File(); |
| f.addEventListener(Event.SELECT,resultFunction); |
| f.browseForDirectory(title); |
| } |
| |
| protected function openBrowseForFile(title:String,resultFunction:Function):void{ |
| var f:File = new File(); |
| f.addEventListener(Event.SELECT,resultFunction); |
| f.browseForOpen(title); |
| } |
| |
| protected function handleSVNPathSelect(event:Event):void |
| { |
| _pathSVNStr = so.data[LSO_SVN] = event.target.nativePath; |
| } |
| |
| protected function handleFlexPathSelect(event:Event):void |
| { |
| setFlexSDKPaths(event.target.nativePath); |
| } |
| |
| protected function handleShellPathSelect(event:Event):void |
| { |
| _shellPathStr = so.data[LSO_SHELL] = event.target.nativePath; |
| terminal.shellPathStr = _shellPathStr; |
| } |
| |
| protected function handleRun(type:String):void |
| { |
| terminal.cd(_pathMustellaStr); |
| terminal.run("./mini_run.sh -" + type); |
| } |
| |
| protected function handleStopBtnClick():void |
| { |
| terminal.stop(); |
| } |
| |
| protected function dependencyDB_completeHandler(event:Event):void |
| { |
| |
| } |
| |
| protected function handleGetModifiedFilesBtnClick():void |
| { |
| terminal.getSVNStatus(handleSVNStatusResult); |
| } |
| |
| private var _svnStatus:String; |
| protected function handleSVNStatusResult(status:String):void |
| { |
| if(status.charAt(0) == "M" && status.charAt(1) == " ") |
| { |
| testChooser.setSVNStatus(status); |
| } |
| } |
| |
| ]]> |
| </fx:Script> |
| <s:layout> |
| <s:HorizontalLayout /> |
| </s:layout> |
| <s:VGroup width="50%" height="100%"> |
| |
| <s:HGroup verticalAlign="middle" includeInLayout="false" visible="false"> |
| <s:Label text="SVN Path:" /> |
| <s:TextInput id="svnPathTxtInput" width="500" |
| text="{_pathSVNStr}"/> |
| <s:Button label="Browse" click="handleSVNPathBrowse()" /> |
| </s:HGroup> |
| <s:HGroup verticalAlign="middle"> |
| <s:Label text="Apache Flex SDK Path:" /> |
| <s:TextInput id="flexPathTxtInput" width="500" |
| text="{_pathFlexStr}"/> |
| <s:Button label="Browse" click="handleFlexPathBrowse()" /> |
| </s:HGroup> |
| <s:HGroup verticalAlign="middle" > |
| <s:Label text="Shell Path:" /> |
| <s:TextInput id="shellPathTxtInput" width="500" |
| text="{_shellPathStr}"/> |
| <s:Button label="Browse" click="handleShellPathBrowse()" /> |
| </s:HGroup> |
| <oneclick:WebServer id="webserver" title="Web server" width="100%" height="100%" /> |
| <oneclick:MustellaDependencyDB id="dependencyDB" title="Dependency DB" width="100%" height="100%" complete="dependencyDB_completeHandler(event)" /> |
| <oneclick:MustellaTestChooser id="testChooser" title="Test Chooser" width="100%" height="100%" /> |
| </s:VGroup> |
| <s:VGroup width="50%" height="100%"> |
| <s:HGroup width="100%"> |
| <s:Button label="Run All" click="handleRun('all')" /> |
| <s:Button label="Run Failures" click="handleRun('rerun')" /> |
| <s:Button label="Get Modified Files" click="handleGetModifiedFilesBtnClick()" /> |
| <s:Button label="Run only changes" click="handleRun('changes')" /> |
| <s:Button label="Stop" click="handleStopBtnClick()" /> |
| </s:HGroup> |
| <oneclick:CommandTerminal id="terminal" width="100%" height="100%" /> |
| </s:VGroup> |
| </s:WindowedApplication> |