<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Faster TDD with Stakeout.rb</title>
	<atom:link href="http://mikenaberezny.com/2007/09/04/faster-tdd-with-stakeout-rb/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikenaberezny.com/2007/09/04/faster-tdd-with-stakeout-rb/</link>
	<description></description>
	<pubDate>Tue, 14 Oct 2008 01:36:53 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: René Leonhardt</title>
		<link>http://mikenaberezny.com/2007/09/04/faster-tdd-with-stakeout-rb/#comment-80604</link>
		<dc:creator>René Leonhardt</dc:creator>
		<pubDate>Fri, 01 Feb 2008 08:11:04 +0000</pubDate>
		<guid isPermaLink="false">http://mikenaberezny.com/archives/78#comment-80604</guid>
		<description>&lt;pre lang="python"&gt;
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-

import os, subprocess, sys, time

if len(sys.argv) &#60; 3:
  print "Usage: stakeout.py  [files to watch]+"
  sys.exit(1)

command = sys.argv[1]
files = {}

for arg in sys.argv[2:]:
  if os.path.isfile(arg):
    files[arg] = os.path.getmtime(arg)
last_changed = max(files.values())

try:
  while True:

    time.sleep(1)

    for file in files.iterkeys():
      file_mtime = os.path.getmtime(file)
      if file_mtime &gt; last_changed:
        files[file] = last_changed = file_mtime

        print "=&gt; %s changed, running %s" % (file, command)
        try:
          retcode = subprocess.call(command, shell=True)
          print "=&gt; done"
        except OSError, e:
          print &gt;&gt;sys.stderr, "Execution failed:", e
except KeyboardInterrupt:
    pass
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: iso-8859-15 -*-</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">subprocess</span>, <span style="color: #dc143c;">sys</span>, <span style="color: #dc143c;">time</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span>lt; <span style="color: #ff4500;">3</span>:
  <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Usage: stakeout.py  [files to watch]+&quot;</span>
  <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
command = <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
files = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> arg <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span>:<span style="color: black;">&#93;</span>:
  <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isfile</span><span style="color: black;">&#40;</span>arg<span style="color: black;">&#41;</span>:
    files<span style="color: black;">&#91;</span>arg<span style="color: black;">&#93;</span> = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">getmtime</span><span style="color: black;">&#40;</span>arg<span style="color: black;">&#41;</span>
last_changed = <span style="color: #008000;">max</span><span style="color: black;">&#40;</span>files.<span style="color: black;">values</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">try</span>:
  <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:
&nbsp;
    <span style="color: #dc143c;">time</span>.<span style="color: black;">sleep</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: #008000;">file</span> <span style="color: #ff7700;font-weight:bold;">in</span> files.<span style="color: black;">iterkeys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
      file_mtime = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">getmtime</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span><span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> file_mtime <span style="color: #66cc66;">&gt;</span> last_changed:
        files<span style="color: black;">&#91;</span><span style="color: #008000;">file</span><span style="color: black;">&#93;</span> = last_changed = file_mtime
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;=&gt; %s changed, running %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span><span style="color: #008000;">file</span>, command<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
          retcode = <span style="color: #dc143c;">subprocess</span>.<span style="color: black;">call</span><span style="color: black;">&#40;</span>command, shell=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>
          <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;=&gt; done&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">OSError</span>, e:
          <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #66cc66;">&gt;&gt;</span>sys.<span style="color: black;">stderr</span>, <span style="color: #483d8b;">&quot;Execution failed:&quot;</span>, e
<span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">KeyboardInterrupt</span>:
    <span style="color: #ff7700;font-weight:bold;">pass</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Naberezny</title>
		<link>http://mikenaberezny.com/2007/09/04/faster-tdd-with-stakeout-rb/#comment-44663</link>
		<dc:creator>Mike Naberezny</dc:creator>
		<pubDate>Wed, 05 Sep 2007 13:22:32 +0000</pubDate>
		<guid isPermaLink="false">http://mikenaberezny.com/archives/78#comment-44663</guid>
		<description>:-)

I'd like to see everyone do more testing, regardless of whatever language they happen to be stuck using.</description>
		<content:encoded><![CDATA[<p>:-)</p>
<p>I&#8217;d like to see everyone do more testing, regardless of whatever language they happen to be stuck using.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Davis</title>
		<link>http://mikenaberezny.com/2007/09/04/faster-tdd-with-stakeout-rb/#comment-44618</link>
		<dc:creator>Ryan Davis</dc:creator>
		<pubDate>Wed, 05 Sep 2007 08:58:29 +0000</pubDate>
		<guid isPermaLink="false">http://mikenaberezny.com/archives/78#comment-44618</guid>
		<description>now that's just sad... Geoffrey didn't have THAT in mind!</description>
		<content:encoded><![CDATA[<p>now that&#8217;s just sad&#8230; Geoffrey didn&#8217;t have THAT in mind!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.528 seconds -->
<!-- Cached page served by WP-Cache -->
