Skip to content
100644 88 lines (85 sloc) 4.5 KB
03a50a3 @merbjedi Porting to Jekyll format
merbjedi authored
1 ---
2 layout: default
3 title: "Contribute"
4 current: "contribute"
5 ---
7 <div class='full_width' id='content_top'>
8 <div id='content_bottom'>
9 <div id='content_full'>
10 <h1>Contributing to Merb</h1>
11 <h2>Sharing Your Merb Know-How</h2>
12 <p>
13 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.
14 </p>
15 <h2>Reporting bugs</h2>
16 <p>
17 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.
18 </p>
19 <p>
20 Even if you don&#8217;t feel you contribute code, reporting bugs is a huge help, so please report anything awry you encounter.
21 </p>
22 <h2>Contributing Code to Merb</h2>
23 <p>
24 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>
25 </p
7b0cc06 @namelessjon Update some contribution guidelines
namelessjon authored
26 <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>
03a50a3 @merbjedi Porting to Jekyll format
merbjedi authored
27 <h2>Code Style Guidelines</h2>
28 <p>
29 There are a few guidelines your code should follow.
30 </p>
31 <h3>1. Parentheses around parameter lists for methods</h3>
32 <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!" end</code></pre>
33 <h3>2. Two space indent</h3>
34 <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>
35 <h3>3. Documentation is required</h3>
7b0cc06 @namelessjon Update some contribution guidelines
namelessjon authored
36 <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,
37 update it to YARD syntax.</p>
38 <p>The old style of the documentation follows this system:</p>
03a50a3 @merbjedi Porting to Jekyll format
merbjedi authored
39 <p>There are a number of available types:</p>
40 <ul>
41 <li>Class (e.g. <code>String</code>)</li>
42 <li><code>Array[Type]</code> (e.g. <code>Array[String]</code>, an Array of Strings)</li>
43 <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>
44 <li><code>Hash{Type => Type}</code> (e.g. <code>Hash{Symbol => String}</code>, a Hash whose keys are Symbols and values are Strings)</li>
45 <li><code>Hash{Type => Type, Type => Type}</code> (e.g. <code>Hash{Symbol => String, Class => String}</code>, a Hash with two elements)</li>
46 <li>Union Types: <code>(String, Symbol)</code>; (e.g. <code>Array[(String, Symbol)]</code>, an Array whose elements are Strings or Symbols)</li>
47 <li>Duck Typing Types: <code>~to_s</code> (<code>responds_to? :to_s</code>)</li>
48 </ul><br/>
49 <p>Certain types of parameters do not require types:</p>
50 <ul>
51 <li>Splats: <code>*args</code></li>
52 <li>Blocks: <code>&blk</code></li>
53 </ul><br/>
54 <p>Parameters are defined in parameter blocks:</p>
55 <pre><code>
56 ==== Parameters
57 foo&lt;String&gt;:: My foo string
58 bar&lt;String&gt;:: My bar string
59 </code></pre>
60 <p>The return value of a function is required:</p>
61 <pre><code>
62 ==== Returns
63 String:: A cool string
64 </pre></code>
65 <p>If the method might possibly raise an error (including as a result of calling another method), it must be specified:</p>
66 <pre><code>
67 ==== Raises
68 Exception:: A crazy Exception
69 </pre></code>
70 <p>If one of the parameters is an options Hash, it must be specified:</p>
71 <pre><code>
72 ==== Options (opts)
73 :foo&lt;String&gt;:: The foo option
74 :bar&lt;Symbol&gt;:: The bar option
75 </pre></code>
77 <h3>4. Be wary of clever code!</h3>
78 <p>
79 Cleverness for cleverness sake is not our friend; if something is only slightly more handy but infinitely more complex, then please reconsider your implementation.
80 </p>
81 <h3>5. Column width</h3>
82 <p>
83 80 column line width except in exceptional situations
84 </p>
85 </div>
86 </div>
7b0cc06 @namelessjon Update some contribution guidelines
namelessjon authored
87 </div>
Something went wrong with that request. Please try again.