A dead simple HTTP wraper for linguist, offering interoperability for node.js, while reducing the linguist CLI startup time through a persistent sinatra server.
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.
Linguist_http uses sinatra to wrap Linguist as a http service, providing two apis:
(get) /repo/<expanded_path_of_the_repository>, offering language statistics.
(get) /file/<expanded_path_of_the_repository>, listing documentable sources.
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 firstname.lastname@example.org:baoshan/linguist_http cd linguist_http bundle install ruby app.rb