Skip to content

fgeller/rad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rad - read api docs

Open source app to read API docs offline.

Quick start:

Download a release from the release section, unpack it and start it. Or as a one-liner (for linux replace darwin with linux):

curl http://geller.io/rad/sad-1.0.0-darwin-amd64.xz | tar Jx > sad && ./sad

Then move the binary to a location that's on your PATH and make it executable. For example, to add it to ~/bin:

mv sad ~/bin/ && chmod +x ~/bin/sad

Just make sure you download packs before you go offline :)

All releases including snapshots are available here.

Alternatively, if you just want to give it a try there is a sample instance running here. Keep in mind though that the latency to that instance probably slows down the app's responsiveness. For example in my case, I have a latency of about 500ms to the sample instance while most requests render successfully in 40-100ms for an instance running on my tiny laptop.

Contents:

Pictures!

Start screen:

Blank

Searching Go's stdlib:

Go

Searching Scala's stdlib using regular expressions:

Scala

Displaying installed and available packs:

Packs

Available packs

Integrations

While sad includes a UI, it might be faster or more convenient to query through one of the following integrations:

Browser

You can save some key strokes by assigning a custom search engine keyword to rad. For example in Chrome:

Chrome Search Engine

This will allow you to search for documentation by using a custom keyword directly from the location bar. To speed things up even more, you can enable live loading of documentation in rad settings:

Live updates

This will allow you to jump directly to the first result after you've entered a query in the location bar (shift + → and shift + ← will cycle through the search results if the query wasn't unique).

Alfred

You can query a running rad instance from Alfred if you install the included workflow. Then you can start a query with the configured keyword (the default is simply r):

Alfred

Selecting a result will open the documention in your default browser via rad.

HUBOT + Slack

rad.coffee is a small HUBOT script that works with the Slack adapter:

HUBOT + Slack

You start a query with the keyword rad and the results are links to a running sad instance.

Why?

I enjoy open source software and hacking on my projects while on the go or in cafes. And this project gave me an excuse to learn more about Go and react.js :)

https://golang.org/doc/faq#Whats_the_origin_of_the_mascot

How?

rad is split into multiple components:

  • sad: web app to serve API docs including a UI.
  • pad: app to package API docs.
  • sap: web app to serve documentation packs.

All three apps are written in Go and the sad front-end uses react.js and plain old HTML/Javascript. sad uses web-sockets and Go's channels for streaming results immediately to the UI.

Pack format

Packs are zip archives with the following structure:

pack-name
 |
 |-- pack.json
 |-- data.json
 `-- html-contents
   |
   |-- first.html
   `-- second.html

They contain a top-level directory that has the same name as the pack. The pack name is used to identify the pack for searching, in the above example the name is pack-name. The top-level directory contains two data files that include meta-data about the pack pack.json and the documentation entries data.json.

A pack.json file has at least the following information: Name, Type, Version, Created, Description. Consider the following example:

{
  "Name": "pack-name",
  "Type": "go",
  "Version": "3.1.4",
  "Created": "2015-10-25T15:42:01.936261923+13:00",
  "Description": "This is an <i>HTML</i> string containing source and copyright information."
}

The data.json file contains the entries that sad will index and search. An entry is grouped under a path and contains member entries that are defined by a name and a relative link to their location within the pack archive. Consider the following example:

[
  {
    "Path": "com.example.super",
    "Members": [
      {
        "Name": "Driver",
        "Target": "html-contents/first.html#Driver"
      }
    ]
  },
  {
    "Path": "com.example.super",
    "Members": [
      {
        "Name": "Runner",
        "Target": "html-contents/second.html#Runner"
      }
    ]
  }
]

More packs and contributions

Moar!

The currently included packs are driven by my use and what friends are interested in -- if you'd like to see another pack included please create an issue or even send me a wrapped pack :)

Others

  • Dash - Very mature OSX app with lots of packs available.
  • DevDocs - Web app that supports offline mode with lots of packs especially for front-end tech.



Made with ❤ in Piha.