Skip to content
This repository has been archived by the owner on Nov 1, 2017. It is now read-only.

Commit

Permalink
Sync changes from upstream repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Hubot committed Jul 14, 2016
1 parent 86a03bf commit 53a38f9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
8 changes: 3 additions & 5 deletions README.md
Expand Up @@ -48,15 +48,13 @@ Nanoc has [some nice documentation](http://nanoc.ws/docs/tutorial/) to get you s

### Enterprise

To generate the `/enterprise/` versions, use `script/enterprise-backport`:
To generate the `/enterprise` versions, pass in the Enterprise version to `script/server`. For example:

``` sh
$ script/enterprise-backport 2.6
$ mv -f enterprise output
$ script/server
$ script/server 2.6
```

The above will need to be repeated anytime changes are made to `/enterprise` versioned documentation.
Note that live reloading is not available for Enterprise documentation.

## Styleguide

Expand Down
14 changes: 12 additions & 2 deletions content/v3.md
Expand Up @@ -32,9 +32,11 @@ $ curl -i {{ site.data.variables.product.api_url_pre }}/users/octocat/orgs
> Status: 200 OK
> ETag: "a00049ba79152d03380c34652f2cb612"
> X-GitHub-Media-Type: github.v3
{% if page.version == 'dotcom' %}
> X-RateLimit-Limit: 5000
> X-RateLimit-Remaining: 4987
> X-RateLimit-Reset: 1350085394
{% endif %}
> Content-Length: 5
> Cache-Control: max-age=0, private, must-revalidate
> X-Content-Type-Options: nosniff
Expand Down Expand Up @@ -504,9 +506,11 @@ $ curl -i {{ site.data.variables.product.api_url_pre }}/user
> Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
> Status: 200 OK
> Vary: Accept, Authorization, Cookie
{% if page.version == 'dotcom' %}
> X-RateLimit-Limit: 5000
> X-RateLimit-Remaining: 4996
> X-RateLimit-Reset: 1372700873
{% endif %}
$ curl -i {{ site.data.variables.product.api_url_pre }}/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"'
> HTTP/1.1 304 Not Modified
Expand All @@ -515,19 +519,23 @@ $ curl -i {{ site.data.variables.product.api_url_pre }}/user -H 'If-None-Match:
> Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
> Status: 304 Not Modified
> Vary: Accept, Authorization, Cookie
{% if page.version == 'dotcom' %}
> X-RateLimit-Limit: 5000
> X-RateLimit-Remaining: 4996
> X-RateLimit-Reset: 1372700873
{% endif %}
$ curl -i {{ site.data.variables.product.api_url_pre }}/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT"
> HTTP/1.1 304 Not Modified
> Cache-Control: private, max-age=60
> Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
> Status: 304 Not Modified
> Vary: Accept, Authorization, Cookie
{% if page.version == 'dotcom' %}
> X-RateLimit-Limit: 5000
> X-RateLimit-Remaining: 4996
> X-RateLimit-Reset: 1372700873
{% endif %}
```

## Cross Origin Resource Sharing
Expand All @@ -545,7 +553,7 @@ Here's a sample request sent from a browser hitting
$ curl -i {{ site.data.variables.product.api_url_pre }} -H "Origin: http://example.com"
HTTP/1.1 302 Found
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, {% if page.version == 'dotcom' %}X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,{% endif %} X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Credentials: true
```

Expand All @@ -557,7 +565,7 @@ HTTP/1.1 204 No Content
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-GitHub-OTP, X-Requested-With
Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, {% if page.version == 'dotcom' %}X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,{% endif %} X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Max-Age: 86400
Access-Control-Allow-Credentials: true
```
Expand All @@ -576,9 +584,11 @@ $ curl https://api.github.com?callback=foo
> /**/foo({
> "meta": {
> "status": 200,
{% if page.version == 'dotcom' %}
> "X-RateLimit-Limit": "5000",
> "X-RateLimit-Remaining": "4966",
> "X-RateLimit-Reset": "1372700873",
{% endif %}
> "Link": [ // pagination headers and other links
> ["https://api.github.com?page=2", {"rel": "next"}]
> ]
Expand Down
8 changes: 4 additions & 4 deletions content/v3/search.md
Expand Up @@ -97,7 +97,7 @@ repositories where the primary language is Assembly. We're sorting by stars in
descending order, so that the most popular repositories appear first in the
search results.

<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %>
<%= headers 200, {:pagination => default_pagination_rels{% if page.version == 'dotcom' %}, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %>
<%= json(:repo_search_v3_results) %>

### Highlighting Repository Search Results
Expand Down Expand Up @@ -186,7 +186,7 @@ Here, we're searching for the keyword `addClass` within a file's contents. We're
making sure that we're only looking in files where the language is JavaScript.
And we're scoping the search to the `repo:jquery/jquery` repository.

<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %>
<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %>
<%= json(:code_search_v3_results) %>

### Highlighting Code Search Results
Expand Down Expand Up @@ -289,7 +289,7 @@ that's labeled as `bug`. The search runs across repositories whose primary
language is Python. We’re sorting by creation date in ascending order, so that
the oldest issues appear first in the search results.

<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %>
<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %>
<%= json(:issue_search_v3_results) %>

### Highlighting Issue Search Results
Expand Down Expand Up @@ -361,7 +361,7 @@ Imagine you're looking for a list of popular users. You might try out this query
Here, we're looking at users with the name Tom. We're only interested in those
with more than 42 repositories, and only if they have over 1,000 followers.

<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %>
<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %>
<%= json(:user_search_v3_results) %>

### Highlighting User Search Results
Expand Down
6 changes: 4 additions & 2 deletions lib/resources.rb
Expand Up @@ -67,8 +67,10 @@ def headers(status, head = {})
end
end

lines << "X-RateLimit-Limit: 5000" unless head.has_key?('X-RateLimit-Limit')
lines << "X-RateLimit-Remaining: 4999" unless head.has_key?('X-RateLimit-Remaining')
unless @config[:version] != 'dotcom'
lines << "X-RateLimit-Limit: 5000" unless head.has_key?('X-RateLimit-Limit')
lines << "X-RateLimit-Remaining: 4999" unless head.has_key?('X-RateLimit-Remaining')
end

%(``` headers\n#{lines.join("\n")}\n```\n)
end
Expand Down
10 changes: 9 additions & 1 deletion script/server
Expand Up @@ -3,4 +3,12 @@
ulimit -n 2048

script/bootstrap
DEV_MODE=true npm run gulp

if [ -z "$1" ]
then
DEV_MODE=true npm run gulp
else
script/enterprise-backport $1
mv -f enterprise output
npm run gulp server
fi

0 comments on commit 53a38f9

Please sign in to comment.