When writing code it is generally a good idea to try and match your formatting to that of any existing code in the same file, or to other similar files if you are writing new code. Consistency of layout is far more important that the layout itself as it makes reading code much easier.
One golden rule of formatting -- please don't use tabs in your code as they will cause the file to be formatted differently for different people depending on how they have their editor configured.
Having a good suite of tests is very important to the stability and maintainability of any code base. The tests in the Rails port code are by no means complete, but they are extensive, and must continue to be so with any new functionality which is written. Tests are also useful in giving others confidence in the code you've written, and can greatly speed up the process of merging in new code.
When hacking, you should:
You can run the existing test suite with:
bundle exec rake test
You can generate test coverage stats with:
sudo gem install rcov
rcov -x gems test/*/*.rb
The tests are automatically run on commit with the results shown at http://cruise.openstreetmap.org/
Sometimes it's not apparent from the code itself what it does, or, more importantly, why it does that. Good comments help your fellow developers to read the code and satisfy themselves that it's doing the right thing.
When hacking, you should:
To generate the HTML documentation of the API/rails code, run the command
rake doc:app
When you submit patches, the project maintainer has to read them and understand them. This is difficult enough at the best of times, and misunderstanding patches can lead to them being more difficult to merge. To help with this, when submitting you should:
When writing commit messages please try and stick to the same style as other commits, namely:
For simple commits the one line summary is often enough and the body of the commit message can be left out.
If you have forked on GitHub then the best way to submit your patches is to push your changes back to GitHub and then send a "pull request" on GitHub.
Otherwise you should either push your changes to a publicly visible git repository
and send the details to the rails-dev
list or generate patches with git format-patch
and send them to the
rails-dev list.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。