diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad8a8464..ced2f416 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,35 +1,148 @@ -# How to contribute +# Contributing to the Node.js Client API -We welcome contributions from the community. If you have a patch that you'd -like us to consider, please do the following: +The MarkLogic Node.js Client API welcomes new contributors. This document will guide you +through the process. -* Provide a signed -[Contributor License Agreement](http://developer.marklogic.com/products/cla). + - [Question or Problem?](#question) + - [Issues and Bugs](#issue) + - [Feature Requests](#feature) + - [Submission Guidelines](#submit) + +## Have a Question or Problem? -* Create an issue for the fix or enhancement. +If you have questions about how to use the Node.js Client API, you can ask on +[StackOverflow](http://stackoverflow.com/tags/marklogic), tagging the question +with MarkLogic. - For a bug, clearly describe the steps to reproduce the problem and the - earliest version that exhibits the problem. For an enhancement, make sure - you have basic agreement about the fix or enhancement. +## Found an Issue? +If you find a bug in the source code or a mistake in the documentation, you can help us by +submitting an issue to our [GitHub Issue Tracker](https://github.com/marklogic/node-client-api/issues). Even better +you can submit a Pull Request with a fix for the issue you filed. -* [Fork the API repository](https://github.com/marklogic/node-client-api/fork) in your repository on GitHub. +## Want a Feature? +You can request a new feature by submitting an issue to our [GitHub Issue Tracker](https://github.com/marklogic/node-client-api/issues). If you would like to implement a new feature, first create a new issue and discuss it with one of our project +maintainers. -* Create a branch based on the `master` branch or (if you are in the Early -Access program) on the `develop` branch. +## Submission Guidelines -* Implement the fix or enhancement. +### Submitting an Issue +If your issue appears to be a bug, and hasn’t been reported, open a new issue. +Providing the following information will increase the chances of your issue being dealt with quickly: - As with other projects, you should include unit tests using the same test - harness (at present, [Mocha](http://visionmedia.github.io/mocha/) and [should](https://github.com/visionmedia/should.js/)). Follow the same style conventions - as existing code. Run jshint on the changes. Create jsdoc for any new - interfaces. (See the gulp tasks for a convenient way to run jshint.) - Run all of the tests to make sure the change doesn't have side effects. +* **Overview of the Issue** - If an error is being thrown a stack trace helps +* **Motivation for or Use Case** - Explain why this is a bug for you +* **Environment** - Which [version of MarkLogic](https://docs.marklogic.com/xdmp.version)? Which version of the Node.js Client API? Mac, Windows, Linux? Details help. +* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point +to what might be causing the problem (line of code or commit) -* Commit in one or more logical units with clear messages. +### Submitting a Pull Request -* Push to the branch in your fork. +A pull request is the standard way to submit changes to a repository to which you don’t have commit privileges. GitHub provides a nice UI for viewing, discussing, and merging pull requests. -* Create a pull request from your fork and add a comment to the issue. +#### Fill in the CLA - The team will then review the changes and possibly suggest improvements - or alternatives. +Before we can accept your pull request, you need to sign a [Contributor License Agreement](http://developer.marklogic.com/products/cla). + +#### Fork the Node.js Client API + +Fork the project [on GitHub](https://github.com/marklogic/node-client-api/fork) +and clone your copy. + + $ git clone git@github.com:username/node-client-api.git + $ cd node-client-api + $ git remote add upstream git://github.com/marklogic/node-client-api.git + +All bug fixes and new features go into the `develop` branch. + +We ask that you open an issue in the [issue tracker](https://github.com/marklogic/node-client-api/issues) and get agreement from at least one of the project maintainers before you start coding. + +Nothing is more frustrating than seeing your hard work go to waste because your vision does not align with that of a project maintainer. + +#### Create a branch for your changes + +Okay, so you have decided to fix something. Create a feature branch and start hacking: + + $ git checkout -b issue/123 -t origin/dev + +In this case, the branch name, `issue/123`, references the fact that your changes address the issue (#123) that you just filed. Replace the `123` with your issue number. This naming convention is not required, but is generally helpful in navigating your branches. + +#### Commit your changes + +Make sure git knows your name and email address: + + $ git config --global user.name "J. Random User" + $ git config --global user.email "j.random.user@example.com" + +Writing good commit logs is important. A commit log should describe what changed and why. Follow these guidelines when writing one: + +1. The first line should be 50 characters or less and contain a short description of the change including the Issue number prefixed by a hash (`#`). +2. Keep the second line blank. +3. Wrap all other lines at 72 columns. + +A good commit log looks like this: + +``` +Fixes #123: Makes the whatchamajigger work in MarkLogic 8 + +Body of commit message is a few lines of text, explaining things +in more detail, possibly giving some background about the issue +being fixed, etc etc. + +The body of the commit message can be several paragraphs, and +please do proper word-wrap and keep columns shorter than about +72 characters or so. That way `git log` will show things +nicely even when it is indented. +``` + +The header line should be meaningful; it is what other people see when they +run `git shortlog` or `git log --oneline`. + +#### Rebase your repo + +Use `git rebase` (not `git merge`) to sync your work from time to time to make sure you don’t stray too far from the active development work. + + $ git fetch upstream + $ git rebase upstream/develop + +#### Test your code + +Be sure to run the tests before submitting your pull request. PRs with failing tests won’t be accepted. + + $ node etc/test-setup.js + $ mocha test-basic + $ node etc/test-teardown.js + +#### Push your changes + + $ git push origin issue/123 + +#### Submit the pull request + +Go to your fork (i.e. https://github.com/username/node-client-api) and select your feature branch. Click the “Pull Request” button and fill out the form. + +Pull requests are usually reviewed within a few days. If you get comments that need to be to addressed, apply your changes in a separate commit and push that to your feature branch. Post a comment in the pull request afterwards; GitHub does not send out notifications when you add commits to existing pull requests. + +That’s it. Thanks in advance for your contribution. + + +#### After your pull request is merged + +After your pull request is merged, you can safely delete your branch and pull +the changes from the main (upstream) repository: + +* Delete the remote branch on GitHub either through the GitHub web UI or your +local shell as follows: + + $ git push origin --delete issue/123 + +* Check out the dev branch: + + $ git checkout develop -f + +* Delete the local branch: + + $ git branch -D issue/123 + +* Update your dev with the latest upstream version: + + $ git pull --ff upstream develop diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..5c304d1a --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.