From 5c29ce06959695ceeda3597b51ed5e7fd12583b2 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 6 Feb 2015 16:26:55 -0500 Subject: [PATCH] Add usage and link to contributing --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index 215aaf52..84b53b62 100644 --- a/README.md +++ b/README.md @@ -55,3 +55,44 @@ vim: set ft=cpp: Emacs -*- mode: php;-*- ``` + +## Usage + +Install the gem: + +``` +$ gem install github-linguist +``` + +Then use it in your application: + +```ruby +require 'rugged' +require 'linguist' + +repo = Rugged::Repository.new('.') +project = Linguist::Repository.new(repo, repo.head.target_id) +project.language #=> "Ruby" +project.languages #=> { "Ruby" => 119387 } +``` + +These stats are also printed out by the `linguist` executable. You can use the +`--breakdown` flag, and the binary will also output the breakdown of files by language. + +You can try running `linguist` on the root directory in this repository itself: + +$ bundle exec linguist --breakdown + +100.00% Ruby + +Ruby: +Gemfile +Rakefile +bin/linguist +github-linguist.gemspec +lib/linguist.rb +… + +## Contributing + +Please check out our [contributing guidelines](CONTRIBUTING.md).