Skip to content

Commit 5738b69

Browse files
committed
Merge pull request #53 from graphql-python/docs
Docs. Fixed #19
2 parents 7340d80 + 1dc8b73 commit 5738b69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+7161
-11
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,14 @@ target/
6161

6262

6363
/tests/django.sqlite
64+
65+
/graphene/index.json
66+
/graphene/meta.json
67+
68+
/meta.json
69+
/index.json
70+
71+
/docs/playground/graphene-js/pypyjs-release-nojit/
72+
/docs/static/playground/lib
73+
74+
/docs/static/playground

.travis.yml

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,79 @@ python:
66
- 3.4
77
- 3.5
88
- pypy
9-
cache: pip
9+
cache:
10+
directories:
11+
- .cache/pip/
12+
- $HOME/.cache/pip
13+
- docs/node_modules/
14+
- $HOME/docs/node_modules
15+
before_install:
16+
- |
17+
if [ "$TEST_TYPE" != build_website ] && \
18+
! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs))/'
19+
then
20+
echo "Only docs were updated, stopping build process."
21+
exit
22+
fi
1023
install:
11-
- pip install --cache-dir $HOME/.cache/pip pytest pytest-cov coveralls flake8 six blinker pytest-django
12-
- pip install --cache-dir $HOME/.cache/pip -e .[django]
13-
- python setup.py develop
24+
- |
25+
if [ "$TEST_TYPE" = build ]; then
26+
pip install --download-cache $HOME/.cache/pip/ pytest pytest-cov coveralls six pytest-django
27+
pip install --download-cache $HOME/.cache/pip/ -e .[django]
28+
python setup.py develop
29+
elif [ "$TEST_TYPE" = build_website ]; then
30+
pip install --download-cache $HOME/.cache/pip/ -e .
31+
python setup.py develop
32+
elif [ "$TEST_TYPE" = lint ]; then
33+
pip install --download-cache $HOME/.cache/pip/ flake8
34+
fi
1435
script:
15-
- py.test --cov=graphene
16-
- flake8
36+
- |
37+
if [ "$TEST_TYPE" = build_website ]; then
38+
if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
39+
echo "Building the web."
40+
nvm install 4.0
41+
42+
GH_PAGES_DIR="$TRAVIS_BUILD_DIR"/docs/public
43+
git config --global user.name "Travis CI"
44+
git config --global user.email "[email protected]"
45+
git clone --branch gh-pages --depth=50 \
46+
https://[email protected]/graphql-python/graphene.git \
47+
$GH_PAGES_DIR
48+
cd docs
49+
./playground/graphene-js/build.sh
50+
npm run deploy
51+
cd $GH_PAGES_DIR
52+
git status
53+
git add --intent-to-add .
54+
if ! git diff-index --quiet HEAD --; then
55+
git add -A .
56+
git commit -m "Rebuild website"
57+
git push "https://${GITHUB_TOKEN}@github.com/graphql-python/graphene.git" gh-pages
58+
fi
59+
exit
60+
fi
61+
elif [ "$TEST_TYPE" = lint ]; then
62+
echo "Checking Python code lint."
63+
flake8
64+
exit
65+
elif [ "$TEST_TYPE" = build ]; then
66+
py.test --cov=graphene
67+
fi
1768
after_success:
18-
- coveralls
69+
- |
70+
if [ "$TEST_TYPE" = build ]; then
71+
coveralls
72+
fi
73+
env:
74+
matrix:
75+
- TEST_TYPE=build
76+
global:
77+
secure: SQC0eCWCWw8bZxbLE8vQn+UjJOp3Z1m779s9SMK3lCLwJxro/VCLBZ7hj4xsrq1MtcFO2U2Kqf068symw4Hr/0amYI3HFTCFiwXAC3PAKXeURca03eNO2heku+FtnQcOjBanExTsIBQRLDXMOaUkf3MIztpLJ4LHqMfUupKmw9YSB0v40jDbSN8khBnndFykmOnVVHznFp8USoN5F0CiPpnfEvHnJkaX76lNf7Kc9XNShBTTtJsnsHMhuYQeInt0vg9HSjoIYC38Tv2hmMj1myNdzyrHF+LgRjI6ceGi50ApAnGepXC/DNRhXROfECKez+LON/ZSqBGdJhUILqC8A4WmWmIjNcwitVFp3JGBqO7LULS0BI96EtSLe8rD1rkkdTbjivajkbykM1Q0Tnmg1adzGwLxRUbTq9tJQlTTkHBCuXIkpKb1mAtb/TY7A6BqfnPi2xTc/++qEawUG7ePhscdTj0IBrUfZsUNUYZqD8E8XbSWKIuS3SHE+cZ+s/kdAsm4q+FFAlpZKOYGxIkwvgyfu4/Plfol4b7X6iAP9J3r1Kv0DgBVFst5CXEwzZs19/g0CgokQbCXf1N+xeNnUELl6/fImaR3RKP22EaABoil4z8vzl4EqxqVoH1nfhE+WlpryXsuSaF/1R+WklR7aQ1FwoCk8V8HxM2zrj4tI8k=
78+
matrix:
79+
fast_finish: true
80+
include:
81+
- python: '2.7'
82+
env: TEST_TYPE=build_website
83+
- python: '2.7'
84+
env: TEST_TYPE=lint

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ![Graphene Logo](http://graphene-python.org/favicon.png) [Graphene](http://graphene-python.org) [![Build Status](https://travis-ci.org/graphql-python/graphene.svg?branch=master)](https://travis-ci.org/graphql-python/graphene) [![PyPI version](https://badge.fury.io/py/graphene.svg)](https://badge.fury.io/py/graphene) [![Coverage Status](https://coveralls.io/repos/graphql-python/graphene/badge.svg?branch=master&service=github)](https://coveralls.io/github/graphql-python/graphene?branch=master)
22

33

4-
Graphene is a Python library for building GraphQL schemas/types fast and easily.
4+
[Graphene](http://graphene-python.org) is a Python library for building GraphQL schemas/types fast and easily.
55

66
- **Easy to use:** Graphene helps you use GraphQL in Python without effort.
77
- **Relay:** Graphene has builtin support for Relay
@@ -10,6 +10,7 @@ Graphene is a Python library for building GraphQL schemas/types fast and easily.
1010

1111
*What is supported in this Python version?* **Everything**: Interfaces, ObjectTypes, Scalars, Unions and Relay (Nodes, Connections), in addition to queries, mutations and subscriptions.
1212

13+
**NEW**!: [Try graphene online](http://graphene-python.org/playground/)
1314

1415
## Installation
1516

README.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
|Graphene Logo| `Graphene <http://graphene-python.org>`__ |Build Status| |PyPI version| |Coverage Status|
22
=========================================================================================================
33

4-
Graphene is a Python library for building GraphQL schemas/types fast and
5-
easily.
4+
`Graphene <http://graphene-python.org>`__ is a Python library for
5+
building GraphQL schemas/types fast and easily.
66

77
- **Easy to use:** Graphene helps you use GraphQL in Python without
88
effort.
@@ -16,6 +16,9 @@ easily.
1616
ObjectTypes, Scalars, Unions and Relay (Nodes, Connections), in addition
1717
to queries, mutations and subscriptions.
1818

19+
**NEW**!: `Try graphene
20+
online <http://graphene-python.org/playground/>`__
21+
1922
Installation
2023
------------
2124

docs/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"stage": 0
3+
}

docs/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+
node_modules
28+
29+
public/

docs/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Graphene Docs
2+
3+
Graphene docs are powered by [gatsby](https://github.com/gatsbyjs/gatsby).
4+
5+
6+
## Installation
7+
8+
For running locally this docs. You have to execute
9+
```bash
10+
npm install -g gatsby && npm install
11+
```
12+
13+
And then
14+
15+
```bash
16+
gatsby develop
17+
```
18+
19+
## Playground
20+
21+
If you want to have the playground running too, just execute
22+
23+
```
24+
./playground/graphene-js/build.sh
25+
```
26+
27+
This command will clone the [pypyjs-release-nojit](https://github.com/pypyjs/pypyjs-release-nojit) repo, update it with the latest graphene, graphql-core and graphql-relay code, and make it available for the `/playground` view in the docs.
28+
29+
30+
## Build
31+
32+
For building the docs into the `public` dir, just run:
33+
34+
```bash
35+
npm run build
36+
```
37+
38+
39+
## Automation
40+
41+
Thanks to [Travis](https://github.com/graphql-python/graphene/blob/master/.travis.yml#L39-L58), we automated the way documentation is updated in the `gh-pages` branch.
42+
43+
Each time we modify the docs in the `master` branch the travis job runs and updates the `gh-pages` branch with the latest code, so [Graphene's website](http://graphene-python.org) have always the latest docs.

docs/app.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
exports.loadContext = function(callback) {
2+
var context;
3+
context = require.context('./pages', true);
4+
if (module.hot) {
5+
module.hot.accept(context.id, function() {
6+
context = require.context('./pages', true);
7+
return callback(context);
8+
});
9+
}
10+
return callback(context);
11+
};
12+
13+
exports.onRouteChange = function(state) {
14+
if (typeof window !== "undefined" && window.ga) {
15+
window.ga('send', 'pageview', {
16+
page: state.pathname
17+
});
18+
}
19+
}

docs/assets/icon.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
3+
export default class Icon extends React.Component {
4+
render() {
5+
return <span {...this.props} src={null} dangerouslySetInnerHTML={{__html:this.props.src}} />
6+
}
7+
}

docs/assets/logo.svg

Lines changed: 10 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)