<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>GearheadForHire, LLC</title>
  <subtitle>Internet and Application Software Design Services</subtitle>
  <link href="http://www.gearheadforhire.com/rss" rel="self" />
  <link href="http://www.gearheadforhire.com/" />
  <updated>2010-11-04T14:39:42-04:00</updated>
  <author>
    <name>Robert C. Wahler</name>
    <email>robert@gearheadforhire.com</email>
  </author>
  <id>http://www.gearheadforhire.com/</id>
    <entry>
    <title>Using Ruby to Automate Windows GUI Applications for Testing</title>
    <link href="/articles/ruby/win32-autogui/using-ruby-to-drive-windows-applications.html" />
    <id>tag:www.gearheadforhire.com,2010-11-04:1288895982</id>
    <updated>2010-11-04T14:39:42-04:00</updated>
    <content type="html">&lt;p&gt;Presenting &lt;a href=&quot;http://rubygems.org/gems/win32-autogui&quot;&gt;Win32-autogui&lt;/a&gt;.  A Ruby Win32
GUI testing framework packaged as a &lt;a href=&quot;http://rubygems.org/&quot;&gt;RubyGem&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;Win32-autogui provides a framework to enable GUI application testing with
&lt;a href=&quot;http://www.ruby-lang.org&quot;&gt;Ruby&lt;/a&gt;.  This facilitates integration testing of
Windows binaries using Ruby based tools like
&lt;a href=&quot;http://github.com/dchelimsky/rspec&quot;&gt;RSpec&lt;/a&gt; and
&lt;a href=&quot;http://github.com/aslakhellesoy/cucumber&quot;&gt;Cucumber&lt;/a&gt; regardless of the language
used to create the binaries.&lt;/p&gt;

&lt;p&gt;The source code repository is available here:
&lt;a href=&quot;http://github.com/robertwahler/win32-autogui&quot;&gt;http://github.com/robertwahler/win32-autogui&lt;/a&gt;.  The repository contains specs
and an example Win32 program with source and specs written in Delphi (Object
Pascal).&lt;/p&gt;

&lt;h3&gt;Driving the Window's Calculator Application with IRB&lt;/h3&gt;

&lt;p&gt;Here is a quick demo using the Ruby Interactive Shell (IRB) under
&lt;a href=&quot;http://www.cygwin.com/&quot;&gt;Cygwin&lt;/a&gt; on Windows XP to drive &quot;calc.exe.&quot;&lt;/p&gt;

&lt;h4&gt;Install the Gem&lt;/h4&gt;

&lt;p&gt;Win32-autogui is available on &lt;a href=&quot;http://rubygems.org/gems/win32-autogui&quot;&gt;RubyGems.org&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;gem install win32-autogui
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;IRB Session&lt;/h4&gt;

&lt;p&gt;Start up IRB&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;irb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Paste the following lines into your shell's IRB session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;Window's &quot;calc.exe&quot; is used as the target binary by Win32-autogui's
internal specs. The complete source to the wrapper is available here:
&lt;a href=&quot;https://github.com/robertwahler/win32-autogui/blob/master/spec/applications/calculator.rb&quot;&gt;spec/applications/calculator.rb&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;div class=&quot;UltraViolet&quot;&gt;
&lt;pre class=&quot;dawn&quot;&gt;    &lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; 'win32/autogui'
    &lt;span class=&quot;Keyword&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Autogui&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;Input&lt;/span&gt;

    &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;Calculator&lt;span class=&quot;Entity&quot;&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;&amp;lt;&lt;/span&gt; Autogui::Application&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;initialize&lt;/span&gt;
        &lt;span class=&quot;Keyword&quot;&gt;super&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;=&amp;gt;&lt;/span&gt; &amp;quot;calc&amp;quot;&lt;span class=&quot;PunctuationSeparator&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;title&lt;/span&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;=&amp;gt;&lt;/span&gt; &amp;quot;Calculator&amp;quot;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;edit_window&lt;/span&gt;
        main_window&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;find&lt;/span&gt; {&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt; w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;window_class&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; 'Edit'}
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Now we can start up the calculator&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;calc = Calculator.new
calc.running?
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Session screenshot&lt;/p&gt;

