<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nobien &#187; ActionScript 3</title>
	<atom:link href="http://blog.nobien.net/category/actionscript_3/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nobien.net</link>
	<description>A nerd blog about nerdy things by ... nerdy guys?</description>
	<lastBuildDate>Mon, 19 Jul 2010 14:27:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Practicing Continuous Integration on Flash Projects : Using Hudson</title>
		<link>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/</link>
		<comments>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 13:56:41 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.nobien.net/?p=304</guid>
		<description><![CDATA[In the previous part of my series "Practicing Continuous Integration on Flash Projects" I described how to setup a CI server using Amazon's EC2 service. In this final part of the series I'm going to quickly show you how to set up your project in Hudson so that it can build it. Using Hudson If you're [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a title="Integration Server Setup" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/">previous part</a> of my series "Practicing Continuous Integration on Flash Projects" I described how to setup a CI server using Amazon's EC2 service. In this final part of the series I'm going to quickly show you how to set up your project in Hudson so that it can build it.</p>
<h2>Using Hudson</h2>
<p>If you're practicing CI properly you should be integrating new code on a pretty regular basis. When new code is integrated the project should then run through its build process which should include running all the unit tests and building the project if all the unit tests pass. This is where Hudson comes in. Hudson can monitor your source repository and whenever new code is committed it will retrieve it and build the project. Now I'm going to show you how to set up the CIExample project in Hudson.</p>
<p><span id="more-304"></span></p>
<p>If you happen to follow the steps in the previous part of this series, or have your own Hudson server properly configured navigate to the Hudson install's home page. It should look like this:</p>
<div id="attachment_306" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-intro.jpg"><img class="size-medium wp-image-306" title="hudson-intro" src="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-intro-299x181.jpg" alt="" width="299" height="181" /></a><p class="wp-caption-text">Hudson dashboard</p></div>
<p>Click the "New Job" link in the top left. In the 'Job name' field enter 'CIExample' and select the "Build a free-style software project" option. The screen should look like this:</p>
<div id="attachment_308" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-newjob1.jpg"><img class="size-medium wp-image-308" src="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-newjob1-299x181.jpg" alt="New job screen" width="299" height="181" /></a><p class="wp-caption-text">New job screen</p></div>
<p>Click the OK button. If you'd like you can fill out a description for the project. But for now we're going to be quick and dirty. Scroll down a bit to the Source Code Management section. Select the Subversion option and some form fields should appear. Configure the repository URL with the CIExample project SVN repository: <a href="http://ci-example.googlecode.com/svn/trunk/">http://ci-example.googlecode.com/svn/trunk/</a> It should look like this:</p>
<div id="attachment_309" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-subversion.jpg"><img class="size-medium wp-image-309" title="hudson-subversion" src="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-subversion-299x181.jpg" alt="" width="299" height="181" /></a><p class="wp-caption-text">Hudson source code management configuration</p></div>
<p>Scroll all the way down so that you can see the Build Environment and Build sections. First check the "Run Xvnc during build" check box. This ensures the Flash Player will be able to be used when inspecting the unit tests. Lastly, in the Build section, click the "Add build step" button and select "Invoke Ant" from the list of options. We don't need to specify any targets since the default target of the project's build file builds the project. The screen should look like this:</p>
<div id="attachment_312" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-vnc-ant1.jpg"><img class="size-medium wp-image-312" title="hudson-vnc-ant" src="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-vnc-ant1-299x181.jpg" alt="" width="299" height="181" /></a><p class="wp-caption-text">Hudson VNC and ANT configuration</p></div>
<p>Lastly, click the "Save" button to save the project. This should take you to the project's dashboard and look like this:</p>
<div id="attachment_311" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-project.jpg"><img class="size-medium wp-image-311" title="hudson-project" src="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-project-299x181.jpg" alt="" width="299" height="181" /></a><p class="wp-caption-text">Hudson project dashboard</p></div>
<p>Now, the only thing left to do is click the "Build Now" button in the left hand navigation. After a second or two of clicking the button a notification window should appear and should look like this:</p>
<div id="attachment_314" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-notification1.jpg"><img class="size-medium wp-image-314" title="hudson-notification" src="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-notification1-299x181.jpg" alt="" width="299" height="181" /></a><p class="wp-caption-text">Hudson notification panel</p></div>
<p>If everything has been installed and configured properly the build should be successful and you'll see a little blue dot notifying you that the build has completed. It should look like this:</p>
<div id="attachment_315" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-completed.jpg"><img class="size-medium wp-image-315" title="hudson-completed" src="http://www.nobien.net/blog/wp-content/uploads/2010/07/hudson-completed-299x181.jpg" alt="" width="299" height="181" /></a><p class="wp-caption-text">Build completed!</p></div>
<p>Wa-la! Thats it! You've got Hudson working and building your project for you. Pretty awesome. Now you can configure the project with various options. For instance, you can configure Hudson to build the project whenever it detects new code has been committed to the repository so that you don't have to initiate the build by hand every time.</p>
<h2>Wrap Up</h2>
<p>So that concludes my "Practicing Continuous Integration on Flash Projects" series. In the first part I covered what Continuous Integration is and why it might be useful to your process. In the second part of the series I covered how to set up a project and its unit tests with the assumption that the build and tests will be automated. In the third part of the series I covered how to automate the build process using Apache Ant. In the fourth part of the series I covered how to setup a Continuous Integration server on a bare bones Fedora 8 Linux box using Amazon's EC2 service. And lastly, in this fifth and final part I covered how to setup the project in Hudson so that the build process can be automated and monitored</p>
<p>Series Index</p>
<ol>
<li><a title="What is CI?" href="http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/">What is CI?</a></li>
<li><a title="Project Structure" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/">Project Structure</a></li>
<li><a title="Automation" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/">Automation</a></li>
<li><a title="Integration Server Setup" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/">Integration Server Setup</a></li>
<li><a title="Using Hudson" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/">Using Hudson</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Practicing Continuous Integration on Flash Projects : Integration Server Setup</title>
		<link>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/</link>
		<comments>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 13:52:49 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.nobien.net/?p=290</guid>
		<description><![CDATA[In the previous part of my series "Practicing Continuous Integration on Flash Projects" I explained how to use Apache Ant and the Flex SDK to automate the build process of a project. In this part of the series I'm going to show you how to set up Hudson, an integration server, on a bare bones [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a title="Automation" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/">previous part</a> of my series "Practicing Continuous Integration on Flash Projects" I explained how to use Apache Ant and the Flex SDK to automate the build process of a project. In this part of the series I'm going to show you how to set up <a title="Hudson CI Server" href="http://www.hudson-ci.org/">Hudson</a>, an integration server, on a bare bones Fedora 8 Linux box.</p>
<h2>Introduction</h2>
<p>Code integration happens whenever you commit code into the project's mainline. There are essentially two camps when it comes to building the project after new code has been committed. Some developers prefer to do it manually, meaning that the developer switches to the "integration machine", checks out the new code and runs the build process. If the build is successful then the developer's commit is also successful. If its not successful, then the developer should revert their commit, make adjustments to their code, and attempt to integrate again later.</p>
<p>The other camp enjoys using a CI server such as Hudson or CruiseControl. A CI server will monitor the project's mainline and attempt to build the project any time new code is committed. A developer can check out the CI server website to see the progress or the eventual status of the build. When the build is complete, successful or not, the CI server should notify the developer who committed the new code. Personally I think a CI server is an invaluable tool when it comes to practicing CI and thus I'd like to show you how to get Hudson up and running.</p>
<p><span id="more-290"></span></p>
<h2>Amazon EC2</h2>
<p><a title="Amazon Web Sevices" href="http://aws.amazon.com/">Amazon EC2</a> is a great service that allows you to create computing resources on demand. In other words, it gives you an easy way of expanding your network infrastructure without actually having to buy hardware. In my mind, its the perfect service to run a CI server on because its easy to use and relatively cheap (you only pay for what you use). Otherwise, you'll need to find an machine in your network to install your flavor of CI server on. Personally, I'd rather not bog down an existing machine on my network with building projects. Amazon EC2 gives me nearly instant access to a virtual Linux box with root access and a decent amount of storage.</p>
<h2>Creating an Instance on EC2</h2>
<p>First allow me to make a disclaimer. Just because I'm advocating the use of EC2, doesn't mean you'll need an Amazon Web Services account to run a CI server. The steps needed to get Hudson up and running will depend on the flavor of Linux you're running, but if you know Linux then it shouldn't be too hard to know what to adjust for your setup. Additionally, Hudson runs just fine on Windows. If you need information about installing Hudson on other platforms visit their <a href="http://www.hudson-ci.org/">website</a>.</p>
<p>So, before we can do anything, we'll need a machine to run Hudson on. With EC2 that means starting an instance. Before starting up an instance you should consider if you might ever want to reuse the resulting system configuration. If you think you might want to reuse it then ensure that you create an EBS backed instance. This will allow you to easily create an AMI from it and then be able to easily launch a new instance of the same configuration later on. Information about creating an EBS backed instance can be found in their <a title="EC2 documentation" href="http://aws.amazon.com/documentation/ec2/">documentation</a>.</p>
<p>For the purpose of this example a small instance of a bare bones, 32-bit, Fedora 8 system is just fine. Here is what I did to get my instance running:</p>
<ol>
<li>Log in to the AWS Management Console</li>
<li>Click the <strong>AMIs</strong> button in the navigation panel on the left hand side</li>
<li>Select <strong>EBS Images</strong> from the combo box labeled <strong>Viewing</strong> above the list of AMIs</li>
<li>Click the <strong>Owner</strong> column label to sort the AMIs by owner.</li>
<li>Select the AMI with the source name <strong>amazon/fedora-8-i386-v1.14-std</strong>. It should be the first one on the list.</li>
<li>Click the <strong>Launch</strong> button above the list.</li>
<li>Select the default settings on the Instance Details panel</li>
<li>Create a key pair or use an existing key pair.</li>
<li>Configure the firewall to allow connections on port 22, 80, 8080 and any other ports that you think might be necessary</li>
<li>Review the details and launch the instance.</li>
</ol>
<p>Eventually you're instance will show up as running in the dashboard. Once its running ensure you can connect to the instance using your favorite SSH client. I personally use PuTTy. Bear in mind that EC2 instances don't use password authentication to connect. They use the public keys. PuTTy is a little weird when it comes to public keys and requires them to be converted to a specific format. Luckily Amazon has a <a title="PuTTy info" href="http://docs.amazonwebservices.com/AmazonEC2/gsg/2007-01-19/putty.html">quick little tutorial</a> on how to properly configure PuTTy with the public keys.</p>
<h2>Software</h2>
<p>Once you're able to connect to your instance its time to start installing all the software you'll need to run Hudson and build your Flash project. The following is a list of all the software needed:</p>
<ol>
<li>vnc (remote display system)</li>
<li>vnc-server (to allow connections)</li>
<li>X-Window (windowing agent)</li>
<li>GNOME (window manager/desktop)</li>
<li>Subversion (SVN)</li>
<li>Java Development Kit (JDK)</li>
<li>Apache Tomcat (or other Java servlet service)</li>
<li>Apache Ant</li>
<li>Flex SDK</li>
<li>Hudson</li>
<li>Xvnc plugin for Hudson</li>
</ol>
<p><strong>Installing vnc and vnc-server</strong><br />
Installing vnc and vnc-server is important because in order to analyze the compiled unit tests the resulting SWF needs to run in the Flash Player. Linux needs a windowing environment and a way of redirecting the windowing output to a virtual display. vnc is what does the redirecting. To install vnc and vnc-server simply type the following commands and agree to download the files:</p>
<p><em># yum install vnc<br />
#yum install vnc-server </em></p>
<p><strong>Installing X-Window (X11)</strong><br />
As previously mentioned, you'll need a windowing environment to run the Flash Player, particularly for analyzing unit test results. To install X-Window type the following command:</p>
<p><em># yum -y install xorg*</em><em> </em></p>
<p><strong>Installing GNOME</strong><br />
X-Window(X11) will need a window manager and, more importantly, we'll need a window manager that works with X11 and doesn't require any user input to create a screen. GNOME is a decent choice and will make connecting through a visual VNC client pretty nice as well. To install GNOME type the following command:</p>
<p># yum groupinstall "GNOME Desktop Environment"</p>
<p><strong>Installing Subversion</strong><br />
The CIExample project resides in a Subversion repository on Google Code, thus you'll need Subversion to be installed to retrieve it. To install Subversion simply type the following:</p>
<p><em># yum install subversion</em></p>
<p><strong>Installing the Java Development Kit</strong><br />
Installing the JDK is a little tricky mainly because Sun doesn't make finding the distributable files very easy. You'll want to download a binary package from somewhere into some location on the machine. I like to create a downloads folder at the root of the machine for this. At the time of writing this you can download the latest self extracting RPM by typing the following commands:</p>
<p><em># wget http://www.java.net/download/jdk6/6u21/promoted/b05/binaries/jdk-6u21-ea-bin-b05-linux-i586-29_may_2010-rpm.bin<br />
# chmod 755 jdk-6u21-ea-bin-b05-linux-i586-29_may_2010-rpm.bin<br />
# ./</em><em>jdk-6u21-ea-bin-b05-linux-i586-29_may_2010-rpm.bin</em></p>
<p>To confirm the JDK was installed, you can type the following command:</p>
<p><em># java -version</em></p>
<p>You should see something like the following:</p>
<p><em>java version "1.6.0_21-ea"<br />
Java(TM) SE Runtime Environment (build 1.6.0_21-ea-b05)<br />
Java HotSpot(TM) Client VM (build 17.0-b15, mixed mode, sharing)</em></p>
<p><strong>Install Apache Tomcat</strong></p>
<p>Apache Tomcat is needed because Hudson is written in Java. Before we install tomcat, however, a new Linux user should be created to run tomcat under. Create a user named tomcat by typing the following command:</p>
<p><em># useradd tomcat</em></p>
<p>Switch to the tomcat user by typing the following command:</p>
<p><em># su tomcat</em></p>
<p>Create a folder for tomcat to be installed in within the /usr/local folder by typing the following commands:</p>
<p><em># cd /usr/local<br />
# mkdir tomcat</em></p>
<p>Download Apache Tomcat into the folder you created from any of the available mirrors and extract the files. At the time of this writing I typed the follwing:</p>
<p><em># cd tomcat<br />
# wget http://mirror.atlanticmetro.net/apache/tomcat/tomcat-7/v7.0.0-beta/bin/apache-tomcat-7.0.0.tar.gz<br />
# tar -xvf apache-tomcat-7.0.0.tar.gz</em></p>
<p>Now all the files for tomcat are located in /usr/local/tomcat/apache-tomcat-7.0.0. Last thing to do now is switch back to the root user:</p>
<p><em># exit </em></p>
<p><strong>Install Apache Ant</strong><br />
Apache Ant is need to run the automated build process. Ant doesn't require anything special for installing, simply download the binary and extract it into a convenient location. I prefer to install it in the the /usr/ant/&lt;version&gt; folder. Also, don't forget to switch back to the root user. At the time of this writing I typed the following:</p>
<p><em># cd /usr<br />
# mkdir ant<br />
# cd ant<br />
# wget http://apache.opensourceresources.org/ant/binaries/apache-ant-1.8.1-bin.tar.gz<br />
# tar -xvf apache-ant-1.8.1-bin.tar.gz</em></p>
<p>Now all the files for Ant should reside in the folder /usr/ant/apache-ant-1.8.1.</p>
<p><strong>Install the Flex SDK</strong><br />
Now we need to install the Flex SDK. This will be just like installing Ant. I like to install any SDK's in a folder structure such as this: /sdk/&lt;name-version&gt;. Type the following to install the Flex SDK:</p>
<p><em># cd /<br />
# mkdir sdk<br />
# cd sdk<br />
# mkdir flex-4.1<br />
# wget http://fpdownload.adobe.com/pub/flex/sdk/builds/flex4/flex_sdk_4.1.0.16076.zip<br />
# unzip flex_sdk_4.1.0.16076.zip -d /sdk/flex-4.1</em></p>
<p><strong>Set Environment Variables and Permissions</strong><br />
In order for a lot of this software to run properly you'll need to set some environment variables, add additional directories to the system PATH variable, change some file permissions. First, lets set the JAVA_HOME, ANT_HOME, CATALINA_HOME and FLEX_HOME environment variables and add Ant to the system PATH. To do this we'll need to edit the /etc/profile file. Type the following to open the file in the basic vi text editor:</p>
<p><em># vi/etc/profile</em></p>
<p>Now we need to add some new lines to the file. Using the vi text editor is a little weird if you haven't used it before. I'll describe exactly what I did.</p>
<ol>
<li>Navigate one line below the line that reads: "<em>export PATH USER LOGNAME MAIL HOSTNAME HITSIZE INPUTRC</em>" by using the arrow keys on your keyboard.</li>
<li>Press the letter <em>i </em>on your keyboard to enter insert mode.</li>
<li>Enter the following text into the file:
<div id="_mcePaste"><em>export JAVA_HOME=/usr/java/jdk1.6.0_21</em></div>
<div id="_mcePaste"><em>export ANT_HOME=/usr/ant/apache-ant-1.8.1</em></div>
<div id="_mcePaste"><em>export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-7.0.0<br />
export FLEX_HOME=/sdk/flex-4.1</em></div>
<div id="_mcePaste">
<div id="_mcePaste"><em>export PATH=$PATH:$ANT_HOME/bin<br />
</em></div>
</div>
</li>
<li>Press the <em>escape</em> key on your keyboard to exit insert mode</li>
<li>Type the following to save and quit the text editor:<em>:wq</em></li>
<li>Logout of your SSH session</li>
<li>Log back into your SSH session</li>
<li>Verify that each environment variable has been set by typing the following:<br />
<em><br />
# echo $JAVA_HOME<br />
# echo $ANT_HOME<br />
# echo $CATALINA_HOME<br />
# echo $FLEX_HOME<br />
</em></li>
<li>Verify that Ant can be called by the tomcat user from within the tomcat folder by typing the following:<br />
<em><br />
# su tomcat<br />
# cd /usr/local/tomcat<br />
# ant -version </em></li>
</ol>
<p>Hopefully all went well for you there. Now we just need to change the permissions on the Flex SDK so that any user Linux user, specifically the tomcat user, can use the SDK. Type the following:</p>
<p><em># exit (switch back to root user)<br />
# cd /sdk<br />
# chmod -R 755 flex-4.1 </em></p>
<p>Verify the tomcat user can execute the mxmlc compiler by typing the following:</p>
<p><em># cd /usr/local/tomcat<br />
# su tomcat<br />
# /sdk/flex-4.1/bin/mxmlc</em></p>
<p>If you don't get a permission error you're good to go!</p>
<p><strong>Installing Hudson</strong><br />
Hudson can be installed in many ways, but in my opinion, the easiest way to install it is to deploy through the Tomcat manager. First you'll need to download Hudson to your local machine. The most recent WAR file can always be downloaded from <a title="Latest Version of Hudson" href="http://hudson-ci.org/latest/hudson.war">this link</a>. Save it somewhere easy to remember.</p>
<p>Now before you can access the Tomcat manager you're going to need to add a user with permission to view the web manager. To do this we need to modify the Tomcat user file. Type the following:</p>
<p># su tomcat<br />
# vi /usr/local/tomcat/apache-tomcat-7.0.0/conf/tomcat-users.xml</p>
<p>Now modify the file using the following steps:</p>
<ol>
<li> Navigate between the &lt;tomcat-users&gt;&lt;/tomcat-users&gt; XML node by using the arrow keys on your keyboard.</li>
<li>Press the <em>i </em>key on your keyboard to enter insert mode.</li>
<li>Enter the following text:&lt;user username="admin" password="tomcatadmin" roles="manager-gui"/&gt;</li>
<li>Modify the username and password to your liking.</li>
<li>Press the <em>escape</em> key on your keyboard to exit insert mode.</li>
<li>Type the following to save and quit the text editor<br />
<em>:wq&lt;enter&gt;</em></li>
</ol>
<p>Now its time to startup Tomcat. To start Tomcat type the following:</p>
<p><em> # $CATALINA_HOME/bin/startup.sh</em></p>
<p>You should see some output in the console. Now, open your favorite web browser and navigate to the URL of your EC2 instance on port 8080. For instance, my url looked like this:</p>
<p><em>http://&lt;some-ec2-id&gt;.compute-1.amazonaws.com:8080</em></p>
<p>Navigate to the manager console by clicking on the <em>Tomcat Manager </em>button in the left navigation under the Administration tab. Login with the user credentials you created in the tomcat-users.xml file. You should see a list of the web apps that have been packaged with Tomcat. Now its time to deploy Hudson on Tomcat. Perform the following:</p>
<ol>
<li>Scroll down to the <em>Deploy</em> section of the manager console.</li>
<li>Click the <em>Choose File </em>button in the <em>War file to deploy</em> section of the console.</li>
<li>Click the <em>deploy</em> button below the <em>Choose File</em> button.</li>
<li>Wait for the file to upload</li>
<li>Find Hudson in the list of applications and verify that it is running</li>
</ol>
<p>Now there's a little tricky thing you have to do in order to get the index page of Hudson to appear. From what I understand its discrepency in the Java servlet specification. Alas, all you need to do is modify Hudson's web.xml file.</p>
<ol>
<li>Open Hudson's web.xml file in a text editor by typing the following:<br />
<em># vi /usr/local/tomcat/apache-tomcat-7.0.0/webapps/hudson/WEB-INF/web.xml<br />
</em></li>
<li>Find the &lt;servlet-mapping&gt; node that looks like the following:<br />
<em>&lt;servlet-mapping&gt;<br />
&lt;servlet-name&gt;Stapler&lt;/servlet-name&gt;<br />
&lt;url-pattern&gt;/&lt;/url-pattern&gt;<br />
&lt;/servlet-mapping&gt;<br />
</em></li>
<li>Press the letter <em>i</em> on your keyboard to enter insert mode.</li>
<li>Modify the entry to look like the following:<br />
<em>&lt;servlet-mapping&gt;<br />
&lt;servlet-name&gt;Stapler&lt;/servlet-name&gt;<br />
&lt;url-pattern&gt;/</em><strong><em>*</em></strong><em>&lt;/url-pattern&gt;<br />
&lt;/servlet-mapping&gt;<br />
</em></li>
<li>Press the <em>escape</em> key on your keyboard to exit insert mode.</li>
<li>Type the following command to save and quit<br />
<em>:wq&lt;enter&gt;</em></li>
</ol>
<p>Now you can view Hudson in your browser with no trouble. Go to the following URL:</p>
<p><em>http://&lt;some-ec2-id&gt;.compute-1.amazonaws.com:8080/hudson/</em></p>
<p>You should now be able see the Hudson dashboard!</p>
<p><strong>Install Hudson Plugins</strong><br />
There are loads of plugins for Hudson, including this totally sweet<a title="Chuck Norris Hudson Plugin" href="http://wiki.hudson-ci.org/display/HUDSON/ChuckNorris+Plugin"> Chuck Norris Plugin</a>, that you may or may not want to install. At the very least you'll need at least one Hudson plugin to be able to run vnc so that the Flash Player can redirect its output. Download the <a title="Download Xvnc plugin for Hudson" href="http://hudson-ci.org/latest/xvnc.hpi">Xvnc plugin</a> to your local machine.  Navigate to the Advanced panel of the Hudson plugin manager by going to the following URL:</p>
<p><em>http://&lt;some-ec2-id&gt;.compute-1.amazonaws.com:8080/hudson/pluginManager/advanced</em></p>
<p>Upload the plugin using the <em>Upload Plugin</em> section of the plugin manager. Once both plugins are uploaded you'll need to restart Hudson. Navigate to the Tomcat manager again</p>
<p><em>http://&lt;some-ec2-id&gt;.compute-1.amazonaws.com:8080/manager/html</em></p>
<p>Find Hudson in the list of web apps again and click <em>Reload </em>button to the right under the <em>Commands</em> column. Once this has completed, verify that the plugins have been installed by navigating to:</p>
<p><em>http://&lt;some-ec2-id&gt;.compute-1.amazonaws.com:8080/hudson/pluginManager/installed</em></p>
<p>You should now see the Git and Xvnc plugins listed.</p>
<p><strong>Configure the Flash Player Debugger</strong><br />
I know this seems like a lot, but we're almost there. Time to configure the Flash Player debugger. First we'll need to extract the debugger from the Flex SDK. Make sure you switch back to the root user if you haven't already. Type the following commands:</p>
<p><em># cd /sdk/flex-4.1/runtimes/player/10.1/lnx<br />
# tar -xvf flashplayerdebugger.tar.gz </em></p>
<p>Now that the debugger has been extracted you you'll need to create a a symbolic link to it named <em>gflashplayer</em>.  To create the link type the following commands:</p>
<p># cd /usr/sbin<br />
# ln -s /sdk/flex-4.1/runtimes/player/10.1/lnx/flashplayerdebugger gflashplayer</p>
<p>Now, in order for the Flash Player debugger to "trust" our unit test SWF(s), we have to create the "would-be" folder that the normal Flash Player security settings would be stored in. Create the following folder tree:</p>
<p><em>/home/tomcat/.macromedia/Flash_Player/#Security/FlashPlayerTrust</em></p>
<p><strong>Configure VNC<br />
<span style="font-weight: normal;">Now, the last thing to do is to configure the VNC server for the tomcat user and ensure that its using GNOME as its window manager. Lets first configure the vnc server for the tomcat user. Make sure you're the root user and open the vnc server config file by typing the following:</span></strong></p>
<p><em># vi /etc/sysconfig/vncservers </em></p>
<p>Now you'll need to add a server for the tomcat user. Do this by performing the following steps:</p>
<ol>
<li>Move the cursor below all the comments.</li>
<li>Press the letter <em>i </em>on your keyboard to enter insert mode.</li>
<li>Enter the following text:<em>VNCSERVERS="1:tomcat"<br />
VNCSERVERARGS[1]="-geometry 1024x769 -depth 16"<br />
</em></li>
<li>Press <em>escape </em> to exit insert mode.</li>
<li>Type the following to save and quit the text editor<br />
<em>:wq&lt;enter&gt;</em></li>
</ol>
<p><em><span style="font-style: normal;">Now that this is done, you'll need to set the tomcat user's vnc password. Type the following:</span></em></p>
<p><em># su tomcat<br />
# vncpasswd</em></p>
<p><em><span style="font-style: normal;">Set the password to whatever you like. Just remember this if you ever want to connect through a VNC viewer! The next thing to do is configure the tomcat user to use GNOME instead of the default window manager. To do this open the tomcat user's vnc configuration file by typing the following:</span></em></p>
<p><em># vi /home/tomcat/.vnc/xstartup</em></p>
<p>By now you should know how to edit a text file, so make it look like the following:</p>
<p><em>#!/bin/sh<br />
# Uncomment the following two lines for normal desktop:<br />
unset SESSION_MANAGER<br />
exec /etc/X11/xinit/xinitrc<br />
[ -x /etc/vnc/xstartup ] &amp;&amp; exec /etc/vnc/xstartup<br />
[ -r $HOME/.Xresources ] &amp;&amp; xrdb $HOME/.Xresources<br />
#xsetroot -solid grey<br />
#vncconfig -iconic &amp;<br />
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &amp;<br />
#twm<br />
&amp;startx &amp;</em></p>
<p><em><span style="font-style: normal;">Save and quit the text editor. Lastly, start the vnc server by typing the following command:</span></em></p>
<p><em># service vncserver start</em></p>
<p>Now guess what? You're done installing and configuring everything! Woohoo!</p>
<p><strong>Wrap Up</strong></p>
<p>After all that work you should now have your CI server up and running. The only thing left to do is add the project to Hudson so that it can start building it. I'll explain how to do this in <a title="Using Hudson" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/">the following section</a>. For now, go grab yourself a well deserved beverage or snack.</p>
<p><em>Series Index</em></p>
<ol>
<li><a title="What is CI?" href="http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/">What is CI?</a></li>
<li><a title="Project Structure" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/">Project Structure</a></li>
<li><a title="Automation" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/">Automation</a></li>
<li><a title="Integration Server Setup" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/">Integration Server Setup</a></li>
<li><a title="Using Hudson" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/">Using Hudson</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Practicing Continuous Integration on Flash Projects : Automation</title>
		<link>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/</link>
		<comments>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 13:51:15 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.nobien.net/?p=278</guid>
		<description><![CDATA[In the previous part one of my series of "Practicing Continuous Integration on Flash Projects" I explained how to set up a Flash project for CI. In this part of the series I'm going to explain how automation is achieved using Apache Ant and the Flex SDK. Introduction One of the  most import parts of [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a title="Project Structure" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/">previous part</a> one of my series of "Practicing Continuous Integration on Flash Projects" I explained how to set up a Flash project for CI. In this part of the series I'm going to explain how automation is achieved using Apache Ant and the Flex SDK.</p>
<h2>Introduction</h2>
<p>One of the  most import parts of CI is the need to automate the build process. Building a Flash project means, at the very least, compiling your code into a SWF file. There are various ways to compile a SWF, but in order to be able to automate the process its best to use the mxmlc compiler thats part of the Flex SDK. If you are using the Flash IDE to compile your projects I would say that CI is not for you and/or your organization. However, thats not to say you should stop reading or stop using the IDE. I still use the IDE on nearly all my projects, just differently than I used to. Anything that requires timeline animation or is just easier to draw using the IDE I publish into a SWF. I then import the symbols from that SWF into my project when I compile with mxmlc. Explaining how to do this and just exactly how to use the mxmlc compiler is outside the scope of this blog series but you can learn more about using it on the <a title="Using the Flex 4 SDK" href="http://help.adobe.com/en_US/flex/using/index.html">Flex 4 product support page</a>.</p>
<p><span id="more-278"></span></p>
<h2>Apache Ant</h2>
<p>Performing the automation can be achieved in various ways. For instance, depending on your operating system you could write a batch file or shell script that contains everything you'd need to run to compile the SWF. While this method works, it also requires you to consider each operating system that the project might be built on. Knowledge of each OS would be necessary to write equivalent routines for compiling, deployment, and such. In order to get around this developers created automation software such as Ant and Maven. Ant is my tool of choice and is what I will use to illustrate how to automate the build process of a Flash project. Ant is great because its quite easy to use, has a lot of native functionality, and can be extended with third party tools. Ant reads a simple XML file that identifies commands you wish to run. For instance, if you need to copy a file, you would use the &lt;copy&gt; task and Ant would copy whatever files you wished to wherever you specified. This eliminates the need to know the native command for copying files.</p>
<h2>Compiling With Ant</h2>
<p>Using Ant is quite simple. Real quick, if you haven't used Ant before, you simply navigate to the folder containing your build.xml file from a command prompt and run the <em>ant </em>command. Ant will run the default target specified in the <em>default</em> attribute of the &lt;project&gt; node of your build file. If you want to run a different target, you simply follow the ant call with the name of the target you wish to run. More information about using Ant can be found on the <a title="Apache Ant Website" href="http://ant.apache.org">Apache Ant website</a>. Compiling a SWF with mxmlc can be achieved in three different ways using Ant. The first, and probably the most obvious, is by using Ant's &lt;exec&gt; task. The &lt;exec&gt; task allows you to run an executable and specify arguments and parameters. It would look something like this:</p>
<p><script src="http://gist.github.com/464674.js"></script> The second method would be to use the Flex Ant tasks provided with the Flex SDK. To use them you'll have to copy them into your Ant installation or package them with your project. I recommend you always package it with your project. This will eliminate an extra step for any new developer that comes on to the project. The tasks file is located in the FLEX_HOME/ant/lib folder.By including the Flex Ant tasks you'll be given about to use a new task named &lt;mxmlc&gt;. Using the Flex Ant tasks would look something like this:    <script src="http://gist.github.com/464694.js"></script></p>
<p>The third method, my preferred method, would be to use the &lt;java&gt; task to invoke the mxmlc.jar file. This method would look something like the following:</p>
<p><script src="http://gist.github.com/464799.js"></script> There are pros and cons to each method, but most importantly, using the &lt;mxmlc&gt; or the &lt;java&gt; Ant tasks will make it easier to compile your SWFs across platforms so long as the JDK is installed.</p>
<h2>The Project Build File</h2>
<p>Lets take a look at the various targets in the CIExample project's build file. Open this <a title="build.xml on github" href="http://code.google.com/p/ci-example/source/browse/trunk/build.xml">link</a> in a new tab or window.  Before any of the targets you will see the the following code:<br />
 <script src="http://gist.github.com/464846.js"></script></p>
<p>In the previous code, four things are happening. The first is that a properties file is specified. View the properties file <a title="properties file on github" href="http://code.google.com/p/ci-example/source/browse/trunk/build.properties">here</a>. The properties file defines various properties that are going to be useful throughout the build file. All properties in an Ant build file are referenced by wrapping the property name like so: <em>${propertyname}</em>. After the properties file is loaded, any environment variables are inserted as Ant propreties and prefixed with "env".  After this, two additional Ant task definitions are loaded: ant-contrib.jar and flexUnitTasks.jar. Ant-Contrib is an additional set of tasks that are extremely useful when writing your buidl files. More information about Ant-Contrib can be read <a title="Ant-Contribu Website" href="http://ant-contrib.sourceforge.net/">here</a>. The FlexUnit tasks will allow us to automate the analyzation of the unit test results. Now lets take a look at the first target in the build file:</p>
<p><script src="http://gist.github.com/464853.js"></script> The init target may look a bit strange, but it performs a crucial routine that I prefer to run over setting a property in the build.properties file. I've found it common practice throughout the industry to set the FLEX_HOME property in the build.properties file. I'm not a fan of this because I like to keep the build.properties file under version control. With multiple developers on a project, managing this file would get tricky as most developers have a unique development environment. Personally, I prefer to allow the configuration of the FLEX_HOME either through an environment variable or by passing the property value as a parameter when running the build. So set an environment variable named FLEX_HOME or pass the property value in the command line. It would look something like this:  <em>ant -DFLEX_HOME='/sdk/flex/4.1' desired-target-name </em> Now lets take a look at the next two targets:  <script src="http://gist.github.com/464860.js"></script></p>
<p>These two targets, <em>clean-bin</em> and <em>clean-test</em> are relatively simple. They both delete folders that contain generated files. Specifically, the bin folder is where the project's SWF is compiled to, whereas the bin-test folder is where the unit tests SWF and resulting report is compiled to. Now lets take a look at the next two targets:</p>
<p><script src="http://gist.github.com/464872.js"></script> The <em>compile-swf</em> target, well, it compiles the project into a SWF. This is the target that will be run if all the unit tests pass. The <em>compile-test</em> target simply compiles the unit tests into a SWF. Both of these targets depend on the <em>init</em> target and their respective clean targets. Following these targets is the <em>run-flexunit</em> target:  <script src="http://gist.github.com/464875.js"></script></p>
<p>In the run-flexunit target the FlexUnit task is used to analyze the unit test SWF. It requires that you have the stand-alone debugger version of the Flash Player so that it can open it and listen to the SWF's trace output. This is what allows the task to determine if the unit tests passed or failed. After it analyzes the SWF it output's an XML file into the directory specified in the <em>toDir</em> attribute. Additionally, it sets a property of your liking equal to a value of true that specifies if the tests failed or not. In this case its a property named <em>flexunit.failed</em>. This property will be useful later on. The following target makes use of the <em>flexunit.failed</em> property generated by the FlexUnit ant task:</p>
<p><script src="http://gist.github.com/464879.js"></script> The <em>run-test</em> target is quite simple. It depends on the <em>run-flexunit</em> target which in turn depends on the <em>compile-test</em> target. After the tests are compiled and analyzed, a simple condition is checked on the <em>flexunit.failed</em> property. If its true, the Ant &lt;fail&gt; task is called to stop the build process. If its not true, simply echo out a message that says that all the unit tests passed. Following the <em>run-test</em> target is the r<em>un-debug</em> target:  <script src="http://gist.github.com/464892.js"></script></p>
<p>The <em>run-debug </em>target will probably be the most used target by developers on their local machine. It depends on the <em>compile-swf</em> target and then launches the compile output in a browser to check out the results. This target simply opens the SWF itself, but if you wanted to you could create another target that generates an HTML container and launches the HTML file instead of the SWF. You'll also notice this target checks the local OS to ensure the proper method of opening the browser. And finally, the last three targets:</p>
<p><script src="http://gist.github.com/464896.js"></script></p>
<p>The <em>build</em> target depends on the <em>run-test</em> and <em>compile-swf</em> targets. This will run the tests and, so long as they pass, then compile the project SWF. If the tests fail, the build will fail and the project SWF will not be compiled. The <em>deploy-testing</em> and <em>deploy-production</em> targets don't do anything as they would be very specific to your own needs, but they do depend on the build target to ensure the project is built properly before deploying anywhere.</p>
<h2>Wrap Up</h2>
<p>Using Ant is a great way to automate your build process as it can be used on a variety of platforms. Hopefully you now have a sense of how to use Ant to automate the build process. Feel free to use the CIExample project as a template for your own projects that you wish to automate.</p>
<p>In the <a title="Integration Server Setup" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/">next part of this series</a>, I'll explain how to set up a CI server using Amazon's EC2 service.</p>
<p>Series Index</p>
<ol>
<li><a title="What is CI?" href="http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/">What is CI?</a></li>
<li><a title="Project Structure" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/">Project Structure</a></li>
<li><a title="Automation" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/">Automation</a></li>
<li><a title="Integration Server Setup" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/">Integration Server Setup</a></li>
<li><a title="Using Hudson" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/">Using Hudson</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Practicing Continuous Integration on Flash Projects : Project Structure</title>
		<link>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/</link>
		<comments>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 13:48:09 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.nobien.net/?p=282</guid>
		<description><![CDATA[In the previous part of my series "Practicing Continuous Integration on Flash Projects" I described what CI is and its best practices. In this next part I will explain how to set up a project to make the CI process run smoothly. Introduction Practicing CI relies heavily on a consistent process. Having a well defined [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a title="What is CI?" href="http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/">previous part</a> of my series "Practicing Continuous Integration on Flash Projects" I described what CI is and its best practices. In this next part I will explain how to set up a project to make the CI process run smoothly.</p>
<h2>Introduction</h2>
<p>Practicing CI relies heavily on a consistent process. Having a well defined project structure will definitely be an important piece to the puzzle as well. Flash projects are unique in how they are structured and any seasoned developer has their preferred way of doing things. Regardless of if you are a seasoned developer or new to all of this, this part of my series is meant to serve as a simple guideline to developers who are new to the practice of CI. I truly believe that having a simple and consistent project structure is extremely important to being able to make a project portable and easily built on various platforms. That being said, I've created a very simple project called <a title="CIExample on github" href="http://code.google.com/p/ci-example/">CIExample</a>. Its under version control at <a href="http://code.google.com/p/ci-example/">google code</a>. This is the project that I will be referencing throughout the rest of this series.</p>
<p><span id="more-282"></span></p>
<h2>Folder Structure</h2>
<p>Open the <a title="CIExample on github" href="http://code.google.com/p/ci-example/">CIExample</a> project website . First, lets take a look at the folder structure. There are five folders in the project.</p>
<p><strong>lib<br />
<span style="font-weight: normal;">The <em>lib</em> folder is where any of the SWC files that the project needs should be placed. Many third party code libraries are distributed as SWC files now and I highly recommend using them. The CIExample project currently doesn't include any SWC files, but its always nice to have a place to put them should you need to use one.</span></strong></p>
<p><strong>lib-test<br />
<span style="font-weight: normal;">The <em>lib-test</em> folder is where any of the SWC files that the unit tests need should be placed. The CIExample project uses <a title="FlexUnit website" href="http://flexunit.org/">FlexUnit</a> for unit testing. All the necessary FlexUnit SWC files are placed here. Its nice to have a place to keep files that are specific to test compiling  away from your project files. Unit testing is a whole other topic, and unfortunately is not within the scope of this series. I highly recommend FlexUnit. Their <a title="FlexUnit website" href="http://www.flexunit.org">website</a> has plenty of information to get you started writing unit tests for your project.</span></strong></p>
<p><strong><span style="font-weight: normal;"><strong>resources</strong><br />
The <em>resources</em> folder is where you can place any additional files that are needed for the build process. The CIExample project uses this folder to hold two .jar files. Thes files contain additional Ant tasks that are needed for the build process. You'll learn more about these files in the Automation part of this series. In many of my projects this folder contains files and templates for generating code and HTML containers.</span></strong></p>
<p><strong><span style="font-weight: normal;"><strong>src</strong><br />
The <em>src </em>folder contains all the source code for the project. The CIExample project contains but one class file which will be the project's compile target.</span></strong></p>
<p><strong><span style="font-weight: normal;"><strong>src-test</strong><br />
The <em>src-test</em> folder contains all the source code for the project's unit tests. The CIExample project includes a basic test runner and one test suite. The test suite includes one dummy test case.</span></strong></p>
<h2>Build Files</h2>
<p><strong><span style="font-weight: normal;">At the root of the project you'll notice a few files.</span></strong></p>
<p><strong>README<br />
<span style="font-weight: normal;">The <em>README </em>file is a very underrated project file. This file should include basic instructions on how to build the project. Any new developers should be able to look at this file, follow its instructions, and get the project running on their local development environment so that they may begin to contribute.</span></strong></p>
<p><strong><span style="font-weight: normal;"><strong>build.xml</strong><br />
The <em>build.xml</em> file is the core automation file used by Apache Ant. This file will be explained in full in the Automation part of this series.</span></strong></p>
<p><strong><span style="font-weight: normal;"><strong>build.properties</strong><br />
The <em>build.properties </em>file contains property names and values that are used in the build.xml file. Apache Ant reads this file before any automation is performed. </span></strong></p>
<h2><strong>Wrap Up</strong></h2>
<p><strong><span style="font-weight: normal;">This part of the series is rather short but its meant to briefly outline a basic project structure that will make practicing CI relatively easy. Basically, there are three main areas for files: Project files (src and lib), test files (src-test and lib-test) and build files (resources). Keeping this structure will allow you to easily locate files that relate either to the project, tests or the build. Every project should also include automation file(s). The CIExample project uses Apache Ant, thus the build.xml and build.properties files are located at the root of the project. And finally, always remember to include a README file that includes instructions on how to build the project. In the <a title="Automation" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/">next part of this series</a> I'll explain how to automate the build process.</span></strong></p>
<p><strong><span style="font-weight: normal;"><br />
</span></strong></p>
<p><em>Series Index</em></p>
<ol>
<li><a title="What is CI?" href="http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/">What is CI?</a></li>
<li><a title="Project Structure" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/">Project Structure</a></li>
<li><a title="Automation" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/">Automation</a></li>
<li><a title="Integration Server Setup" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/">Integration Server Setup</a></li>
<li><a title="Using Hudson" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/">Using Hudson</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Practicing Continuous Integration on Flash Projects : What Is CI?</title>
		<link>http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/</link>
		<comments>http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 14:00:17 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.nobien.net/?p=258</guid>
		<description><![CDATA[Welcome to my blog series, "Continuous Integration and Flash". This series is a case study of all the things I learned about practicing Continuous Integration. As a reader of this series, you are most likely interested in Continuous Integration in some way or another. After reading at least this first entry I hope to give [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to my blog series, "Continuous Integration and Flash". This series is a case study of all the things I learned about practicing Continuous Integration. As a reader of this series, you are most likely interested in Continuous Integration in some way or another. After reading at least this first entry I hope to give you a better understanding of what Continuous Integration is and how its practiced. In this series I will also explain how to set up a project, automate the build process, and set up a CI server using Amazon EC2. For the remainder of this series I will mostly use the acronym <strong>CI</strong> when referring to the term Continuous Integration.</p>
<p><span id="more-258"></span></p>
<h2>Introduction</h2>
<p>So just what the heck is CI? What I've come to understand is that CI is a software development practice that is most commonly associated with<a title="Agile Software Development" href="http://en.wikipedia.org/wiki/Agile_software_development"> agile software development</a>. In practice it involves the "continuous integration" of code  and tests from the various developers of a project at a desired frequency. Integration of new code always occurs in the project's main line (trunk or master branch) of development. Once the new code is committed an automated process is invoked to run various tests and build the project (if the tests don't fail). Additionally, the automation process can, and should, include a method of deploying the project to various contexts such as a testing or production server.</p>
<p>My understanding of what CI is didn't come to me so easily. When I first heard the term it was in the form of "Continuous Integration Server" and its my guess that one of the most common misunderstandings that developers have with regards to CI is that it is centered around a piece of software. A CI server is just a tool that helps you practice CI. There are a lot of different CI servers out there that will help you manage the process of automating your build process. Out of all my research the two most common ones seem to be <a title="CruiseControl" href="http://cruisecontrol.sourceforge.net/">CruiseControl</a> and <a title="Hudson CI" href="http://www.hudson-ci.org/">Hudson</a>. In part three of this series I'll explain  how to use Hudson on a remote Linux box to manage your build process.</p>
<h2>Best Practices</h2>
<p>With any methodology, there are good and bad ways to go about practicing them. When practicing CI you should try to adhere to the following:</p>
<p><strong>Use a version control system such as Subversion, Git, or CVS.<br />
</strong>Using a version control system such as <a title="Subversion" href="http://subversion.tigris.org/">Subversion</a>, <a title="Git" href="http://git-scm.com/">Git</a>, or <a title="CVS" href="http://www.nongnu.org/cvs/">CVS</a> will allow the developers on the project to easily commit their work to a single place of storage. Additionally, version control systems provide mechanisms for resolving conflicts between files edited by more than one person at a time. This type of functionality can make integration of new or changed code much easier. In part three of this series I'll explain how to configure Hudson to pull files from a Git repository.</p>
<p><strong>Automate the build process<br />
</strong>Building a project usually consists of running various sets of commands, moving files, generating files, etc. Lucky for us, there are plenty of tools out there to help automate these steps. Tools like <a title="Apache Ant" href="http://ant.apache.org/">Ant</a> and <a title="Apache Maven" href="http://maven.apache.org/">Maven</a> gives developers the ability to create simple commands to perform all the steps needed to build the project. Minimizing human error during the build process is essential and a good practice for any development methodology you practice.</p>
<p><strong>Make the build self testing</strong><br />
There's more than one way to skin(test) a cat (your code). Regardless of how you test your code, it should be part of your automated build process. Test Driven Development is a popular technique to test code before a project can successfully be built. In part two you'll see how a tool like FlexUnit fits into the CI process.</p>
<p><strong>Everyone commits to the mainline at a desired frequency</strong><br />
<span style="font-weight: normal; font-size: 13px;">The desired frequency is up to you. Its generally considered that the more often you commit the better. Checking your code in often allows developers to recognize bugs earlier and thus resolve them earlier. Imagine if you didn't commit you're code for a whole week. Unless the other developers on the project are exact clones of you, there's probably going to be more conflicts than if you were to commit every day. However, thats not to say you have to do this. Another approach in agile development is to perform a "sprint". During a sprint developers write code for a desired about of time, this can last anywhere from a few days to a few weeks. At some point the developers stop working on their code and begin to merge their work together into the mainline. This can last anywhere from a day or more. Regardless of your approach, both rely heavily on good communication between the development team to ensure everyone is on the right path.</span></p>
<p><strong>Run the build each time you commit new code</strong><br />
<span style="font-weight: normal; font-size: 13px;">Whenever you commit new code you should build the project to verify the new code has integrated properly. Developers themselves should also be building the project on their local machine to ensure their code works with whatever is in the project's mainline. This is where tools like Hudson and CruiseControl come in. These server's can begin the automated build process whenever code is committed into the mainline.</span></p>
<p><strong>Keep the build fast</strong><br />
<span style="font-weight: normal; font-size: 13px;">A project's build process should be optimized to run as fast as possible. This will enable developers to quickly identify problems with integration. If its not fast then you're not going to benefit from this methodology. Most Flash projects don't take too long to build, but the more complicated your project gets the longer it may take to build. If you feel as if you're project is taking too long to build consider breaking it up into various smaller projects with a master project that pulls everything together.</span></p>
<p><strong>Test in a clone of the production environment whenever possible</strong><br />
<span style="font-weight: normal; font-size: 13px;">Naturally you'll want to ensure your project is ready to be deployed to production. This can only really be done if you have an environment that's identical to your production environment. While not always possible this will hopefully reduce any failures when deploying to production.</span></p>
<p><strong>Make it easy to get the latest build files</strong><br />
<span style="font-weight: normal; font-size: 13px;">There should always be an easy way for anyone involved in the project to retrieve the latest build files. In the case of a Flash project this could be a multitude of things, but at the very least this means a SWF file. For instance, as part of the build process, perhaps there's a protected website somewhere in which someone can download an ZIP archive of the SWF file, its HTML container and image assets.</span></p>
<p><strong>Everyone can see whats happening</strong><br />
<span style="font-weight: normal; font-size: 13px;">This is where tools like CruiseControl and Hudson come in again. They each have fancy schmancyweb consoles that show if there's a build in progress and what the result of the last build was. Otherwise, if you're manually invoking the build process, you should  have some way of indicating to the team the status of the build. I recommend getting your hands on a traffic light and hooking it up to your automation machine.</span></p>
<p><strong>Automate Deployment</strong><br />
<span style="font-weight: normal; font-size: 13px;">When a build successfully completes you'll most likely want to deploy it somewhere at some point. This process should also be automated. CI servers usually give you the ability to run a script or another process after the build completes to make deploying, say to your production server, less prone to human error.</span></p>
<p>If you'd like, you can read other descriptions of these practices elsewhere such as <a title="Continuous Integration on Wikipedia" href="http://en.wikipedia.org/wiki/Continuous_integration">Wikipedia</a> or <a title="Continuous Integration paper by Martin Fowler" href="http://martinfowler.com/articles/continuousIntegration.html">this paper</a> written by Martin Fowler.</p>
<h2>Advantages &amp; Disadvantages</h2>
<p>So you might be thinking to yourself, "This all sounds a bit crazy to me!" Or maybe you're thinking "This all sounds awesome, but what doesn't it provide?" Well then here is a list of various advantages and disadvantages.</p>
<p><strong>Advantages</strong></p>
<ol>
<li>Reduced risk</li>
<li>Provides a way of knowing what works and what doesn't at all times</li>
<li>Early warnings of incompatible code</li>
<li>Early warnings of conflicting changes</li>
<li>Easier to find bugs and eliminate them</li>
<li>Immediate testing of code</li>
<li>Constant availability of a build</li>
<li>Projects tend to have  less bug</li>
<li>Motivates developers to produce code that works</li>
</ol>
<p><strong>Disadvantages</strong></p>
<ol>
<li>Initial setup time can be long</li>
<li>Good results rely heavily on well written test suites</li>
<li>Difficult to introduce large scale refactoring</li>
<li>Infrastructure requirements can induce cost</li>
</ol>
<h2>Wrap Up</h2>
<p>So that just about covers what CI is. I won't go over everything but just remember that CI is a methodology, a mind set, an attitude. Its not a piece of software or server environment. Its all up to you to decide if its practice benefits you and/or your organization. In the <a title="Project Structure" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/">next part of this series</a> I'm going to describe how to structure a Flash project to make practicing CI relatively easy.</p>
<p><em>Series Index</em></p>
<ol>
<li><a title="What is CI?" href="http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/">What is CI?</a></li>
<li><a title="Project Structure" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-project-structure/">Project Structure</a></li>
<li><a title="Automation" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-automation/">Automation</a></li>
<li><a title="Integration Server Setup" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-integration-server-setup/">Integration Server Setup</a></li>
<li><a title="Using Hudson" href="http://blog.nobien.net/2010/07/19/practicing-continuous-integration-on-flash-projects-using-hudson/">Using Hudson</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobien.net/2010/07/18/practicing-continuous-integration-on-flash-projects-what-is-ci/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Proof-Of-Concept: A Simple UI for Running Ant Targets Built with Adobe AIR 2.0</title>
		<link>http://blog.nobien.net/2010/06/16/proof-of-concept-a-simple-ui-for-running-ant-targets-built-with-adobe-air-2-0/</link>
		<comments>http://blog.nobien.net/2010/06/16/proof-of-concept-a-simple-ui-for-running-ant-targets-built-with-adobe-air-2-0/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 23:53:21 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.nobien.net/?p=236</guid>
		<description><![CDATA[I've really been getting into Apache Ant lately. I really enjoy using it to manage various build processes when working on Flash projects. So when I found out that AIR 2.0 can invoke a native process I immediately thought that it'd be cool to learn how to use that capability to make an app that presents [...]]]></description>
			<content:encoded><![CDATA[<p>I've really been getting into <a href="http://ant.apache.org/">Apache Ant</a> lately. I really enjoy using it to manage various build processes when working on Flash projects. So when I found out that AIR 2.0 can invoke a native process I immediately thought that it'd be cool to learn how to use that capability to make an app that presents a UI for a given Ant build file and then be able to run its various targets from that UI. Thus I created a simple application that I'm calling, for the time being, rANT.</p>
<p>It took me a while to figure things out entirely but in the end I'm happy to have learned how to use <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeProcess.html">flash.desktop.NativeProcess</a>. Unfortunately, in order to realize my idea faster, I ignored the fact that the application would really depend on a user's system. For instance, I have Ant installed in such a way that its available as a system command so I can run it from the command line like any old DOS command. I know not everyone is setup like this andwould require knowing where Ant is installed on a user's system. Additionally, Ant doesn't come with a good old fashioned .exe file for Windows so I invoked Ant via C:\windows\system32\cmd.exe. Here's some pseudo code that comes straight from my application...</p>
<p><script src="http://gist.github.com/441446.js?file=PseudoAntProcess.as"></script></p>
<p>Another (little) thing was that Adobe isn't very clear about the fact that you need to package your application in a native installer in order to use the 'extendedDesktop' profile.  Took me a while to figure it out, but the good news its pretty darn easy to package a native installer from a .air file.</p>
<p>At any rate, its by no means ready for the public, but I wanted to share my work thus far to see if anyone else would be interested in an application such as this. So here's how it looks and works so far:</p>
<p>When you start the application you're presented with a screen that allows you to load a build file...</p>
<p><a href="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-01.jpg"><img class="aligncenter size-medium wp-image-237" title="rANT-Screenshot-01" src="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-01-300x231.jpg" alt="" width="300" height="231" /></a></p>
<p>Once the file is loaded it displays information about the build file and a list of its available targets...</p>
<p><a href="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-02.jpg"><img class="aligncenter size-medium wp-image-238" title="rANT-Screenshot-02" src="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-02-300x231.jpg" alt="" width="300" height="231" /></a></p>
<p>You can then select a task and run it. Here you can see the output in the TextArea component from when I ran the <em>compile-docs</em> target...</p>
<p><a href="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-03.jpg"><img class="aligncenter size-medium wp-image-239" title="rANT-Screenshot-03" src="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-03-300x231.jpg" alt="" width="300" height="231" /></a></p>
<p>Some of my targets require arguments to be passed in for them to work. For instance, my <em>compile-and-debug</em> target requires a debugLevels parameter that specifies the various debug levels (info, status, etc.) to output to the debugging console (which happens to be <a href="http://demonsterdebugger.com/">de MonsterDebugger</a>). So I created a little panel that lets me specify parameters for the target...</p>
<p><a href="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-04.jpg"><img class="aligncenter size-medium wp-image-240" title="rANT-Screenshot-04" src="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-04-300x231.jpg" alt="" width="300" height="231" /></a></p>
<p>Lastly, here you can see the output from the compile-and-debug target after running it with the passed in parameters...</p>
<p><a href="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-05.jpg"><img class="aligncenter size-medium wp-image-241" title="rANT-Screenshot-05" src="http://www.nobien.net/blog/wp-content/uploads/2010/06/rANT-Screenshot-05-300x231.jpg" alt="" width="300" height="231" /></a></p>
<p>So thats it! And if anyone thinks this would be useful to them leave some comments and/or ideas.</p>
<p>P.S. I built it with <a href="http://www.robotlegs.org/">robotlegs</a> <img src='http://www.nobien.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobien.net/2010/06/16/proof-of-concept-a-simple-ui-for-running-ant-targets-built-with-adobe-air-2-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
