<?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>Carbon Five Community &#187; Deployment</title>
	<atom:link href="http://blog.carbonfive.com/category/deployment/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.carbonfive.com</link>
	<description></description>
	<lastBuildDate>Fri, 27 Aug 2010 00:24:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Screw.Unit JS Testing in Maven: javascript-test-maven-plugin</title>
		<link>http://blog.carbonfive.com/2010/02/testing/screw-unit-js-testing-in-maven-javascript-test-maven-plugin</link>
		<comments>http://blog.carbonfive.com/2010/02/testing/screw-unit-js-testing-in-maven-javascript-test-maven-plugin#comments</comments>
		<pubDate>Thu, 25 Feb 2010 03:29:31 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript / AJAX]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://blog.carbonfive.com/?p=878</guid>
		<description><![CDATA[I&#8217;ve written a maven plugin to integrate Screw.Unit javascript tests into a maven build. The project is inspired by the Blue Ridge testing framework for Rails, but it&#8217;s a bit more light-weight by design. To use the plugin you should start by downloading Screw.Unit and implement your tests according to their instructions. Once you have [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a <a href="http://code.google.com/p/javascript-test-maven-plugin/">maven plugin</a> to integrate <a href="http://github.com/nkallen/screw-unit">Screw.Unit</a> javascript tests into a maven build.  The project is inspired by the <a href="http://blog.thinkrelevance.com/2009/5/12/blue-ridge-1-0-javascript-unit-testing-for-rails-scandalous">Blue Ridge</a> testing framework for Rails, but it&#8217;s a bit more light-weight by design.<br />
<span id="more-878"></span><br />
To use the plugin you should start by downloading Screw.Unit and implement your tests according to their instructions.  Once you have some tests implemented in html files, add the plugin to your maven pom file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javascript-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.carbonfive.javascript-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javascript-test-maven-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-beta1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>src/test/javascript/suite*.html<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>You will probably also need to add Carbon Five&#8217;s public repository so that maven will know where to grab the plugin:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pluginRepositories<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pluginRepository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>c5-public-repository<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Carbon Five Public Repository<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://mvn.carbonfive.com/public<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pluginRepository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pluginRepositories<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The &lt;configuration&gt; section contains <a href="http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html">standard</a> maven &lt;include&gt; and &lt;exclude&gt; tags to allow you to specify any Screw.Unit test suite html files you would like to include in your build.</p>
<p>Now when maven executes its test phase, it will include your javascript tests as well. Any test that fails will halt the build. When the test phase is complete the target directory will contain a &#8216;screw-unit&#8217; directory that contains the test reports. There will be two files for every file included in the test execution The first is an XML file named TEST-dir1.dir2.dir3.filename.html.xml that contains the test results for that file in a reasonable approximation of JUnit&#8217;s xml format. The other file will be named dir1.dir2.dir3.filename.html and will contain a sort of snapshot of the test suite&#8217;s html at the time the tests completed (the javascript will be removed and the css will be baked in).</p>
<p>Like Blue Ridge, the javascript-test-maven-plugin relies on the excellent <a href="http://ejohn.org/blog/bringing-the-browser-to-the-server/">env.js</a> project and the less-excellent <a href="http://www.mozilla.org/rhino/">Rhino</a> project to emulate a browser in Java.   Unfortunately this combination creates the possibility of discrepancies between the browser and build results, and the probability of relatively slow test execution.  To keep the simulation as realistic as possible, javascript-test-maven-plugin recreates the test environment for each Screw.Unit html file, so the more tests you can cram into a single file the faster your builds will run.</p>
<p>There are a few directions for future work.  I&#8217;d like for the plugin to handle other browser-based javascript testing frameworks.  Screw.Unit is popular, but seems suboptimal in many respects.  The only limiting factor here is the plugin&#8217;s ability to interpret the results.  If env.js could run in javascript interpreters other than Rhino, I&#8217;d like to give the the plugin the capability to fork out to <a href="http://www.mozilla.org/js/spidermonkey/">spidermonkey</a> for better compatibility and performance.  Modifying the plugin would be relatively easy, but env.js appears to have some significant dependencies on Java.</p>
<p>Check it out if you have a need for this kind of thing and let us know if you have any problems or suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2010/02/testing/screw-unit-js-testing-in-maven-javascript-test-maven-plugin/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Automatically deploying to Engine Yard Cloud</title>
		<link>http://blog.carbonfive.com/2010/01/ruby-on-rails/automatically-deploying-to-engine-yard-cloud</link>
		<comments>http://blog.carbonfive.com/2010/01/ruby-on-rails/automatically-deploying-to-engine-yard-cloud#comments</comments>
		<pubDate>Thu, 07 Jan 2010 19:04:14 +0000</pubDate>
		<dc:creator>jonah</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Ruby (on Rails)]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[Engine Yard Cloud]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://blog.carbonfive.com/?p=793</guid>
		<description><![CDATA[I&#8217;m working on a application which is deployed to Engine Yard&#8217;s Cloud infrastructure and I wanted to automatically redeploy the application whenever our tests passed on our continuous integration server. Engine Yard will eventually allow us to push a branch to our cloud environment from git (ie &#8220;git push engineyard master&#8221;) but until that is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a application which is deployed to Engine Yard&#8217;s Cloud infrastructure and I wanted to automatically redeploy the application whenever our tests passed on our continuous integration server.</p>
<p>Engine Yard will eventually allow us to push a branch to our cloud environment from git (ie &#8220;git push engineyard master&#8221;) but until that is available the best option seems to be to trigger a github post receive hook directly.</p>
<p>To that end I rewrote an existing script to trigger post receive hooks as a rake task; <a href="http://gist.github.com/271433">http://gist.github.com/271433</a><br />
<span id="more-793"></span></p>
<pre lang=ruby>
require 'rubygems'
require 'json'
begin
  require 'restclient'
rescue Exception
end

namespace :ey do

  # Based on http://gist.github.com/114954
  # Discussed at https://cloud-support.engineyard.com/discussions/questions/83-deploying-to-solo-instance-from-automated-build
  desc 'Trigger a GitHub Post Receive Hook to deploy the app'
  task :deploy do
    post_receive_hook 'preview'
  end

  desc 'Trigger a GitHub Post Receive Hook to deploy and migrate the app'
  task :deploy_and_migrate do
    post_receive_hook 'preview', true
  end

  def post_receive_hook(envname, migrate=false)
    token = `git config --get cloud.token`.chomp

    if token.empty?
      token = ENV['cloud.token']
      end

    if token.empty?
      puts <<-EOT
The cloud token is not set.
To store the token, use:
$ git config --add cloud.token SOMETOKEN
or set the cloud.token environment variable.
EOT
      exit 2
    end

    commit = `git rev-parse HEAD`.chomp
    payload = {
        "commits" => [{"id" => commit, "message"=>"[deploy #{envname}#{migrate ? ' migrate' : ''}]"}],
        "ref" => "refs/heads/master",
        }

    puts "Triggering a deploy for #{commit} on #{envname}"
    begin
      response = RestClient.post("https://cloud.engineyard.com/github/#{token}",
                                 :payload => payload.to_json)
      puts "Successfully triggered the deploy"
    rescue RestClient::RequestFailed => e
      puts "Could not deploy your changes"
      puts e.response.code
      puts e.response.body
      exit 1
    end
  end
end
</pre>
<p>In setting this up I discovered a couple of potential stumbling points:</p>
<ul>
<li>The environment must have been deployed via the EY dashboard before you will be able to trigger a deploy using the post receive hook API.</li>
<li>The branch specified in the API call (and therefore the git branch you should be working in if running that rake task) must match the branch deployed using the EY dashboard.</li>
<li>If you make an API call to deploy the &#8216;master&#8217; branch EY will attempt to deploy branch &#8216;HEAD&#8217;.</li>
<li>If the branch specified in the API call does not match the branch specified on the dashboard the API will report success but not redeploy the environment.</li>
</ul>
<p>The folks at Engine Yard are working to correct some of those issues and now I&#8217;ve got a project which automatically pushes changes to the cloud every time our tests cycle.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2010/01/ruby-on-rails/automatically-deploying-to-engine-yard-cloud/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