&lt;div class=&quot;photobar&quot;&gt;
    &lt;div style=&quot;width: 640px; &quot;class=&quot;photo&quot;&gt;&lt;a href=&quot;/articles/ruby/win32-autogui/screenshots/&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;/articles/ruby/win32-autogui/screenshots/images/medium/calculator_irb1.png&quot; title=&quot;Driving the calculator in IRB (1)&quot; alt=&quot;Driving the calculator in IRB (1)&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;caption&quot;&gt;Driving the calculator in &lt;span class=&quot;caps&quot;&gt;IRB&lt;/span&gt; (1)&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Get some information&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;calc.pid
calc.main_window.window_class
calc.main_window.children.count
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Perform a calculation&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;calc.set_focus; type_in('2+2=')
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Get the result&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;calc.edit_window.text
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Shut it down&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;calc.close
calc.running?
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Session screenshot&lt;/p&gt;

&lt;div class=&quot;photobar&quot;&gt;
  &lt;div style=&quot;width: 640px; &quot;class=&quot;photo&quot;&gt;&lt;a href=&quot;/articles/ruby/win32-autogui/screenshots/&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;/articles/ruby/win32-autogui/screenshots/images/medium/calculator_irb2.png&quot; title=&quot;Driving the calculator in IRB (2)&quot; alt=&quot;Driving the calculator in IRB (2)&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;caption&quot;&gt;Driving the calculator in &lt;span class=&quot;caps&quot;&gt;IRB&lt;/span&gt; (2)&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;RSpec + Win32-autogui for Testable GUI Specifications&lt;/h3&gt;

&lt;p&gt;The Win32-autogui repository contains an example Win32 program with
source, testable binary, and specs written in Delphi (Object Pascal) located here:
&lt;a href=&quot;http://github.com/robertwahler/win32-autogui/tree/master/examples/quicknote&quot;&gt;http://github.com/robertwahler/win32-autogui/tree/master/examples/quicknote&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Quicknote is a bare bones notepad clone.  Here is the spec file
&lt;a href=&quot;http://github.com/robertwahler/win32-autogui/blob/master/examples/quicknote/spec/quicknote/form_splash_spec.rb&quot;&gt;spec/form_splash_spec.rb&lt;/a&gt;
for the splash screen functionality.&lt;/p&gt;

