<?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>6502.fr &#187; Programming</title>
	<atom:link href="http://www.6502.fr/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.6502.fr</link>
	<description>L'Avant-dernier cri de la technologie</description>
	<lastBuildDate>Sat, 31 Jul 2010 15:39:49 +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>Gérer plusieurs versions de Ruby sur Leopard</title>
		<link>http://www.6502.fr/plusieurs-versions-de-ruby-sur-leopard-avec-rvm/246</link>
		<comments>http://www.6502.fr/plusieurs-versions-de-ruby-sur-leopard-avec-rvm/246#comments</comments>
		<pubDate>Mon, 12 Jul 2010 14:15:34 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Outils]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=246</guid>
		<description><![CDATA[Un jour ou l&#8217;autre vous allez avoir besoin d&#8217;une gem qui exige une version plus récente de Ruby. Par exemple sqlite3. $ sudo gem install sqlite3 Password: ERROR: Error installing sqlite3: sqlite3 requires Ruby version &#62;= 1.9.1. Mais vous utilisez des gems qui ne sont pas compatibles avec Ruby&#160;1.9 et vous devez donc faire cohabiter [...]]]></description>
			<content:encoded><![CDATA[<p>Un jour ou l&#8217;autre vous allez avoir besoin d&#8217;une <i>gem</i> qui exige une version plus récente de Ruby. Par exemple <i>sqlite3</i>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3
Password:
ERROR:  Error installing sqlite3:
	sqlite3 requires Ruby version <span style="color: #000000; font-weight: bold;">&gt;</span>= 1.9.1.</pre></div></div>

<p>Mais vous utilisez des <i>gems</i> qui ne sont pas compatibles avec Ruby&nbsp;1.9 et vous devez donc faire cohabiter plusieurs versions de Ruby. C&#8217;est là que <a title="RVM: Ruby Version Manager [en anglais]" href="http://rvm.beginrescueend.com/rvm/install/">RVM</a> intervient.</p>
<h3>Installer RVM sur Leopard</h3>
<p>Passez la commande suivante dans une fenêtre de Terminal&nbsp;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> curl http:<span style="color: #000000; font-weight: bold;">//</span>rvm.beginrescueend.com<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>rvm-install-head <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Puis ajoutez cette ligne à la fin de votre fichier <i>~/.profile</i>&nbsp;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>rvm <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">source</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>rvm</pre></div></div>

<p>Pour tous les détails additionnels, allez <a title="RVM: Ruby Version Manager - Installing RVM [en anglais]" href="http://rvm.beginrescueend.com/rvm/install/">à la source</a>.</p>
<h3>Utiliser RVM</h3>
<p>Vous pouvez maintenant utiliser rvm, par exemple pour installer Ruby&nbsp;1.9.1.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ rvm <span style="color: #c20cb9; font-weight: bold;">install</span> 1.9.1 ; rvm 1.9.1
$ ruby <span style="color: #660033;">-v</span>
ruby 1.9.1p378 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2010</span>-01-<span style="color: #000000;">10</span> revision <span style="color: #000000;">26273</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i386-darwin9.8.0<span style="color: #7a0874; font-weight: bold;">&#93;</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3
Building native extensions.  This could take a while...
...
Successfully installed sqlite3-0.1.1</pre></div></div>

<p>Pour revenir à la version d&#8217;origine&nbsp;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ rvm system
$ ruby <span style="color: #660033;">-v</span>
ruby 1.8.7 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2009</span>-06-<span style="color: #000000;">12</span> patchlevel <span style="color: #000000;">174</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i686-darwin9.8.0<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/plusieurs-versions-de-ruby-sur-leopard-avec-rvm/246/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSpec : tester le contenu d&#8217;un content_for</title>
		<link>http://www.6502.fr/rspec-tester-le-contenu-de-content_for/198</link>
		<comments>http://www.6502.fr/rspec-tester-le-contenu-de-content_for/198#comments</comments>
		<pubDate>Sun, 02 Nov 2008 15:38:55 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[RSpec]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=198</guid>
		<description><![CDATA[Une spécification de vue sous RSpec pourrait ressembler à ça&#160;: it &#34;should render column titles&#34; do render &#34;/feeds/index.html.erb&#34; response.should have_tag&#40;&#34;tr&#62;th&#34;, &#34;name&#34;&#41; response.should have_tag&#40;&#34;tr&#62;th&#34;, &#34;url&#34;&#41; end Mais cette méthode ne permet pas de tester les bribes de HTML qui sont produites dans un content_for. En effet, ces bribes sont incluses directement dans le layout, pas dans [...]]]></description>
			<content:encoded><![CDATA[<p>Une spécification de vue sous RSpec pourrait ressembler à ça&nbsp;:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  it <span style="color:#996600;">&quot;should render column titles&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    render <span style="color:#996600;">&quot;/feeds/index.html.erb&quot;</span>
    response.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;tr&gt;th&quot;</span>, <span style="color:#996600;">&quot;name&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    response.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;tr&gt;th&quot;</span>, <span style="color:#996600;">&quot;url&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Mais cette méthode ne permet pas de tester les bribes de HTML qui sont produites dans un <em>content_for</em>. En effet, ces bribes sont incluses directement dans le layout, pas dans la production de la vue. Pour ce faire, ajouter dans <em>spec_helper.rb</em>&nbsp;:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> content_for<span style="color:#006600; font-weight:bold;">&#40;</span>name<span style="color:#006600; font-weight:bold;">&#41;</span>
    response.<span style="color:#9900CC;">template</span>.<span style="color:#9900CC;">instance_variable_get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;@content_for_#{name}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Puis dans les specs&nbsp;:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  it <span style="color:#996600;">&quot;should render a 'New feed' link&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    render <span style="color:#996600;">&quot;/feeds/index.html.erb&quot;</span>
    content_for<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:somewhere</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;a[href=?]&quot;</span>, new_feed_path<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Merci à <a title="rspec-users mailing list [en anglais]" href="http://rubyforge.org/pipermail/rspec-users/2007-June/001954.html">Carl-Johan Kihlbom</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/rspec-tester-le-contenu-de-content_for/198/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Une commande Ubiquity pour accéder directement à l&#8217;API Ruby</title>
		<link>http://www.6502.fr/commande-ubiquity-acces-direct-api-ruby/166</link>
		<comments>http://www.6502.fr/commande-ubiquity-acces-direct-api-ruby/166#comments</comments>
		<pubDate>Fri, 12 Sep 2008 10:02:33 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Outils]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ubiquity]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=166</guid>
		<description><![CDATA[Jack Dempsey a créé une commande Ubiquity pour accéder directement à l&#8217;API Ruby sur APIdock. Vous pouvez l&#8217;installer en collant le code dans l&#8217;éditeur de commandes Ubiquity. ou en vous abonnant (le bouton apparaît en haut à droite du bandeau). L&#8217;utilisation est simple : invoquer Ubiquity (alt-espace sur mon Mac), taper ruby &#60;nom-de-fonction&#62; puis &#60;Enter&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Profil de Jack Dempsey sur Github [anglais]" href="http://github.com/jackdempsey">Jack Dempsey</a> a créé une <a title="ruby-search.ubiquity-command.js [javascript]" href="http://gist.github.com/8132">commande Ubiquity</a> pour accéder directement à l&#8217;API Ruby sur <a title="APIdock [anglais]" href="http://apidock.com/">APIdock</a>. Vous pouvez l&#8217;installer en collant le code dans l&#8217;<a title="Éditeur de commande Ubiquity [Firefox local]" href="chrome://ubiquity/content/editor.html">éditeur de commandes Ubiquity</a>. ou en vous abonnant (le bouton apparaît en haut à droite du bandeau).</p>
<p>L&#8217;utilisation est simple : invoquer Ubiquity (alt-espace sur mon Mac), taper <code>ruby &lt;nom-de-fonction&gt;</code> puis &lt;Enter&gt; et la page s&#8217;ouvre dans un nouvel onglet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/commande-ubiquity-acces-direct-api-ruby/166/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ressources sur les Test fixtures</title>
		<link>http://www.6502.fr/ressources-sur-les-test-fixtures/156</link>
		<comments>http://www.6502.fr/ressources-sur-les-test-fixtures/156#comments</comments>
		<pubDate>Tue, 09 Sep 2008 14:18:15 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=156</guid>
		<description><![CDATA[Les informations La base : le chapitre 7 du manuel, The Lo-Down on Fixtures et la référence. Une bonne introduction aux fixtures dans Rails 2.0 : Fixtures in Rails 2.0 Si vous n&#8217;aimez pas les screencasts, la même info dans un blog : What&#8217;s New in Edge Rails: Fixtures Just Got a Whole Lot Easier [...]]]></description>
			<content:encoded><![CDATA[<h3>Les informations</h3>
<p>La base : le chapitre 7 du manuel, <a href="http://manuals.rubyonrails.com/read/chapter/26" title="The Lo-Down on Fixtures [anglais]">The Lo-Down on Fixtures</a> et la <a href="http://api.rubyonrails.org/classes/Fixtures.html" title="API [anglais]">référence</a>.</p>
<p>Une bonne introduction aux fixtures dans Rails 2.0 : <a title="Screen cast : Fixtures in Rails 2.0 [anglais]" href="http://railscasts.com/episodes/81">Fixtures in Rails 2.0</a></p>
<p>Si vous n&#8217;aimez pas les screencasts, la même info dans un blog : <a href="http://ryandaigle.com/articles/2007/10/26/what-s-new-in-edge-rails-fixtures-just-got-a-whole-lot-easier" title="Fixtures Just Got a Whole Lot Easier par Ryan Dailge [anglais]">What&#8217;s New in Edge Rails: Fixtures Just Got a Whole Lot Easier</a></p>
<h3>Les avis</h3>
<p>Le titre de l&#8217;article se passe de commentaire : <a href="http://glu.ttono.us/articles/2006/08/07/why-fixtures-suck-and-how-we-can-fix-them" title="Why Fixtures Suck [anglais]">Why Fixtures Suck (And How We Can Fix Them)</a>. Un peu vieux, il date du mois d&#8217;août 2006</p>
<p><a href="http://www.dcmanges.com/blog/">Daniel Manges</a> propose de <a href="http://www.dcmanges.com/blog/38">remplacer les fixtures par des factories</a>. <a href="http://www.pgrs.net/">Paul Gross</a> propose un <a href="http://www.pgrs.net/2008/5/8/factory-pattern-with-syntactic-sugar">raffinement de la méthode</a>. À creuser.</p>
<p><a href="http://errtheblog.com/" title="Err the blog [anglais]">Chris Wanstrath</a> propose des <a href="http://errtheblog.com/posts/61-fixin-fixtures" title="Fixin' fixtures [anglais]">Fixtures scenarios</a>. Les commentaires qui suivent sont particulièrement intéressants.</p>
<h3>Les outils</h3>
<p><a href="http://fabien.jakimowicz.com/" title="Blog de Fabien Jakimowicz - blog.name.nil?">Fabien Jakimowicz</a> vous propose des tâches rake qui construisent vos fixtures à partir d&#8217;une base de données dans son article <a href="http://fabien.jakimowicz.com/articles/2008/06/26/named_fixtures_exporter" title="Rails plugin: named fixtures exporter [français]">Rails plugin: named fixtures exporter</a></p>
<h3>Clefs étrangères et intégrité référentielle</h3>
<p>Les clefs étrangères présentent une difficulté : il n&#8217;est plus possible d&#8217;insérer ni de supprimer les enregistrements dans la base dans un ordre quelconque. <a href="http://techpolesen.blogspot.com/" title="Ancien blog de Per Olesen - Old Tech Per">Per Olesen</a> propose une technique pour résoudre ce problème dans son article <a href="http://techpolesen.blogspot.com/2007/04/rails-fixture-tips.html" title="Intégrité référentielle et fixtures dans Rails [anglais]"><em>Rails Fixtures Tips</em></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/ressources-sur-les-test-fixtures/156/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Le carrefour du Zen et du test</title>
		<link>http://www.6502.fr/carrefour-du-zen-et-du-test/158</link>
		<comments>http://www.6502.fr/carrefour-du-zen-et-du-test/158#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:13:44 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[zen]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=158</guid>
		<description><![CDATA[La voie de Testivus — la sagesse du test unitaire dans une ancienne startup. Don’t get stuck on unit testing dogma Embrace unit testing karma Le même article en pdf.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.artima.com/weblogs/viewpost.jsp?thread=203994" title="The Way of Testivus - Unit Testing Wisdom From An Ancient Software Start-up [anglais]">La voie de Testivus — la sagesse du test unitaire dans une ancienne startup</a>.</p>
<blockquote><p><em>Don’t get stuck on unit testing dogma<br />
Embrace unit testing karma</em></p></blockquote>
<p>Le même article en <a href="http://www.agitar.com/downloads/TheWayOfTestivus.pdf">pdf</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/carrefour-du-zen-et-du-test/158/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test fixtures et reformatage</title>
		<link>http://www.6502.fr/test-fixtures-et-reformatage/151</link>
		<comments>http://www.6502.fr/test-fixtures-et-reformatage/151#comments</comments>
		<pubDate>Sun, 07 Sep 2008 10:00:17 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=151</guid>
		<description><![CDATA[Les tests fixtures sont un des moyens de gérer les données nécessaires aux tests. Le système de test fixtures de Ruby on Rails se distingue par sa grande facilité d&#8217;écriture. Les données sont saisies dans des fichiers YAML, et le système de test gère les id, les relations 1-n et les relations n-n. Parfois les [...]]]></description>
			<content:encoded><![CDATA[<p>Les <a title="Test Fixtures sur Wikipedia [anglais]" href="http://en.wikipedia.org/wiki/Test_fixture"><em>tests fixtures</em></a> sont un des moyens de gérer les données nécessaires aux tests. Le système de <a title="The Lo-Down on Fixtures  [anglais]" href="http://manuals.rubyonrails.com/read/chapter/26"><em>test fixtures</em></a> de <a title="Ruby on Rails [anglais]" href="http://www.rubyonrails.org/">Ruby on Rails</a> se distingue par sa grande facilité d&#8217;écriture. Les données sont saisies dans des fichiers <a title="Site officiel de YAML [anglais]" href="http://www.yaml.org/">YAML</a>, et le système de test gère les <em>id</em>, les relations <em>1-n</em> et les relations <em>n-n</em>.</p>
<p>Parfois les données brutes ne sont pas disponibles dans le bon format. L&#8217;éditeur <em>vi</em> (ou <em>vim</em>), disponible sur toutes les bonnes plateformes, dispose d&#8217;une commande d&#8217;édition par expressions régulières très puissante. Prenons un exemple. J&#8217;ai donc besoin de convertir une liste d&#8217;ATA au format YAML.</p>
<h3>Format liste</h3>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">21 : Air conditioning
22 : Auto flight
23 : Communications</pre></div></div>

<h3>Format YAML</h3>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">21:
  number: 21
  description: Air conditioning
&nbsp;
22:
  number: 22
  description: Auto flight
&nbsp;
23:
  number: 23
  description: Communications</pre></div></div>

<h3>La commande vi de substitution</h3>
<p>Une « simple » commande suffit:</p>

<div class="wp_syntax"><div class="code"><pre class="vi" style="font-family:monospace;">:%s/\([0-9][0-9]\) : \(.*\)/\1:\r  number: \1\r  description: \2\r/</pre></div></div>

<p>Ça paraît un peu rude, mais c&#8217;est facile à décortiquer. Prenons la commande dans l&#8217;ordre.</p>
<ul>
<li><code>%</code> toutes les lignes du fichier</li>
<li><code>s/.../.../</code> la commande de substitution qui va être appliquée à chaque ligne</li>
<li><code>[0-9][0-9]</code> deux chiffres ; je mémorise le numéro dans \1 en le mettant entre \( et \)</li>
<li><code> : </code> deux points entre deux espace</li>
<li><code>.*</code> tout le reste de la ligne, que je \(mémorise\) dans \2</li>
<li>maintenant le remplacement : je récupère le numéro avec \1, que j&#8217;insère suivi de : et d&#8217;un saut de ligne</li>
<li>insertion de <code> number:</code> puis le numéro</li>
<li>insertion de <code> description:</code> puis le texte récupéré</li>
</ul>
<p>Facile, non ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/test-fixtures-et-reformatage/151/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>La documentation de Ruby on Rails accessible offline</title>
		<link>http://www.6502.fr/la-documentation-de-ruby-on-rails-accessible-offline/137</link>
		<comments>http://www.6502.fr/la-documentation-de-ruby-on-rails-accessible-offline/137#comments</comments>
		<pubDate>Sun, 24 Aug 2008 16:10:54 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[API]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=137</guid>
		<description><![CDATA[La première méthode qui vient à l&#8217;esprit pour disposer de la documentation de référence de Ruby on Rails quand on n&#8217;est pas connecté est d&#8217;aspirer le site web. wget -r -w 1 http://api.rubyonrails.com Mais ce n&#8217;est pas la peine si vous avez installé Rails avec gem&#160;: vous avez un serveur local à disposition. Lancez&#160;: gem [...]]]></description>
			<content:encoded><![CDATA[<p>La première méthode qui vient à l&#8217;esprit pour disposer de la documentation de référence de <em>Ruby on Rails</em> quand on n&#8217;est pas connecté est d&#8217;aspirer le site web.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-r</span> <span style="color: #660033;">-w</span> <span style="color: #000000;">1</span> http:<span style="color: #000000; font-weight: bold;">//</span>api.rubyonrails.com</pre></div></div>

<p>Mais ce n&#8217;est pas la peine si vous avez installé Rails avec <a href="http://www.rubygems.org/">gem</a>&nbsp;: vous avez un serveur local à disposition. Lancez&nbsp;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem server</pre></div></div>

<p>Puis pointez votre navigateur sur <a href="http://localhost:8808/">http://localhost:8808/</a>. Ça marche, mais je trouve l&#8217;interface utilisateur pénible. (Quand je suis connecté, j&#8217;utilise <a href="http://www.gotapi.com/rubyrails">gotAPI</a>.) Il y a une alternative sur <a href="http://www.railsbrain.com/">RailsBrain.com</a> avec un ZIP à télécharger.</p>
<p>Pour une raison que je n&#8217;ai pas cherché à élucider, je n&#8217;ai pas réussi à décomprimer le fichier sous Vista. Je l&#8217;ai décomprimé sous Mac OS X puis copié sur mon portable&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/la-documentation-de-ruby-on-rails-accessible-offline/137/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TDD en trois fiches</title>
		<link>http://www.6502.fr/tdd-en-trois-fiches/129</link>
		<comments>http://www.6502.fr/tdd-en-trois-fiches/129#comments</comments>
		<pubDate>Sat, 23 Aug 2008 14:28:08 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=129</guid>
		<description><![CDATA[Brian Di Croce a résumé le TDD en trois fiches dont voici la première.]]></description>
			<content:encoded><![CDATA[<p><a title="Blog de Brian di Croce [en anglais]" href="http://blog.briandicroce.com/">Brian Di Croce</a> a résumé le TDD en <a title="Three Index Cards To Easily Remember The Essence Of Test-Driven Development [en anglais]" href="http://blog.briandicroce.com/2008/03/14/three-index-cards-to-easily-remember-the-essence-of-test-driven-development/">trois fiches</a> dont voici la première.</p>
<p><a href="http://blog.briandicroce.com/2008/03/14/three-index-cards-to-easily-remember-the-essence-of-test-driven-development/"><img class="aligncenter size-full wp-image-132" title="Card #1. Uncle Bob’s Three Laws" src="http://www.6502.fr/wp-content/uploads/2008/08/briandicroce-tdd-card11.jpg" alt="Card #1. Uncle Bob’s Three Laws" width="480" height="240" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/tdd-en-trois-fiches/129/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Afficher une page de maintenance pendant le déploiement</title>
		<link>http://www.6502.fr/afficher-une-page-de-maintenance-pendant-le-deploiement/88</link>
		<comments>http://www.6502.fr/afficher-une-page-de-maintenance-pendant-le-deploiement/88#comments</comments>
		<pubDate>Mon, 11 Aug 2008 15:15:12 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Outils]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Capistrano]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=88</guid>
		<description><![CDATA[Il est possible d&#8217;afficher une page statique de maintenance pendant les opérations de déploiement avec Capistrano. cap deploy:web:disable Il est même possible d&#8217;y ajouter le motif et l&#8217;heure prévue de remise en service : cap deploy:web:disable REASON=&#34;installing new version&#34; UNTIL=&#34;lunch time&#34; Notez que la page est en anglais. Le mécanisme est simple. À l&#8217;invocation de la [...]]]></description>
			<content:encoded><![CDATA[<p>Il est possible d&#8217;afficher une page statique de maintenance pendant les opérations de déploiement avec <a title="Capistrano [en anglais]" href="http://www.capify.org/">Capistrano</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cap deploy:web:disable</pre></div></div>

<p>Il est même possible d&#8217;y ajouter le motif et l&#8217;heure prévue de remise en service :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cap deploy:web:disable <span style="color: #007800;">REASON</span>=<span style="color: #ff0000;">&quot;installing new version&quot;</span> <span style="color: #007800;">UNTIL</span>=<span style="color: #ff0000;">&quot;lunch time&quot;</span></pre></div></div>

<p>Notez que la page est en anglais.</p>
<p>Le mécanisme est simple. À l&#8217;invocation de la commande, Capistrano copie le fichier <em>maintenance.html</em> dans <em>/shared/system/maintenance.html</em>. Pour que ce fichier apparaisse, il faut configurer le serveur. Prenons l&#8217;exemple d&#8217;Apache (en particulier parce que je n&#8217;ai pas la première idée de comment ça marche avec d&#8217;autres serveurs).</p>
<p>Nous allons utiliser mod_rewrite pour faire une redirection de tout le site vers cette simple page, quand elle est présente. Il faut modifier le contenu de httpd.conf de la manière suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">	<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
	<span style="color: #adadad; font-style: italic;"># Just for debug </span>
	<span style="color: #adadad; font-style: italic;">#RewriteLog /home/.../logs/rewrite.log</span>
	<span style="color: #adadad; font-style: italic;">#RewriteLogLevel 5</span>
&nbsp;
	<span style="color: #adadad; font-style: italic;"># Check for maintenance file and redirect all requests</span>
	<span style="color: #adadad; font-style: italic;">#  ( this is for use with Capistrano's disable_web task )</span>
	<span style="color: #00007f;">RewriteCond</span> %{DOCUMENT_ROOT}/system/maintenance.html -f
	<span style="color: #00007f;">RewriteCond</span> %{SCRIPT_FILENAME} !maintenance.html
	<span style="color: #00007f;">RewriteRule</span> ^.*$ %{DOCUMENT_ROOT}/system/maintenance.html [L]</pre></div></div>

<p>Bien sûr, quand le déploiement est terminé, on remet le site en service avec &nbsp;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cap deploy:web:<span style="color: #7a0874; font-weight: bold;">enable</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/afficher-une-page-de-maintenance-pendant-le-deploiement/88/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>La documentation de Capistrano</title>
		<link>http://www.6502.fr/la-documentation-de-capistrano/90</link>
		<comments>http://www.6502.fr/la-documentation-de-capistrano/90#comments</comments>
		<pubDate>Sun, 10 Aug 2008 11:00:52 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Outils]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=90</guid>
		<description><![CDATA[Le site de Capistrano est clair et lisible. Les premiers pas avec Rails (Getting Started) sont parfaits si vous êtes dans le cas de déploiement prévu, mais il manque un manuel de référence. Les ressources disponibles : La base : Using Capistrano with Rails Toutes les variables de deploy.rb : Available Configuration Parameter Quand tout le reste [...]]]></description>
			<content:encoded><![CDATA[<p>Le <a title="Capistrano [en anglais]" href="http://www.capify.org/">site de Capistrano</a> est clair et lisible. Les premiers pas avec Rails (<a title="Capistrano Getting started with Rails [en anglais]" href="http://www.capify.org/getting-started/rails"><em>Getting Started</em></a>) sont parfaits si vous êtes dans le cas de déploiement prévu, mais il manque un manuel de référence. Les ressources disponibles :</p>
<ul>
<li>La base : <a title="http://www.capify.org/getting-started/rails [en anglais]" hreflang="en" href="http://www.capify.org/getting-started/rails">Using Capistrano with Rails</a></li>
<li>Toutes les variables de <em>deploy.rb</em> : <em><a title="Available Configuration Parameters [en anglais]" hreflang="en" href="http://labs.peritor.com/webistrano/wiki/ConfigurationParameter">Available Configuration Parameter</a></em></li>
<li>Quand tout le reste rate : le <a title="Capistrano sur Github [en anglais]" hreflang="en" href="http://github.com/jamis/capistrano/tree/master">code source</a></li>
</ul>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/la-documentation-de-capistrano/90/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
