| 1 | == Contribution Guide == |
| 2 | |
| 3 | === Getting the source === |
| 4 | From github: |
| 5 | {{{ |
| 6 | git clone https://github.com/mytestbed/omf.git |
| 7 | }}} |
| 8 | |
| 9 | === Modifying the source === |
| 10 | Feel free to modify the code, fix a bug, add a feature, correct a typo in documentation, no contribution is too small. We do have some guidelines, and we do appreciate if you could follow them. |
| 11 | |
| 12 | === Readable code === |
| 13 | The following ruby coding style will be used: https://github.com/bbatsov/ruby-style-guide |
| 14 | |
| 15 | ''NO TRAILING WHITE SPACES'' |
| 16 | |
| 17 | Please make sure your files do not contain trailing white spaces. Most editors and IDEs can be configured to do it automatically. |
| 18 | |
| 19 | If you got existing code that could contain trailing white spaces, simply run this command in root directory of the project: |
| 20 | {{{ |
| 21 | find . -not \( -name .git -prune \) -type f -print0 | xargs -0 sed -i "s/[[:space:]]*$//" |
| 22 | }}} |
| 23 | and then commit the change. |
| 24 | |
| 25 | === Semantic versioning === |
| 26 | Choose git tag name according to semantic versioning rules: http://semver.org/ |
| 27 | |
| 28 | === Useful documentation === |
| 29 | Yard is used for auto generating OMF code documentation. Refer to [http://yardoc.org/guides/index.html this guide] for details. |
| 30 | |
| 31 | === Meaningful commit message === |
| 32 | Please provide a meaningful commit message for each commit. |
| 33 | |
| 34 | The commit message should be formatted properly: |
| 35 | {{{ |
| 36 | Capitalized, short (50 chars or less) summary |
| 37 | |
| 38 | More detailed explanatory text, if necessary. |
| 39 | In some contexts, the first line is treated as the subject of an email and the rest of the text as the body. |
| 40 | The blank line separating the summary from the body is critical (unless you omit the body entirely); |
| 41 | tools like rebase can get confused if you run the two together. |
| 42 | }}} |
| 43 | You could modify commit message if you realised you made a mistake after committed. |
| 44 | {{{ |
| 45 | git commit --amend |
| 46 | }}} |
| 47 | |
| 48 | === Test your changes === |
| 49 | We are using MiniTest as our unit testing framework, and the integration with Travis CI & Jenkins allows these tests & gem package builds to be executed upon every single commit made. |
| 50 | |
| 51 | You can examine test folder under components to find out how test files are organised. |
| 52 | |
| 53 | You can execute these tests manually by issuing rake command inside components directory. For example: |
| 54 | {{{ |
| 55 | cd omf_common; rake |
| 56 | }}} |
| 57 | For more information regarding MiniTest, please go to the official site: |
| 58 | |
| 59 | https://github.com/seattlerb/minitest |
| 60 | |
| 61 | Eventmachine in minitest |
| 62 | |
| 63 | To test asynchronous eventmachine based code, refer to this minitest pluging: |
| 64 | |
| 65 | https://github.com/phiggins/em-minitest-spec |
| 66 | |
| 67 | Sign your commit |
| 68 | You could sign your commit & tag using -s option in git. |
| 69 | |
| 70 | git commit -s |
| 71 | git tag -s |
| 72 | Share your change |
| 73 | Your changes & hacks made locally could be useful for other OMF users and OMF project in general. Please share your changes with us. |
| 74 | |
| 75 | Using git |
| 76 | This git tutorial will give you plenty of tips to get started if you need some help regarding git. |
| 77 | |
| 78 | http://schacon.github.com/git/gittutorial.html |
| 79 | |
| 80 | Set up git identity |
| 81 | If you want to contribute your changes to us, please configure your Git environment, with at least your name and a valid email address, so we can properly acknowledge your work when integrating your commits. You can do it with: |
| 82 | |
| 83 | git config --global user.name "your name" |
| 84 | git config --global user.email "your email address" |
| 85 | See git config -h for all options. |
| 86 | |
| 87 | The @--global@ sets these parameters for all your Git repos. You can limit this to the current repo by removing this option. |
| 88 | |
| 89 | These options could also be set up via editing .gitconfig file. |
| 90 | |
| 91 | Announce your changes |
| 92 | When you are satisfied with your changes, you can provide them to us so we can review them and integrate them into the main tree. |
| 93 | |
| 94 | Please create an issue in our issue tracking system http://mytestbed.net/projects/omf/issues so it can tracked. |
| 95 | |
| 96 | Then you have these options to provide us the access to your changes |
| 97 | |
| 98 | Prepare a git patch and send it to omf-user@lists.nicta.com.au. |
| 99 | Prepare a git patch and attach to the issue you created. |
| 100 | Send a pull request to omf-user@lists.nicta.com.au. |
| 101 | Send a email to omf-user@lists.nicta.com.au, or simply in the issue you created, provide how we can access your own repository and pull the commits you made. (if you fork OMF via github, your forked repository should be public accessible) |
| 102 | Patch creation |
| 103 | The first two options need you to create patches from the Git branch containing your changes. |
| 104 | |
| 105 | The best way to do this is with git format-patch to have export them in a suitable format: |
| 106 | |
| 107 | git format-patch origin/master..HEAD # Assuming you started working from origin/master |
| 108 | Pull request |
| 109 | If your repository is publicly accessible (_e.g., on a server with anonymous read access or GitHub_), you can also send us a pull request, using git request-pull. |
| 110 | |
| 111 | git request-pull origin/master http://url/of/repo # Assuming you started working from origin/master |
| 112 | Manage your own repository |
| 113 | The flexibility of new OMF design means that you could develop your own resource proxy to meet certain specific needs, which might not be needed as part of core OMF system. For example omf_rc_openflow, a plugin which extends OMF to provide a set of Openflow related functionality, has been set up as a separate git repository, managed by its maintainer, and released regularly via rubygems. |
| 114 | |
| 115 | Please consider the following: |
| 116 | |
| 117 | Start such repository only if you think it won't be necessary for OMF core system to include such features. |
| 118 | Once your plugin is stable enough, we can include your plugin as part of the official OMF release guide. |
| 119 | Follow the same guidelines as modifying OMF code when come to code quality control. |
| 120 | If your project seems to be short lived (as part of your study, for example), please notify us for the necessary shift of the ownership, simply, do not throw anything, they might still be useful for the us. |
| 121 | Gem creation and release |
| 122 | If you are not familiar with ruby's package system, this official guide http://guides.rubygems.org/ will certainly help. We provide a gem skeleton for you to start with: |
| 123 | |
| 124 | https://github.com/jackhong/omf |
| 125 | |
| 126 | Also, omf_rc_openflow gem mentioned earlier will be a good place to visit. |