&lt;div class=&quot;UltraViolet&quot;&gt;
&lt;pre class=&quot;dawn&quot;&gt;    &lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;expand_path&lt;/span&gt;(&lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;dirname&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;__FILE__&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; '/../spec_helper')

    &lt;span class=&quot;Keyword&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Autogui&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;Input&lt;/span&gt;

    describe &amp;quot;FormSplash&amp;quot; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;Entity&quot;&gt;after&lt;/span&gt;(&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;all&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
        &lt;span class=&quot;Keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;running?&lt;/span&gt;
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;splash&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;wait_for_close&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;splash&lt;/span&gt;
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;file_exit&lt;/span&gt; 
&lt;span class=&quot;Comment&quot;&gt;          &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; still running? force it to close&lt;/span&gt;
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;close&lt;/span&gt;(&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;wait_for_close&lt;/span&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;true&lt;/span&gt;)
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;should_not&lt;/span&gt; be_running
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

      describe &amp;quot;startup with no command line parameters&amp;quot; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
        &lt;span class=&quot;Entity&quot;&gt;before&lt;/span&gt;(&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;all&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;Comment&quot;&gt;          &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; --nosplash is the default, turn it back on&lt;/span&gt;
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Quicknote&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;parameters&lt;/span&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;=&amp;gt;&lt;/span&gt; ''
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;should&lt;/span&gt; be_running
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

        it &amp;quot;should show&amp;quot; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;splash&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;should_not&lt;/span&gt; be_nil
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
        it &amp;quot;should close within 5 seconds&amp;quot; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;splash&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;should_not&lt;/span&gt; be_nil
          seconds &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;5&lt;/span&gt;
          &lt;span class=&quot;Entity&quot;&gt;timeout&lt;/span&gt;(seconds) &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
            &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;splash&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;wait_for_close&lt;/span&gt;
          &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;splash&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;should&lt;/span&gt; be_nil
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

      describe &amp;quot;startup with '--nosplash' command line parameter&amp;quot; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
        it &amp;quot;should not show&amp;quot; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Quicknote&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;parameters&lt;/span&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;=&amp;gt;&lt;/span&gt; '--nosplash'
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;should&lt;/span&gt; be_running
          &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;application&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;splash&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;should&lt;/span&gt; be_nil
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The Quicknote.exe application wrapper.  Each of the testable application
windows must be defined in a subclass of Autogui::Application. Partial code
from &lt;a href=&quot;http://github.com/robertwahler/win32-autogui/blob/master/examples/quicknote/lib/quicknote.rb&quot;&gt;lib/quicknote.rb&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;UltraViolet&quot;&gt;
&lt;pre class=&quot;dawn&quot;&gt;    &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;Quicknote&lt;span class=&quot;Entity&quot;&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;&amp;lt;&lt;/span&gt; Autogui::Application&lt;/span&gt;&lt;/span&gt;

      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;initialize&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;options &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;}&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;Comment&quot;&gt;        &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; relative path to app using Windows style path&lt;/span&gt;
        &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt;&amp;quot;exe&lt;span class=&quot;StringConstant&quot;&gt;\\&lt;/span&gt;quicknote.exe&amp;quot;  
        defaults &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; {
                     &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;=&amp;gt;&lt;/span&gt; &amp;quot;QuickNote -&amp;quot;&lt;span class=&quot;PunctuationSeparator&quot;&gt;,&lt;/span&gt; 
                     &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;parameters&lt;/span&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;=&amp;gt;&lt;/span&gt; '--nosplash'&lt;span class=&quot;PunctuationSeparator&quot;&gt;,&lt;/span&gt; 
                     &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;main_window_timeout&lt;/span&gt; &lt;span class=&quot;PunctuationSeparator&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;20&lt;/span&gt;
                   }
        &lt;span class=&quot;Keyword&quot;&gt;super&lt;/span&gt; defaults&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;merge&lt;/span&gt;(options)
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;edit_window&lt;/span&gt;
        main_window&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;find&lt;/span&gt; {&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt; w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;window_class&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; 'TMemo'}
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;status_bar&lt;/span&gt;
        main_window&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;find&lt;/span&gt; {&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt; w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;window_class&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; 'TStatusBar'}
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;dialog_about&lt;/span&gt;
        &lt;span class=&quot;Support&quot;&gt;Autogui&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;EnumerateDesktopWindows&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt; 
          w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;match&lt;/span&gt;(&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;About QuickNote&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; pid)
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;splash&lt;/span&gt;
        &lt;span class=&quot;Support&quot;&gt;Autogui&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;EnumerateDesktopWindows&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt; 
          w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;match&lt;/span&gt;(&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;FormSplash&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; pid)
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;message_dialog_confirm&lt;/span&gt;
        &lt;span class=&quot;Support&quot;&gt;Autogui&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;EnumerateDesktopWindows&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt; 
          w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;match&lt;/span&gt;(&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;Confirm&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; pid)
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;Comment&quot;&gt;      &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Title and class are the same as dialog_overwrite_confirm&lt;/span&gt;
&lt;span class=&quot;Comment&quot;&gt;      &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Use child windows to differentiate&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;dialog_overwrite_confirm&lt;/span&gt;
        &lt;span class=&quot;Support&quot;&gt;Autogui&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;EnumerateDesktopWindows&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt; 
          w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;match&lt;/span&gt;(&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;^Text File Save$&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
            (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; pid) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
            (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;window_class&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; &amp;quot;#32770&amp;quot;) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
            (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;combined_text&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;match&lt;/span&gt;(&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;already exists&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;))
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;Comment&quot;&gt;      &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Title and class are the same as dialog_overwrite_confirm&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;file_save_as_dialog&lt;/span&gt;
        &lt;span class=&quot;Support&quot;&gt;Autogui&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;EnumerateDesktopWindows&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;|&lt;/span&gt; 
          w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;match&lt;/span&gt;(&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;Text File Save&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
            (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; pid) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
            (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;window_class&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; &amp;quot;#32770&amp;quot;) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
            (w&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;combined_text&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;match&lt;/span&gt;(&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;Save &lt;span class=&quot;StringRegexpConstantCharacterEscape&quot;&gt;\&amp;amp;&lt;/span&gt;in:&lt;/span&gt;&lt;span class=&quot;StringRegexp&quot;&gt;&lt;span class=&quot;StringRegexp&quot;&gt;/&lt;/span&gt;&lt;/span&gt;))
        &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

      &lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;PunctuationSeparator&quot;&gt;.&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;


&lt;h4&gt;Autotesting Quicknote with Watchr&lt;/h4&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/mynyml/watchr&quot;&gt;Watchr&lt;/a&gt; provides a flexible alternative to Autotest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; &lt;em&gt;The following assumes a global setting of 'git config core.autocrlf
input' and that you want to modify the Delphi 7 source to Quicknote which
requires CRLF line endings.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Grab the source for Quicknote&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd ~/workspace
git clone http://github.com/robertwahler/win32-autogui -n
cd win32-autogui
git config core.autocrlf true
git checkout
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Install watchr&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;gem install watchr
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Run watchr&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;watchr spec/watchr.rb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Watchr will now watch the files defined in 'spec/watchr.rb' and run RSpec or Cucumber, as appropriate.&lt;/p&gt;

&lt;p&gt;Session screenshot&lt;/p&gt;

&lt;div class=&quot;photobar&quot;&gt;
  &lt;div style=&quot;width: 640px; &quot;class=&quot;photo&quot;&gt;&lt;a href=&quot;/articles/ruby/win32-autogui/screenshots/&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;/articles/ruby/win32-autogui/screenshots/images/medium/quicknote_splash_rspec.png&quot; title=&quot;Watchr session running form_splash_spec.rb&quot; alt=&quot;Watchr session running form_splash_spec.rb&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;caption&quot;&gt;Watchr session running form_splash_spec.rb&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;For more information, please consult the source: &lt;a href=&quot;http://github.com/robertwahler/win32-autogui&quot;&gt;http://github.com/robertwahler/win32-autogui&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Using Git to Maintain Common RubyGem Functionality with BasicGem</title>
    <link href="/articles/ruby/using-git-to-maintain-common-ruby-gem-functionality.html" />
    <id>tag:www.gearheadforhire.com,2010-10-13:1286980329</id>
    <updated>2010-10-13T10:32:09-04:00</updated>
    <content type="html">&lt;p&gt;Do you maintain several different &lt;a href=&quot;http://rubygems.org/&quot;&gt;RubyGems&lt;/a&gt;?  Maybe you maintain dozens?  Wouldn't it be nice to not have to repeat yourself when making changes that should be common to all the gems in your stable?  For example, you decide that going forward, you will use &lt;a href=&quot;http://github.com/carlhuda/bundle&quot;&gt;Bundler&lt;/a&gt; for all your gem dependency needs.  You could tweak your gemspecs and Rakefiles for each of your gems individually or you could use your customized fork of &lt;a href=&quot;http://github.com/robertwahler/basic_gem&quot;&gt;BasicGem&lt;/a&gt; as a common ancestor for all your gems.  Now you can modify your &lt;a href=&quot;http://github.com/robertwahler/basic_gem&quot;&gt;BasicGem&lt;/a&gt; fork and merge these tweaks using &lt;a href=&quot;http://git-scm.com/&quot;&gt;Git&lt;/a&gt; into all your gems.  As simple as...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd ~/workspace/my_gem_cloned_from_my_basic_gem_fork
git pull my_basic_gem_fork HEAD
git mergetool
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Introducing BasicGem, Gem Maintenance with Git&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/robertwahler/basic_gem&quot;&gt;BasicGem&lt;/a&gt; is an opinionated RubyGem structure. BasicGem provides no stand-alone functionality.  Its purpose is to provide a repository for jump-starting a new RubyGem and to provide a repository for cloned applications to pull future enhancements and fixes.&lt;/p&gt;

&lt;h3&gt;Features/Dependencies&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Bundler for dependency management &lt;a href=&quot;http://github.com/carlhuda/bundler&quot;&gt;http://github.com/carlhuda/bundler&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Rspec for unit testing &lt;a href=&quot;http://github.com/dchelimsky/rspec&quot;&gt;http://github.com/dchelimsky/rspec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cucumber for functional testing &lt;a href=&quot;http://github.com/aslakhellesoy/cucumber&quot;&gt;http://github.com/aslakhellesoy/cucumber&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Aruba for CLI testing &lt;a href=&quot;http://github.com/aslakhellesoy/aruba&quot;&gt;http://github.com/aslakhellesoy/aruba&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;YARD for documentation generation &lt;a href=&quot;http://github.com/lsegal/yard&quot;&gt;http://github.com/lsegal/yard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Example Usage, Jump-starting a New Gem with BasicGem&lt;/h3&gt;

&lt;p&gt;The following steps illustrate creating a new gem called &quot;mutagem&quot; that handles file based mutexes.
See &lt;a href=&quot;http://github.com/robertwahler/mutagem&quot;&gt;http://github.com/robertwahler/mutagem&lt;/a&gt; for full source.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; &lt;em&gt;We are cloning from &lt;a href=&quot;http://github.com/robertwahler/basic_gem&quot;&gt;BasicGem&lt;/a&gt; directly.  Normally, you will want to clone from your own fork of BasicGem so that you can control and fine-tune which future BasicGem modifications you will support.&lt;/em&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd ~/workspace
git clone git://github.com/robertwahler/basic_gem.git mutagem
cd mutagem
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Setup the repository for the cloned project&lt;/h4&gt;

&lt;p&gt;We are going to change the origin URL to our own server and setup a remote
for pulling in future BasicGem changes. If our own repo for your new gem is setup at
git@red:mutagem.git, change the URL with sed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sed -i 's/url =.*\.git$/url = git@red:mutagem.git/' .git/config
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Push up the unchanged BasicGem repo&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git push origin master:refs/heads/master
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Allow Gemlock.lock to be stored in the repo&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sed -i '/Gemfile\.lock$/d' .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Add BasicGem (or your fork of BasicGem) as remote for future merges&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git remote add basic_gem git://github.com/robertwahler/basic_gem.git
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Rename your gem&lt;/h4&gt;

&lt;p&gt;Change the name of the gem from basic_gem to mutagem.  Note that
renames will be tracked in future merges since Git is tracking content and
the content is non-trivial.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git mv lib/basic_gem.rb lib/mutagem.rb
git mv basic_gem.gemspec mutagem.gemspec

# commit renames now 
git commit -m &quot;rename basic_gem files&quot;

# BasicGem =&amp;gt; Mutagem
find . -name *.rb -exec sed -i 's/BasicGem/Mutagem/' '{}' +
find . -name *.feature -exec sed -i 's/BasicGem/Mutagem/' '{}' +
sed -i 's/BasicGem/Mutagem/' Rakefile
sed -i 's/BasicGem/Mutagem/' mutagem.gemspec

# basic_gem =&amp;gt; mutagem
find ./spec -type f -exec sed -i 's/basic_gem/mutagem/' '{}' +
find . -name *.rb -exec sed -i 's/basic_gem/mutagem/' '{}' +
find . -name *.feature -exec sed -i 's/basic_gem/mutagem/' '{}' +
sed -i 's/basic_gem/mutagem/' Rakefile
sed -i 's/basic_gem/mutagem/' mutagem.gemspec
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Replace TODO's and update documentation&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Replace README.markdown&lt;/li&gt;
&lt;li&gt;Replace HISTORY.markdown&lt;/li&gt;
&lt;li&gt;Replace TODO.markdown&lt;/li&gt;
&lt;li&gt;Replace LICENSE&lt;/li&gt;
&lt;li&gt;Replace VERSION&lt;/li&gt;
&lt;li&gt;Modify .gemspec, add author information and replace the TODO's&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;Your gem should now be functional&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;rake spec
rake features
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Setup git copy-merge&lt;/h4&gt;

&lt;p&gt;When we merge future BasicGem changes to our new gem, we want to always ignore
some upstream documentation file changes.&lt;/p&gt;

&lt;p&gt;Set the merge type for the files we want to ignore in .git/info/attributes. You
could specify .gitattributes instead of .git/info/attributes but then if your
new gem is forked, your forked repos will miss out on document merges.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo &quot;README.markdown merge=keep_local_copy&quot; &amp;gt;&amp;gt; .git/info/attributes
echo &quot;HISTORY.markdown merge=keep_local_copy&quot; &amp;gt;&amp;gt; .git/info/attributes
echo &quot;TODO.markdown merge=keep_local_copy&quot; &amp;gt;&amp;gt; .git/info/attributes
echo &quot;LICENSE merge=keep_local_copy&quot; &amp;gt;&amp;gt; .git/info/attributes
echo &quot;VERSION merge=keep_local_copy&quot; &amp;gt;&amp;gt; .git/info/attributes
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Setup the copy-merge driver. The &quot;trick&quot; is that the driver, keep_local_copy, is using
the shell command &quot;true&quot; to return exit code 0.  Basically, the files marked with
the keep_local_copy merge type will always ignore upstream changes if a merge conflict occurs.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git config merge.keep_local_copy.name &quot;always keep the local copy during merge&quot;
git config merge.keep_local_copy.driver &quot;true&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Commit&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;git add Gemfile.lock
git commit -a -m &quot;renamed basic_gem to mutagem&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Add code to project's namespace&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;mkdir lib/mutagem
vim lib/mutagem/mutex.rb
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Merging Future BasicGem Changes&lt;/h3&gt;

&lt;p&gt;Cherry picking method&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git fetch basic_gem
git cherry-pick a0f9745
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Merge 2-step method&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git fetch basic_gem
git merge basic_gem/master
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Trusting pull of HEAD&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git pull basic_gem HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Conflict resolution&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; &lt;em&gt;Most conflicts can be resolved with 'git mergetool' but 'CONFLICT (delete/modify)' will
need to be resolved by hand.&lt;/em&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git mergetool
git commit
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;BasicGem Provided Rake Tasks&lt;/h3&gt;

&lt;p&gt;rake -T&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rake build         # Build mutagem-0.0.1.gem into the pkg directory
rake doc:clean     # Remove generated documenation
rake doc:generate  # Generate YARD Documentation
rake features      # Run Cucumber features
rake install       # Build and install mutagem-0.0.1.gem into system gems
rake release       # Create tag v0.0.1 and build and push mutagem-0.0.1.gem to Rubygems
rake spec          # Run specs
rake test          # Run specs and features
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Autotesting with Watchr&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/mynyml/watchr&quot;&gt;Watchr&lt;/a&gt; provides a flexible alternative to Autotest.  A
jump start script is provided in spec/watchr.rb.&lt;/p&gt;

&lt;h4&gt;Install watchr&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;gem install watchr
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Run watchr&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;watchr spec/watchr.rb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;outputs a menu&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Ctrl-\ for menu, Ctrl-C to quit
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Watchr will now watch the files defined in 'spec/watchr.rb' and run Rspec or Cucumber, as appropriate.
The watchr script provides a simple menu.&lt;/p&gt;

&lt;p&gt;Ctrl-\&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MENU: a = all , f = features  s = specs, l = last feature (none), q = quit
&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Compiling EncFS for Ubuntu 8.04 LTS (Hardy Heron)</title>
    <link href="/articles/ubuntu/compiling-encfs-for-hardy-heron.html" />
    <id>tag:www.gearheadforhire.com,2010-03-25:1269539237</id>
    <updated>2010-03-25T13:47:17-04:00</updated>
    <content type="html">&lt;h3&gt;The Task&lt;/h3&gt;

&lt;p&gt;You are doing user-space filesystem encryption.  You want to use a more recent
version of EncFS than the one provided in the Ubuntu 8.04 repositories. No problem,
just compile one yourself.&lt;/p&gt;

&lt;h3&gt;The Problem&lt;/h3&gt;

&lt;p&gt;The most recent version in the EncFS will not compile on Ubuntu 8.04.  Version
r53 12/7/09 configure.ac breaks with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;checking whether xattr interface takes additional options... no
./configure: line 24466: syntax error near unexpected token 'newline'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This issue has been reported to the EncFS maintainer, in the interim, you can
compile a fairly recent version by following the steps below.&lt;/p&gt;

&lt;h3&gt;Reference Links&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.arg0.net/encfs&quot;&gt;http://www.arg0.net/encfs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/encfs/source/checkout&quot;&gt;http://code.google.com/p/encfs/source/checkout&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Preparation&lt;/h3&gt;

&lt;p&gt;Get the build tools&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install build-essential autoconf automake1.9 libtool gettext \
                     cvs pkg-config
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Verify the kernel has FUSE support&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat /proc/filesystems | grep fuse
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;you should see something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;nodev   fuse
        fuseblk
nodev   fusectl
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Install EncFS dependencies&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install libboost-dev libboost-filesystem-dev \
                     libboost-serialization-dev libfuse-dev \
                     fuse-utils librlog-dev libssl-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Building&lt;/h3&gt;

&lt;p&gt;Build version SVN r50 (f97ae2780) by pulling down with git and checking out the
most recent version that will compile on Ubuntu 8.04&lt;/p&gt;

&lt;div class=&quot;UltraViolet&quot;&gt;
&lt;pre class=&quot;dawn&quot;&gt;    cd ~/src

    git-svn clone --no-metadata  &lt;span class=&quot;MarkupUnderline&quot;&gt;http://encfs.googlecode.com/svn/trunk&lt;/span&gt; encfs
    cd encfs
    git checkout -b work_around_build f97ae2780

    autoreconf -if
    ./configure
    make
    sudo make prefix=/usr install
&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Done!&lt;/p&gt;
</content>
  </entry>
</feed>

