<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Moves On Rails: Autotest 100% CPU solution</title>
    <link>http://www.movesonrails.com/articles/2008/02/06/autotest-100-cpu-solution</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>New ways to look at software</description>
    <item>
      <title>Autotest 100% CPU solution</title>
      <description>&lt;p&gt;Autotest is great, but when it is waiting for test, my MacBook turns into a whirlwind as autotest takes 100% CPU. After looking at autotest.rb, we easily find the waiting function:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;def wait_for_changes
  hook :waiting
  Kernel.sleep self.sleep until find_files_to_test
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As self.sleep is defaulted to 1 it means that my laptop does not sleep at all. Changing this is quite easy, as you can just add this to your .autotest file in your home directory:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Autotest.add_hook :initialize do |at|
  at.sleep = 5
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Experiment with the amount to determine what  works for you. Offcourse autotest will now react slower to you changes, but hey: you can't have everything. Enjoy the silence!&lt;/p&gt;</description>
      <pubDate>Wed, 06 Feb 2008 09:42:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:66b85026-b2bb-4003-8906-21d0cb54b7cf</guid>
      <author>bart.tenbrinke@movesonrails.com (Bart ten Brinke)</author>
      <link>http://www.movesonrails.com/articles/2008/02/06/autotest-100-cpu-solution</link>
      <category>Rails</category>
      <category>Ruby</category>
      <category>Rspec</category>
      <category>autotest</category>
      <category>Rspec</category>
      <category>100</category>
      <category>Cpu</category>
    </item>
  </channel>
</rss>
