[refs #374] Add all jsons. Remove all unused data

This commit is contained in:
konstantin.grabar 2012-09-17 15:51:21 +04:00
parent 15ec2c2c90
commit 6a446c41a1
14 changed files with 586 additions and 2066 deletions

View File

@ -13,27 +13,6 @@
compile '/static/*' do
end
compile '/CNAME/' do
end
compile '/feed/' do
filter :erb
filter :kramdown
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
end
%w(v3 */).each do |version|
compile "/changes/#{version}" do
filter :erb
filter :kramdown
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout 'changes' if version[0] == '*'
layout 'default'
end
end
compile '*' do
filter :erb
filter :kramdown
@ -46,14 +25,6 @@ route '/static/*' do
item.identifier[7..-2]
end
route '/CNAME/' do
'/CNAME'
end
route '/feed' do
'/changes.atom'
end
route '*' do
item.identifier + 'index.html'
end

View File

@ -1,374 +0,0 @@
---
title: GitHub API v3
---
# API v3
This describes the resources that make up the official GitHub API v3. If
you have any problems or requests please contact
[support](mailto:support@github.com?subject=APIv3).
* <a href="#schema">Schema</a>
* <a href="#client-errors">Client Errors</a>
* <a href="#http-verbs">HTTP Verbs</a>
* <a href="#authentication">Authentication</a>
* <a href="#pagination">Pagination</a>
* <a href="#rate-limiting">Rate Limiting</a>
* <a href="#conditional-requests">Conditional Requests</a>
* <a href="#cross-origin-resource-sharing">Cross Origin Resource Sharing</a>
* <a href="#json-p-callbacks">JSON-P Callbacks</a>
## Schema
All API access is over HTTPS, and accessed from the `api.github.com`
domain (or through `yourdomain.com/api/v3/` for enterprise). All data is
sent and received as JSON.
<pre class="terminal">
$ curl -i https://api.github.com
HTTP/1.1 302 Found
Server: nginx/1.0.12
Date: Mon, 20 Feb 2012 11:15:49 GMT
Content-Type: text/html;charset=utf-8
Connection: keep-alive
Status: 302 Found
X-RateLimit-Limit: 5000
ETag: "d41d8cd98f00b204e9800998ecf8427e"
Location: http://developer.github.com
X-RateLimit-Remaining: 4999
Content-Length: 0
</pre>
Blank fields are included as `null` instead of being omitted.
All timestamps are returned in ISO 8601 format:
YYYY-MM-DDTHH:MM:SSZ
## Client Errors
There are three possible types of client errors on API calls that
receive request bodies:
1. Sending invalid JSON will result in a `400 Bad Request` response.
HTTP/1.1 400 Bad Request
Content-Length: 35
{"message":"Problems parsing JSON"}
2. Sending the wrong type of JSON values will result in a `400 Bad
Request` response.
HTTP/1.1 400 Bad Request
Content-Length: 40
{"message":"Body should be a JSON Hash"}
3. Sending invalid fields will result in a `422 Unprocessable Entity`
response.
HTTP/1.1 422 Unprocessable Entity
Content-Length: 149
{
"message": "Validation Failed",
"errors": [
{
"resource": "Issue",
"field": "title",
"code": "missing_field"
}
]
}
All error objects have resource and field properties so that your client
can tell what the problem is. There's also an error code to let you
know what is wrong with the field. These are the possible validation error
codes:
missing
: This means a resource does not exist.
missing\_field
: This means a required field on a resource has not been set.
invalid
: This means the formatting of a field is invalid. The documentation
for that resource should be able to give you more specific information.
already\_exists
: This means another resource has the same value as this field. This
can happen in resources that must have some unique key (such as Label
names).
If resources have custom validation errors, they will be documented with
the resource.
## HTTP Verbs
Where possible, API v3 strives to use appropriate HTTP verbs for each
action.
HEAD
: Can be issued against any resource to get just the HTTP header info.
GET
: Used for retrieving resources.
POST
: Used for creating resources, or performing custom actions (such as
merging a pull request).
PATCH
: Used for updating resources with partial JSON data. For instance, an
Issue resource has `title` and `body` attributes. A PATCH request may
accept one or more of the attributes to update the resource. PATCH is a
relatively new and uncommon HTTP verb, so resource endpoints also accept
POST requests.
PUT
: Used for replacing resources or collections. For PUT requests
with no `body` attribute, be sure to set the `Content-Length` header to zero.
DELETE
: Used for deleting resources.
## Authentication
There are two ways to authenticate through GitHub API v3:
Basic Authentication:
<pre class="terminal">
$ curl -u "username" https://api.github.com
</pre>
OAuth2 Token (sent in a header):
<pre class="terminal">
$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
</pre>
OAuth2 Token (sent as a parameter):
<pre class="terminal">
$ curl https://api.github.com/?access_token=OAUTH-TOKEN
</pre>
Read [more about OAuth2](/v3/oauth/). Note that OAuth2 tokens can be [acquired
programmatically](/v3/oauth/#create-a-new-authorization), for applications that
are not websites.
Requests that require authentication will return 404, instead of 403, in some places.
This is to prevent the accidental leakage of private repositories to unauthorized
users.
## Pagination
Requests that return multiple items will be paginated to 30 items by
default. You can specify further pages with the `?page` parameter. For some
resources, you can also set a custom page size up to 100 with the `?per_page` parameter.
<pre class="terminal">
$ curl https://api.github.com/user/repos?page=2&per_page=100
</pre>
The pagination info is included in [the Link
header](http://www.w3.org/Protocols/9707-link-header.html). It is important to
follow these Link header values instead of constructing your own URLs. In some
instances, such as in the [Commits
API](/v3/repos/commits/), pagination is based on
SHA1 and not on page number.
Link: <https://api.github.com/user/repos?page=3&per_page=100>; rel="next",
<https://api.github.com/user/repos?page=50&per_page=100>; rel="last"
_Linebreak is included for readability._
The possible `rel` values are:
`next`
: Shows the URL of the immediate next page of results.
`last`
: Shows the URL of the last page of results.
`first`
: Shows the URL of the first page of results.
`prev`
: Shows the URL of the immediate previous page of results.
## Rate Limiting
We limit requests to API v3 to 5000 per hour. This is keyed off either your
login, your OAuth token, or request IP. You can check the returned HTTP
headers of any API request to see your current status:
<pre class="terminal">
$ curl -i https://api.github.com/users/whatever
HTTP/1.1 200 OK
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4966
</pre>
You can also check your rate limit status without incurring an API hit.
GET /rate_limit
### Rate limit
<%= headers 200 %>
<%= json :rate => {:remaining => 4999, :limit => 5000} %>
<br>
#### Unauthenticated rate limited requests
If you need to make unauthenticated calls but need to use a higher rate limit
associated with your OAuth application, you can send over your client ID and
secret in the query string.
<pre class="terminal">
$ curl -i https://api.github.com/users/whatever?client_id=xxxxxxxxxxxxxx&client_secret=yyyyyyyyyyyyyyyyyyyyy
HTTP/1.1 200 OK
Status: 200 OK
X-RateLimit-Limit: 12500
X-RateLimit-Remaining: 11966
</pre>
This method should only be used for server-to-server calls. You should never
share your client secret with anyone or include it in client-side browser code.
Please [contact us](https://github.com/contact) to request white listed access
for your application. We prefer sites that setup OAuth applications for their
users.
## Conditional Requests
Most responses return `Last-Modified` and `Etag` headers. You can use the values
of these headers to make subsequent requests to those resources using the
`If-Modified-Since` and `If-None-Match` headers, respectively. If the resource
has not changed, the server will return a `304 Not Modified`. Also note: making
a conditional request and receiving a 304 response does not count against your
[Rate Limit](#rate-limiting), so we encourage you to use it whenever possible.
<pre class="terminal">
$ curl -i https://api.github.com/user
HTTP/1.1 200 OK
Cache-Control: private, max-age=60
ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
Status: 200 OK
Vary: Accept, Authorization, Cookie
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4996
$ curl -i https://api.github.com/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
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4996
$ curl -i https://api.github.com/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"'
HTTP/1.1 304 Not Modified
Cache-Control: private, max-age=60
ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
Status: 304 Not Modified
Vary: Accept, Authorization, Cookie
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4996
</pre>
## Cross Origin Resource Sharing
The API supports Cross Origin Resource Sharing (CORS) for AJAX requests.
you can read the [CORS W3C working draft](http://www.w3.org/TR/cors), or
[this intro](http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity) from the
HTML 5 Security Guide.
Here's a sample request sent from a browser hitting
`http://some-site.com`:
$ curl -i https://api.github.com -H "Origin: http://some-site.com"
HTTP/1.1 302 Found
Any domain that is registered as an OAuth Application is accepted.
Here's a sample request for a browser hitting [Calendar About Nothing](http://calendaraboutnothing.com/):
$ curl -i https://api.github.com -H "Origin: http://calendaraboutnothing.com"
HTTP/1.1 302 Found
Access-Control-Allow-Origin: http://calendaraboutnothing.com
Access-Control-Expose-Headers: Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
Access-Control-Allow-Credentials: true
This is what the CORS preflight request looks like:
$ curl -i https://api.github.com -H "Origin: http://calendaraboutnothing.com" -X OPTIONS
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: http://calendaraboutnothing.com
Access-Control-Allow-Headers: Authorization, X-Requested-With
Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE
Access-Control-Expose-Headers: Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
Access-Control-Max-Age: 86400
Access-Control-Allow-Credentials: true
## JSON-P Callbacks
You can send a `?callback` parameter to any GET call to have the results
wrapped in a JSON function. This is typically used when browsers want
to embed GitHub content in web pages by getting around cross domain
issues. The response includes the same data output as the regular API,
plus the relevant HTTP Header information.
<pre class="terminal">
$ curl https://api.github.com?callback=foo
foo({
"meta": {
"status": 200,
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4966",
"Link": [ // pagination headers and other links
["https://api.github.com?page=2", {"rel": "next"}]
]
},
"data": {
// the data
}
})
</pre>
You can write a javascript handler to process the callback like this:
<pre class="highlight"><code class="language-javascript">function foo(response) {
var meta = response.meta
var data = response.data
console.log(meta)
console.log(data)
}</code></pre>
All of the headers are the same String value as the HTTP Headers with one
notable exception: Link. Link headers are pre-parsed for you and come
through as an array of `[url, options]` tuples.
A link that looks like this:
Link: <url1>; rel="next", <url2>; rel="foo"; bar="baz"
... will look like this in the Callback output:
<%= json "Link" => [
["url1", {:rel => "next"}],
["url2", {:rel => "foo", :bar => "baz"}]] %>

View File

@ -8,30 +8,9 @@ TYPE: GET
RESPONSE:
```json
{
"architectures": [
{
"id": <architecture identifier>,
"name": <architecture name>
},
...
]
```
<%= json(:architecture_list_response) %>
RESPONSE EXAMPLE:
```json
{
"architectures": [
{
"id": 1,
"name": "x86_64"
},
{
"id": 2,
"name": "i586"
},
...
]
```
<%= json(:architecture_list_response_example) %>

View File

@ -1,49 +0,0 @@
---
title: Markdown Rendering | GitHub API
---
# Markdown Rendering API
## Render an arbitrary Markdown document
POST /markdown
### Input
text
: _Required_ **string** - The Markdown text to render
mode
: _Optional_ **string** - The rendering mode
- `markdown` to render a document as plain Markdown, just like README files are rendered.
- `gfm` to render a document as user-content, e.g. like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly.
context
: _Optional_ **string** - The repository context, only taken into account when rendering as `gfm`
<%= json \
:text => "Hello world github/linguist#1 **cool**, and #1!",
:mode => "gfm",
:context => "github/gollum"
%>
### Response
<%= text_html \
%(<p>Hello world <a href="http://github.com/github/linguist/issues/1" class="issue-link" title="This is a simple issue">github/linguist#1</a> <strong>cool</strong>, and <a href="http://github.com/github/gollum/issues/1" class="issue-link" title="This is another issue">#1</a>!</p>), 200
%>
# Render a Markdown document in raw mode
POST /markdown/raw
### Input
The raw API is not JSON-based. It takes a Markdown document as plaintext (`text/plain` or `text/x-markdown`) and renders it as plain Markdown without a repository context (just like a README.md file is rendered -- this is the simplest way to preview a readme online).
### Response
<%= text_html \
%(<p>Hello world github/linguist#1 <strong>cool</strong>, and #1!</p>), 200
%>

View File

@ -7,79 +7,18 @@ This request will return you all needed data about platforms list into JSON form
URL: /api/v1/platforms/:id.json
PARAMS:
* :id - identifier of current project
TYPE: GET
RESPONSE:
```json
{
"id": <platform id>,
"name": <platform name>,
"description": <platform description>,
"parent_platform_id": <parent platform id>,
"created_at": <platform created at>,
"updated_at": <platform updated_at>,
"released": <platform released>,
"visibility": <platform visibility>,
"platform_type": <platform type>,
"distrib_type": <platform distribution type>,
"owner": {
"id": <owner id>,
"name": <owner name>,
"type": <owner type>,
"url": <owner data path>
},
"repositories": [
{
"id": <repository for package storage id>,
"name": <repository for package storage name>,
"url":  <path to repository data page>
}
...
],
"url": <platform path>
}
```
<%= json(:platform_data_response) %>
EXAMPLE:
```json
{
"id": 1,
"name": "mdv_main",
"description": "mdv_main",
"parent_platform_id": null,
"created_at": 2012-05-09 11:26:46 UTC ,
"updated_at": "2012-06-09 11:26:46 UTC ",
"released": <platform released>,
"visibility": "open",
"platform_type": "main",
"distrib_type": "mdv",
"owner": {
"id":5,
"name":"Timothy Bobrov",
"type":"User",
"url":"/users/5.json"
},
"repositories": [
{
"id": 1,
"name": "main",
"url":  "/api/v1/repositories/1.json"
},
{
"id": 2,
"name": "release",
"url":  "/api/v1/repositories/2.json"
}
],
"url": "/api/v1/platforms/1.json"
}
```
<%= json(:platform_data_response_example) %>
### 3.2. Platform list
@ -101,73 +40,10 @@ REQUEST EXAMPLES:
RESPONSE:
```json
{
"platforms":[
{
"id": <platform id>,
"name": <platform name>,
"platform_type": <platform type>,
"visibility": <platform visibility (hidden/open)>,
"owner":{
"id": <owner id>,
"name": <owner name>,
"type": <owner type>,
"url": <path to owner data>
},
"url": <path to platform data>
},
...
]
}
<%= json(:platform_list_response) %>
```
EXAMPLE:
```json
{
"platforms":[
{
"id":26,
"name":"fucktest",
"platform_type":"mail",
"visibility":"hidden",
"owner":{
"id":5,
"name":"Timothy Bobrov1",
"type":"User",
"url":"/users/5.json"
},
"url":"/api/v1/platforms/26.json"
},
{
"id":17,
"name":"aaa",
"platform_type":"main",
"visibility":"hidden",
"owner":{
"id":5,
"name":"Timothy Bobrov",
"type":"User",
"url":"/timothy_bobrov.json"
},
"url":"/api/v1/platforms/17.json"
},
{
"id":18,
"name":"timothy_tsvetkov",
"platform_type":"main",
"visibility":"hidden",
"owner":{
"id":4,
"name":"Yaroslav Garkin",
"type":"User",
"url":"/users/4.json"
},
"url":"/api/v1/platforms/18.json"
},
],"url":"/api/v1/platforms.json"
}
<%= json(:platform_list_response_example) %>
```

View File

@ -13,97 +13,11 @@ PARAMS:
RESPONSE:
```json
{
"project":
{
"id": <resource id>,
"name": <name>,
"created_at": <created at date and time>,
"updated_at" <updated at date and time>,
"visibility": <visibility (open/hidden)>,
"description": <description>,
"ancestry": <project ancestry>,
"has_issues": <true if issues enabled>,
"has_wiki": <true if wiki enabled>,
"default_branch": <git branch used by default>,
"is_package": <true if project is package>,
"average_build_time": <average build time for this project>,
"owner": {
"id": <parent owner id>,
"name": <parent owner name>,
"url": <url to owner profile>
},
"repositories": [
{
"id": <repository for package storage id>,
"name": <repository for package storage name>,
"url":  <path to repository data page>,
"platform": {
"id": <repository platform id>,
"name": <repository platform name>,
"url": <path to repository platform data page>
}
},
....
],
"url": <url to build list page>
}
}
```
<%= json(:project_data_response) %>
EXAMPLE:
```json
{
"project":
{
"id":4661,
"name":"hwinfo",
"created_at":"2011-09-05T14:33:25Z",
"updated_at":"2012-02-29T18:16:02Z",
"visibility":"open",
"description":"asfsafafsfasf fas fasfsa fas fasfa s",
"ancestry":null,
"has_issues":true,
"has_wiki":false,
"default_branch":"master",
"is_package":true,
"average_build_time":0,
"owner":{
"id":4,
"name":"Yaroslav Garkin",
"type":"User",
"url":"/users/4.json"
},
"repositories": [
{
"id": 1,
"name": "main",
"url":  "/api/v1/repositories/1.json",
"platform": {
"id": 1,
"name": "mdv_main",
"url": "/api/v1/platforms/1.json"
}
},
{
"id": 3,
"name": "main",
"url":  "/api/v1/repositories/3.json",
"platform": {
"id": 3,
"name": "warpc_personal",
"url": "/api/v1/platforms/3.json"
}
}
],
},
"url":"/api/v1/projects/4661.json"}
}
```
<%= json(:project_data_response_example) %>
### 1.2. Project id get by name and owner
@ -124,42 +38,9 @@ REQUEST EXAMPLES:
RESPONSE:
```json
{
"project":
{
"id": <resource id>,
"name": <name>,
"visibility": <visibility (open/hidden)>,
"owner": {
"id": <owner id>,
"name": <owner name>,
"url": <url to owner profile>
},
"url": <url to project data page>
}
}
```
<%= json(:project_get_id_response) %>
EXAMPLE:
```json
{
"project":
{
"id":4661,
"name":"hwinfo",
"visibility":"open",
"owner":{
"id":4,
"name":"Yaroslav Garkin",
"type":"User",
"url":"/users/4.json"
},
"url":"/api/v1/projects/4661.json"
}
}
```
<%= json(:project_get_id_response_example) %>

View File

@ -13,43 +13,9 @@ TYPE: GET
RESPONSE:
```json
{
"repository":
{
"id": <resource id>,
"name": <name>,
"created_at": <created at date and time>,
"updated_at": <updated at date and time>,
"description": <description>,
"platform": {
"id": <platform id>,
"name": <platform name>,
"url": <url to platform>
},
"url": <url to platform page>
},
"url": <url to platforms list page>
}
```
<%= json(:repository_data_response) %>
EXAMPLE:
```json
{
"repository":
{
"id":30,
"name":"main",
"platform":{
"id":41,
"name":"my_personal",
"url":"/api/v1/platforms/41.json"
},
},
"url":"/api/v1/repositories/30.json"
}
```
<%= json(:repository_data_response_example) %>

View File

@ -1,6 +0,0 @@
<% @changes.each do |article| %>
<div class="change" id="<%= article.path %>">
<%= render '_meta', :item => article %>
<%= article.compiled_content %>
</div>
<% end %>

View File

@ -1,18 +0,0 @@
<h2 class="title">
<a href="<%= @item.path %>"><%= @item[:title] %></a>
</h2>
<div class="meta">
<div class="who_when">
<%= gravatar_for(@item[:author_name]) %>
<span class="author vcard fn">
<a href="https://github.com/<%= @item[:author_name] %>"><%= @item[:author_name] %></a>
</span>
<span class="published">
<%= post_date @item %>
<% if version = @item[:api_version] %>
/ Version: <a href="/changes/<%= version %>"><%= version %></a>
<% end %>
</span>
</div>
</div>

View File

@ -1,5 +0,0 @@
<div class="change" id="<%= @item.path %>">
<%= render '_meta', :item => @item %>
<%= yield %>
</div>

View File

@ -19,11 +19,6 @@
<div id="header">
<div>
<a class="logo" href="/"><img src="/images/logo_developer.png" width="255" height="45" /></a>
<ul class="nav">
<li><a href="/v3/">API v3</a></li>
<li><a
href="http://support.github.com/discussions/api">Support</a></li>
</ul>
</div>
</div><!-- #header -->
</div><!-- #header-wrapper -->
@ -37,7 +32,7 @@
<div class="js-toggle-list sidebar-module expandable">
<ul>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed">&nbsp;</a><a href="/v3/">Summary</a></h3>
<h3><a href="#" class="js-expand-btn collapsed">&nbsp;</a><a href="/v1/">Summary</a></h3>
<ul class="js-guides">
<li><a href="/v1/build/">Build</a></li>
<li><a href="/v1/projects/">Projects</a></li>
@ -46,11 +41,10 @@
<li><a href="/v1/architectures/">Architectures</a></li>
</ul>
</li>
<li class="js-guides"><h3><a href="/v3/markdown/">Markdown</a></h3></li>
</ul>
</div> <!-- /sidebar-module -->
<div class="sidebar-module">
<p>This website is a <a href="https://github.com/github/developer.github.com" target="_blank">public GitHub repo</a>. Please help us by forking the project and adding to it.</p>
<p>This website is a <a href="https://abf.rosalinux.ru" target="_blank">ABF</a></p>
</div>
</div><!-- /sidebar-shell -->
@ -64,36 +58,17 @@
<![if !IE]><h4 id="blacktocat">GitHub Links</h4><![endif]>
<ul class="footer_nav">
<h4>GitHub</h4>
<li><a href="https://github.com/about">About</a></li>
<li><a href="https://github.com/blog">Blog</a></li>
<li><a href="https://github.com/features">Features</a></li>
<li><a href="https://github.com/contact">Contact &amp; Support</a></li>
<li><a href="https://github.com/training">Training</a></li>
<li><a href="http://status.github.com/">Site Status</a></li>
<h4>RosaLab</h4>
</ul>
<ul class="footer_nav">
<h4>Tools</h4>
<li><a href="http://mac.github.com/">GitHub for Mac</a></li>
<li><a href="http://mobile.github.com/">Issues for iPhone</a></li>
<li><a href="https://gist.github.com">Gist: Code Snippets</a></li>
<li><a href="http://enterprise.github.com/">GitHub Enterprise</a></li>
<li><a href="http://jobs.github.com/">Job Board</a></li>
</ul>
<ul class="footer_nav">
<h4>Extras</h4>
<li><a href="http://shop.github.com/">GitHub Shop</a></li>
<li><a href="http://octodex.github.com/">The Octodex</a></li>
</ul>
<ul class="footer_nav">
<h4>Documentation</h4>
<li><a href="http://help.github.com/">GitHub Help</a></li>
<li><a href="http://developer.github.com/">Developer API</a></li>
<li><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></li>
<li><a href="http://pages.github.com/">GitHub Pages</a></li>
</ul>
</div><!-- /.site -->
@ -103,15 +78,12 @@
<div class="footer_inner clearfix">
<div id="legal">
<!--[if IE]><a class="home_ie" href="http://github.com">Home</a><![endif]-->
<![if !IE]><a class="home" href="http://github.com">Home</a><![endif]>
<![if !IE]><a class="home" href="http://abf.rosalinux.ru">Home</a><![endif]>
<ul id="legal_links">
<li><a href="http://help.github.com/terms-of-service/">Terms of Service</a></li>
<li><a href="http://help.github.com/privacy-policy/">Privacy</a></li>
<li><a href="http://help.github.com/security/">Security</a></li>
</ul>
<p>&copy; <span id="year">year</span> GitHub Inc. All rights reserved.</p>
<p>&copy; <span id="year">year</span> RosaLab. All rights reserved.</p>
</div><!-- /#legal or /#legal_ie-->
</div><!-- /.site -->
</div><!-- /.lower_footer -->

View File

@ -1,89 +0,0 @@
module ChangesHelper
MimeFormat = "application/vnd.github.%s+json".freeze
# Public: Filters the change items out. If a version is given, show only the
# items related to that version.
#
# version - Optional String version key.
#
# Returns an Array of the first 30 Nanoc::Item objects, sorted in reverse
# chronological order.
def api_changes(version = nil)
changes = @items.select { |item| item[:kind] == 'change' }
if version
version_s = version.to_s
changes.select { |item| item[:api_version] == version_s }
else
changes
end.sort! do |x, y|
attribute_to_time(y[:created_at]) <=> attribute_to_time(x[:created_at])
end.first(30)
end
# Public
def current_api
@current_api ||= (api_versions[-2] || api_versions.first).first
end
# Public
def upcoming_api
@upcoming_api ||= begin
version, date = api_versions.last
version unless date
end
end
# Public
def current_api?(version)
@api_current_checks ||= {}
if @api_current_checks.key?(version)
@api_current_checks[version]
end
@api_current_checks[version] = version == current_api
end
# Public
def no_current_api_versions?(*versions)
versions.none? { |v| current_api?(v) }
end
# Public
def api_released_at(version)
@api_releases ||= {}
if @api_releases.key?(version)
@api_releases[version]
end
@api_releases[version] = begin
pair = api_versions.detect do |(name, date)|
name == version
end
pair ? pair[1] : nil
end
end
# Public
def api_mimetype_listing(version)
version_s = version.to_s
mime = mimetype_for version_s
if time = api_released_at(version_s)
mime << " ("
mime << "Current, " if current_api?(version_s)
mime << strftime(time)
mime << ")"
else
mime
end
end
# Internal
def mimetype_for(version)
MimeFormat % version.to_s
end
# Internal
def api_versions
@api_versions ||= Array(@site.config[:api_versions])
end
end

View File

@ -1,3 +1,3 @@
# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
include Nanoc::Helpers::Rendering, Nanoc::Helpers::Blogging, ChangesHelper
include Nanoc::Helpers::Rendering, Nanoc::Helpers::Blogging

File diff suppressed because it is too large Load Diff