|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: Ruby Core |
| 4 | +--- |
| 5 | + |
| 6 | +Now is a fantastic time to follow Ruby’s development, with Ruby 2.0 |
| 7 | +development underway. With the increased attention Ruby has received in |
| 8 | +the past few years, there’s a growing need for good talent to help |
| 9 | +enhance Ruby and document its parts. So, where do you start? |
| 10 | + |
| 11 | +The topics related to Ruby development covered here are: |
| 12 | + |
| 13 | +* [Using Subversion to Track Ruby Development](#following-ruby) |
| 14 | +* [How to Use Git With the Main Ruby Repository](#git-ruby) |
| 15 | +* [Improving Ruby, Patch by Patch](#patching-ruby) |
| 16 | +* and, [Rules for Core Developers](#coding-standards) |
| 17 | + |
| 18 | +### <a name="following-ruby" />Using Subversion to Track Ruby Development |
| 19 | + |
| 20 | +Checking out the latest Ruby source code is a matter of logging into the |
| 21 | +[Subversion][1] anonymous account. From your commandline: |
| 22 | + |
| 23 | + $ svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby |
| 24 | + |
| 25 | +The `ruby` directory will now contain the latest source code for Ruby |
| 26 | +1.9 (trunk), which is the development version of Ruby. The trunk was |
| 27 | +used to release a stable 1.9.1 version in January 2009. Currently |
| 28 | +patches applied to the trunk are backported to the stable 1\_9\_1 branch |
| 29 | +(see below). |
| 30 | + |
| 31 | +If you’d like to follow patching of Ruby 1.9.1, you should use the |
| 32 | +`ruby_1_9_1` branch when checking out: |
| 33 | + |
| 34 | + $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1 |
| 35 | + |
| 36 | +If you’d like to follow patching of Ruby 1.8, you should use the |
| 37 | +`ruby_1_8_6` or `ruby_1_8_7` branch when checking out (depending on the |
| 38 | +version you’re using): |
| 39 | + |
| 40 | + $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7 |
| 41 | + |
| 42 | +This will check out the Ruby 1.8.7 development tree into a `ruby_1_8_7` |
| 43 | +directory. Developers working on Ruby 1.8 are expected to migrate their |
| 44 | +changes to Ruby’s trunk, so often the two branches are very similiar, |
| 45 | +with the exception of improvements made by Matz and Nobu to the language |
| 46 | +itself. |
| 47 | + |
| 48 | +If you prefer, you may browse [Ruby’s repository via the web][2]. |
| 49 | + |
| 50 | +For information about Subversion, please see [the Subversion FAQ][3] and |
| 51 | +[the Subversion book][4]. Alternatively, you may find |
| 52 | +[Pragmatic Version Control with Subversion][5] to be a useful introductory |
| 53 | +book. |
| 54 | + |
| 55 | +### <a name="git-ruby" />How to Use Git With the Main Ruby Repository |
| 56 | + |
| 57 | +Those who prefer to use [Git][6] over Subversion can find instructions |
| 58 | +with [the mirror on GitHub][7], both for [those with commit access][8] |
| 59 | +and [everybody else][9]. |
| 60 | + |
| 61 | +### <a name="patching-ruby" />Improving Ruby, Patch by Patch |
| 62 | + |
| 63 | +The core team maintains [a bug tracker][10] for submitting patches and |
| 64 | +bug reports to Matz and the gang. These reports also get submitted to |
| 65 | +the [Ruby-Core mailing list](/community/mailing-lists/#ruby-core) for |
| 66 | +discussion, so you can be sure your request won’t go unnoticed. You can |
| 67 | +also send your patches straight to the mailing list. Either way, you are |
| 68 | +encouraged to take part in the discussion that ensues. |
| 69 | + |
| 70 | +Please look over the [Patch Writer’s Guide][11] for some tips, straight |
| 71 | +from matz, on how to get your patches considered. |
| 72 | + |
| 73 | +To summarize, the steps for building a patch are: |
| 74 | + |
| 75 | +1. If you are fixing a bug in Ruby 1.8, check out a copy of Ruby 1.8 |
| 76 | + from Subversion using the `ruby_1_8` branch.` |
| 77 | + $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8 |
| 78 | + `If you wish to add a feature to Ruby, check out the trunk of Ruby’s |
| 79 | + source. Even if you wish to add a feature to Ruby 1.8, it has to be |
| 80 | + proven in the trunk first.` |
| 81 | + $ svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby |
| 82 | + ` |
| 83 | +2. Add your improvements to the code. |
| 84 | +3. Create a patch.` |
| 85 | + $ svn diff > ruby-changes.patch |
| 86 | + ` |
| 87 | +4. Email your patch to the [Ruby-Core mailing |
| 88 | + list](/community/mailing-lists/#ruby-core) with a CHANGELOG entry |
| 89 | + describing the patch. |
| 90 | +5. If there are no issues raised about the patch, committers will be |
| 91 | + given the approval to apply it. |
| 92 | + |
| 93 | +**Please note:** patches should be submitted as a [unified diff][12]. |
| 94 | +For more on how patches are merged, see [the diffutils reference][13]. |
| 95 | + |
| 96 | +Discussion of Ruby’s development converges on the [Ruby-Core mailing |
| 97 | +list](/community/mailing-lists/#ruby-core). So, if you are curious |
| 98 | +about whether your patch is worthwhile or you want to spark a discussion |
| 99 | +about Ruby’s future, don’t hesitate to come aboard. Be warned that |
| 100 | +off-topic discussions are not tolerated on this list, the noise level |
| 101 | +should be very low, topics should be pointed, well-conceived and |
| 102 | +well-written. Since we’re addressing Ruby’s creator, let’s have some |
| 103 | +reverence. |
| 104 | + |
| 105 | +Keep in mind that Ruby’s core developers live in Japan and, while many |
| 106 | +speak very good English, there is a significant timezone difference. |
| 107 | +They also have an entire body of Japanese development lists happening |
| 108 | +alongside the English counterparts. Be patient, if your claim isn’t |
| 109 | +resolved, be persistent—give it another shot a few days later. |
| 110 | + |
| 111 | +### <a name="coding-standards" />Rules for Core Developers |
| 112 | + |
| 113 | +Generally, the developers of Ruby should be familiar with the source |
| 114 | +code and the style of development used by the team. To be clear, the |
| 115 | +following guidelines should be honored when checking into Subversion: |
| 116 | + |
| 117 | +* All check-ins should be described in the `ChangeLog`, following the |
| 118 | + [GNU conventions][14]. (Many Ruby core developers use Emacs `add-log` |
| 119 | + mode, which can be accessed with the command `C-x 4 a`.) |
| 120 | +* Check-in dates should be given in Japan Standard Time (UTC+9). |
| 121 | +* The bulleted points from your ChangeLog should also be placed in the |
| 122 | + Subversion commit message. This message will be automatically mailed |
| 123 | + to the Ruby-CVS list after you commit. |
| 124 | +* K&R function declarations are used throughout Ruby’s source code |
| 125 | + and its packaged extensions. |
| 126 | +* Please, do not use C++-style comments (`//`), Ruby’s maintainers |
| 127 | + instead prefer the standard C multiline comment. (`/* .. */`) |
| 128 | + |
| 129 | +[1]: http://subversion.tigris.org/ |
| 130 | +[2]: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/ |
| 131 | +[3]: http://subversion.tigris.org/faq.html |
| 132 | +[4]: http://svnbook.org |
| 133 | +[5]: http://www.pragmaticprogrammer.com/titles/svn/ |
| 134 | +[6]: http://git-scm.com/ |
| 135 | +[7]: http://github.com/ruby/ruby |
| 136 | +[8]: http://wiki.github.com/shyouhei/ruby/committerhowto |
| 137 | +[9]: http://wiki.github.com/shyouhei/ruby/noncommitterhowto |
| 138 | +[10]: http://redmine.ruby-lang.org/ |
| 139 | +[11]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/25139 |
| 140 | +[12]: http://www.gnu.org/software/diffutils/manual/html_node/Unified-Format.html |
| 141 | +[13]: http://www.gnu.org/software/diffutils/manual/html_node/Merging-with-patch.html#Merging%20with%20patch |
| 142 | +[14]: http://www.gnu.org/prep/standards/standards.html#Change-Logs |
0 commit comments