Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
88 lines (85 sloc) 4.5 KB
layout: default
title: "Contribute"
current: "contribute"
<div class='full_width' id='content_top'>
<div id='content_bottom'>
<div id='content_full'>
<h1>Contributing to Merb</h1>
<h2>Sharing Your Merb Know-How</h2>
Merb has a fledgling <a href="" title="Merb Wiki">wiki</a> that would love to meet you. The <a href="" title="Merb Wiki">wiki</a> is a great place to garner and contribute up-to-date information on all things Merb.
<h2>Reporting bugs</h2>
Found a bug? Ticket it! Go to our <a href="">Lighthouse app</a> and set up a login, then add your ticket. For any tickets that you do add, please try to be as descriptive as possible, the developers well thank you for it.
Even if you don&#8217;t feel you contribute code, reporting bugs is a huge help, so please report anything awry you encounter.
<h2>Contributing Code to Merb</h2>
Contributing to Merb is as easy as checking the source out from Github, editing it, and creating a patch. <a href="">Learn all about using git, Github, and making patches.</a>
<pre><code>$ git clone git://<br />$ cd merb-core<br />$ vim the_source_file.rb<br />$ git commit -a -m "fix a bug"<br />$ git-format-patch master..</code></pre>
<h2>Code Style Guidelines</h2>
There are a few guidelines your code should follow.
<h3>1. Parentheses around parameter lists for methods</h3>
<pre><code># BAD!<br />def my_method param, arg<br /> puts "OH NOEZ!"<br />end<br /><br /># GOOD!<br />def my_method(param, arg)<br /> puts "HOORAYZ!"<br />end</code></pre>
<h3>2. Two space indent</h3>
<pre><code># BAD!<br />def tabby<br /> puts "A fat tab!"<br />end<br /><br /># GOOD!<br />def tabby<br /> puts "Two spaces!"<br />end</code></pre>
<h3>3. Documentation is required</h3>
<p>We would like to move merb over to a <a href="">YARD</a> based documentation system. To that end, we ask if you touch a file,
update it to YARD syntax.</p>
<p>The old style of the documentation follows this system:</p>
<p>There are a number of available types:</p>
<li>Class (e.g. <code>String</code>)</li>
<li><code>Array[Type]</code> (e.g. <code>Array[String]</code>, an Array of Strings)</li>
<li><code>Array[Type, Type]</code> (e.g. <code>Array[String, Symbol]</code>, an Array of two elements: a String followed by a Symbol)</li>
<li><code>Hash{Type => Type}</code> (e.g. <code>Hash{Symbol => String}</code>, a Hash whose keys are Symbols and values are Strings)</li>
<li><code>Hash{Type => Type, Type => Type}</code> (e.g. <code>Hash{Symbol => String, Class => String}</code>, a Hash with two elements)</li>
<li>Union Types: <code>(String, Symbol)</code>; (e.g. <code>Array[(String, Symbol)]</code>, an Array whose elements are Strings or Symbols)</li>
<li>Duck Typing Types: <code>~to_s</code> (<code>responds_to? :to_s</code>)</li>
<p>Certain types of parameters do not require types:</p>
<li>Splats: <code>*args</code></li>
<li>Blocks: <code>&blk</code></li>
<p>Parameters are defined in parameter blocks:</p>
==== Parameters
foo&lt;String&gt;:: My foo string
bar&lt;String&gt;:: My bar string
<p>The return value of a function is required:</p>
==== Returns
String:: A cool string
<p>If the method might possibly raise an error (including as a result of calling another method), it must be specified:</p>
==== Raises
Exception:: A crazy Exception
<p>If one of the parameters is an options Hash, it must be specified:</p>
==== Options (opts)
:foo&lt;String&gt;:: The foo option
:bar&lt;Symbol&gt;:: The bar option
<h3>4. Be wary of clever code!</h3>
Cleverness for cleverness sake is not our friend; if something is only slightly more handy but infinitely more complex, then please reconsider your implementation.
<h3>5. Column width</h3>
80 column line width except in exceptional situations
Jump to Line
Something went wrong with that request. Please try again.