Skip to content

Offer dirty interoperability for node.js, while reducing the linguist CLI startup time through a persistent sinatra server.

Notifications You must be signed in to change notification settings

baoshan/linguist_http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A dead simple HTTP wraper for linguist, offering interoperability for node.js, while reducing the linguist CLI startup time through a persistent sinatra server.

Background

Linguist is the savant behind GitHub dealing with language detection and statistics.

Docas invokes linguist from the shell command line, which have to bear a one-second startup procedure for loading gems.

This is not a huge problem in a stand-alone environment (developer generates the documentation for her repository through the docas command-line), but is uneconomic in a software-as-a-service scenario, and also hurts performance.

Exposed APIs

Linguist_http uses sinatra to wrap Linguist as a http service, providing two apis:

  1. (get) /repo/<expanded_path_of_the_repository>, offering language statistics.
  2. (get) /file/<expanded_path_of_the_repository>, listing documentable sources.

Installation

To get it, clone the repo and run Bundler to install its dependencies.

The linguist library is not published as a rubygem, so the project reference (a forked version of) Linguist as a Git source in its Gemfile.

git clone [email protected]:baoshan/linguist_http
cd linguist_http
bundle install
ruby app.rb

About

Offer dirty interoperability for node.js, while reducing the linguist CLI startup time through a persistent sinatra server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages