Skip to content

Commit e0c1d9d

Browse files
author
Mike Taylor
authored
Merge pull request #1351 from /issues/1314/1
Fixes #1314 - CONTRIBUTING Guidelines cleanup
2 parents 80a65ea + 0ca7d84 commit e0c1d9d

File tree

2 files changed

+61
-27
lines changed

2 files changed

+61
-27
lines changed

CONTRIBUTING.md

+57-25
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ project.
8080

8181
## Submission Guidelines
8282

83-
All code contributions should come in the form of a [pull request](https://help.github.com/articles/creating-a-pull-request), as a topic branch.
83+
All code contributions should come in the form of a pull request, as a topic branch.
8484

8585
1. Have a quick search through existing issues and pull requests so you don't waste any of your time.
8686

@@ -94,31 +94,57 @@ All code contributions should come in the form of a [pull request](https://help.
9494

9595
4. Make your changes in a new branch
9696

97-
`git checkout -b name-of-fix-branch`
97+
```bash
98+
99+
# makes sure, you are on the master branch
100+
git checkout master
101+
102+
# if you are SURE your fork is up-to-date
103+
git pull origin master
104+
105+
# OR
106+
# if you are NOT SURE your fork is up-to-date
107+
git pull upstream master
108+
109+
# creates new branch
110+
git checkout -b issues/NumberOfIssue/VersionOfPR
111+
```
98112

99113
5. Create your patch; commit your changes. Referencing the issue number you're working on from the message is recommended.
100-
101-
`git commit -m 'Issue #123 - Fixes broken layout on mobile browsers'`
102-
114+
> Note: Please keep the title under 50 chars. If you'd like to provide more information, just add the details to the commit body.
115+
116+
```bash
117+
# check for changed files
118+
git status
119+
120+
# add files to commit, e.g. as following
121+
git add file.js foldername/foldername2/file2.js
122+
123+
# add commit message including issue number
124+
git commit -m 'Issue #NumberOfIssue - Fixes broken layout on mobile browsers'
125+
126+
```
127+
103128
6. Push your branch to GitHub:
104129

105-
`git push origin name-of-fix-branch`
130+
`git push origin issues/NumberOfIssue/VersionOfPR`
106131

107132
7. If you want to discuss your code or ask questions, please comment in the corresponding issue. You can link to the code you have pushed to your repository to ask for code review.
108133

109-
8. When your code is ready to be integrated into the project, use the GitHub site to send a pull request to `webcompat.com:master`, aka the master branch of the repo you forked from. This will be the default choice.
134+
8. When your code is ready to be integrated into the project, use the GitHub site to send a [pull request](https://help.github.com/articles/creating-a-pull-request) to `webcompat.com:master`, aka the master branch of the repo you forked from. This will be the default choice.
110135

111136
![master](https://cldup.com/YVlLDGItPf-3000x3000.png)
112137

113-
9. Set the title of the pull request to reference the issue number.
138+
9. Set the title of the pull request to reference the issue number. Please keep the title short, but descriptive or it will be cut off. You can provide further information in the commit body.
114139

115-
`Fixes #123 - Fixes broken layout on mobile browsers`
140+
`Fixes #NumberOfIssue - Fixes broken layout on mobile browsers`
141+
> Note: `Fix` or `Fixes` are keywords recognized automatically and will close the issue when the pull request gets merged.
116142

117143
10. When sending the pull request do not forget to call out someone for review by using the following convention:
118144

119145
`r? @miketaylr`
120146

121-
This will notify the person that your request is waiting for a review for merging. Ask a review only by one person, this will avoid misunderstandings and the ball is dropped. (Python: karlcow, miketaylr. JavaScript: magsout, miketaylr, tagawa CSS: magsout).
147+
This will notify the person that your request is waiting for a review for merging. Ask a review only by one person, this will avoid misunderstandings and the ball is dropped. (Python: karlcow, miketaylr. JavaScript: magsout, miketaylr, tagawa, zoepage CSS: magsout, zoepage).
122148

123149
11. Continue discussion in the pull request.
124150

@@ -247,11 +273,13 @@ cd webcompat.com
247273
# check out submodules
248274
npm run module
249275
# initializing project
250-
[sudo] npm run setup
276+
npm run setup
251277
```
252278

253279
**Note**: if you got an error message, you may need to [install pip](#installing-pip) before running `make install` again.
254280

281+
**Note**: if you get an error message about missing rights to install the setup through npm, please *do not run `sudo npm`*. You just need to [fix you permissions](https://coderwall.com/p/t2mc9g/don-t-sudo-npm) for `usr/local`.
282+
255283
### Detailed setup (All platforms)
256284
#### Installing pip
257285

@@ -309,14 +337,14 @@ pip install -r config/requirements.txt
309337
310338
We use [Grunt](http://gruntjs.com/) as a task runner to perform certain tasks (minify + concat JS assets, for example). You need to have [Node.js](https://nodejs.org/en/download/) installed to be able to run Grunt. Once that's done, `npm` can be used to install Grunt and other build dependencies.
311339
312-
First install the `grunt-cli` tool:
313340
314341
``` bash
315-
[sudo] npm install -g grunt-cli
316-
[sudo] npm install
317-
grunt
342+
npm install
343+
npm run build
318344
```
319345
346+
**Note**: if you get an error message about missing rights to install the setup through npm, please *do not run `sudo npm`*. You just need to [fix you permissions](https://coderwall.com/p/t2mc9g/don-t-sudo-npm) for `usr/local`.
347+
320348
### Configuring The Server
321349
322350
To test issue submission, you need to create a repository on GitHub. Create a new repository make note of the name. For example, the user `miketaylr` has created a repository called "[test-repo](https://github.com/miketaylr/test-repo)" for this purpose.
@@ -337,19 +365,23 @@ You can now edit `secrets.py` and
337365
338366
2. You have the option of creating a "bot account" (a dummy account for the purpose of testing), or using your own account for local development. Either way, you'll need a personal access token to proceed — this is the oauth token we use to report issues on behalf of people who don't want to give GitHub oauth access (or don't have GitHub accounts).
339367
340-
The [instructions for creating a personal access token](http://help.github.com/articles/creating-an-access-token-for-command-line-use) are given on GitHub. Select public_repo to grant access to the public repositories through the personal access token. Once you have created the token you can add it in the variable `OAUTH_TOKEN = ""` (yes, even if you're using your own credentials we still refer to it as a bot). More advanced users might want to create an environment variable called `OAUTH_TOKEN`. Either way is fine.
368+
The [instructions for creating a personal access token](http://help.github.com/articles/creating-an-access-token-for-command-line-use) are given on GitHub. Select public_repo to grant access to the public repositories through the personal access token. Once you have created the token you can add it in the variable `OAUTH_TOKEN = ""`. More advanced users might want to create an environment variable called `OAUTH_TOKEN`. Either way is fine.
341369
342370
3. Add the client id and client secret to secrets.py. If you're part of the webcompat GitHub organization, you can [get the client id and client secret from GitHub](https://github.com/organizations/webcompat/settings/applications/). Otherwise, create your own test and production applications ([instructions here](https://github.com/settings/applications/new)) — when prompted for a "Authorization callback URL", use `http://localhost:5000/callback`,(Cloud 9 users should use `http://yourapp.c9users.io:8000/callback`instead) and take note of the client id and client secret GitHub gives you.
343371
344-
When you have the client id and client secret put them in the corresponding lines in secrets.py for the localhost application:
372+
When you have the client id and client secret put them in the corresponding lines in secrets.py for the localhost application:
345373
346-
```
347-
# We're running on localhost, use the test application
348-
GITHUB_CLIENT_ID = os.environ.get('FAKE_ID') or "<client id goes here>"
349-
GITHUB_CLIENT_SECRET = os.environ.get('FAKE_SECRET') or "<client secret goes here>"
350-
```
374+
```
375+
# We're running on localhost, use the test application
376+
GITHUB_CLIENT_ID = os.environ.get('FAKE_ID') or "<client id goes here>"
377+
GITHUB_CLIENT_SECRET = os.environ.get('FAKE_SECRET') or "<client secret goes here>"
378+
```
379+
380+
> Note: You can ignore the `FAKE_ID` and `FAKE_SECRET` environment variables, we use that as a hack for automated tests.
381+
382+
4. Click on login to authorize the application and get access to the issues.
383+
![Login](https://cldup.com/HHtMlPhAod.png)
351384
352-
> Note: You can ignore the `FAKE_ID` and `FAKE_SECRET` environment variables, we use that as a hack for automated tests.
353385
354386
> **Note**: If you get a 404 at GitHub when clicking "Login", it means you haven't filled in the `GITHUB_CLIENT_ID` or `GITHUB_CLIENT_SECRET` in secrets.py.
355387
@@ -375,7 +407,7 @@ You should now have a local instance of the site running at `http://localhost:50
375407
376408
After certain kinds of changes are made, you need to build the project before serving it from a webserver will work
377409
378-
* CSS: a build will run cssnext, combine custom media queries, and concat all source files into webcompat.dev.css. You'll need to re-build the CSS to see any changes, so it's recommended to use a watch task (see `make watch` or `grunt watch`).
410+
* CSS: a build will run cssnext, combine custom media queries, and concat all source files into webcompat.dev.css. You'll need to re-build the CSS to see any changes, so it's recommended to use a watch task (see `npm run watch`).
379411
* JS: a build will run eslint, minify and concat source files.
380412
* HTML templates: the changes should be served from disk without the need for rebuilding
381413
* Python: the Flask local server will detect changes and restart automatically. No need to re-build.
@@ -415,7 +447,7 @@ Fixing static JS files with project coding styles, if an error occurs.
415447
npm run fix
416448
```
417449
418-
By default, a build will *not* optimize images (which is done before deploys). If you'd like to optimize images, you can run `grunt imagemin`.
450+
By default, a build will *not* optimize images (which is done before deploys). If you'd like to optimize images, you can run `npm run imagemin`.
419451
420452
## Running Tests
421453

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"eslint": "^3.4.0",
2222
"grunt": "~0.4.5",
2323
"grunt-check-dependencies": "~0.9.0",
24+
"grunt-cli": "^1.2.0",
2425
"grunt-contrib-concat": "~0.3.0",
2526
"grunt-contrib-cssmin": "~0.9.0",
2627
"grunt-contrib-imagemin": "~1.0.0",
@@ -40,13 +41,14 @@
4041
},
4142
"scripts": {
4243
"setup": "npm run module && npm run virtualenv && npm install && npm run config",
43-
"watch" : "grunt watch",
44+
"watch": "grunt watch",
4445
"build": "grunt",
4546
"lint": "eslint ./Gruntfile.js ./tests ./grunt-tasks ./webcompat/static/js/lib",
4647
"fix": "eslint --fix ./Gruntfile.js ./tests ./grunt-tasks ./webcompat/static/js/lib",
48+
"imagemin":"grunt imagemin",
4749
"module": "git submodule init && git submodule update",
4850
"start": "source env/bin/activate && python run.py",
49-
"virtualenv" : "pip install virtualenv && virtualenv env && source env/bin/activate && npm run pip",
51+
"virtualenv": "pip install virtualenv && virtualenv env && source env/bin/activate && npm run pip",
5052
"pip": "pip install -r config/requirements.txt",
5153
"config": "cp config/secrets.py.example config/secrets.py",
5254
"project-update": "pip install --upgrade pip && npm run backend-install && npm update"

0 commit comments

Comments
 (0)