<commit_before>Minimal Sinatra GitHub Application
==================================

This is the smallest working Sinatra application that authenticates via the GitHub [OAuth2][oa] stuff. This skeleton app exists simply because it took me a little while to figure out how to put all the pieces together to get to the point that I could start building something.  So here you go.

[oa]: http://developer.github.com/v3/oauth/

Basically, to get this app running on Heroku, for instance, you will want to:

* Register a new Heroku instance (you will have to use something other than 'ghmin')

        $ heroku apps:create ghmin
        Creating ghmin... done, stack is bamboo-mri-1.9.2
        http://ghmin.heroku.com/ | <EMAIL>@heroku.com:ghmin.git
        Git remote heroku added

* Add SSL to your Heroku instance, since we are dealing with user tokens here

        $ heroku addons:add piggyback_ssl
        Adding piggyback_ssl to ghmin... done (free)

* Register your GitHub OAuth2 application with that new URL (but https) at:

        https://github.com/account/applications/new

* Set your Client Secret and Client ID as environment values in your Heroku instance

        $ heroku config:add GITHUB_CLIENT_SECRET=....
        $ heroku config:add GITHUB_CLIENT_ID=....

* Push to Heroku

        $ git push heroku master
        Counting objects: 21, done.
        Delta compression using up to 2 threads.
        Compressing objects: 100% (19/19), done.
        Writing objects: 100% (21/21), 3.92 KiB, done.
        Total 21 (delta 3), reused 0 (delta 0)

        -----> Heroku receiving push
        -----> Sinatra app detected
        -----> Gemfile detected, running Bundler version 1.0.7
               Unresolved dependencies detected; Installing...
               Using --without development:test

               Fetching source index for http://rubygems.org/
               Installing addressable (2.2.6) <commit_msg>add screenshot<commit_after>Minimal Sinatra GitHub Application
==================================

This is the smallest working Sinatra application that authenticates via the GitHub [OAuth2][oa] stuff. This skeleton app exists simply because it took me a little while to figure out how to put all the pieces together to get to the point that I could start building something.  So here you go.

[oa]: http://developer.github.com/v3/oauth/

Basically, to get this app running on Heroku, for instance, you will want to:

* Register a new Heroku instance (you will have to use something other than 'ghmin')

        $ heroku apps:create ghmin
        Creating ghmin... done, stack is bamboo-mri-1.9.2
        http://ghmin.heroku.com/ | <EMAIL>:ghmin.git
        Git remote heroku added

* Add SSL to your Heroku instance, since we are dealing with user tokens here

        $ heroku addons:add piggyback_ssl
        Adding piggyback_ssl to ghmin... done (free)

* Register your GitHub OAuth2 application with that new URL (but https) at:

        https://github.com/account/applications/new

It should look something like this:

![OAuth application screen](https://img.skitch.com/20110621-mcyq6hjrn3c2mdk6629t23fh2m.png)

* Set your Client Secret and Client ID as environment values in your Heroku instance

        $ heroku config:add GITHUB_CLIENT_SECRET=....
        $ heroku config:add GITHUB_CLIENT_ID=....

* Push to Heroku

        $ git push heroku master
        Counting objects: 21, done.
        Delta compression using up to 2 threads.
        Compressing objects: 100% (19/19), done.
        Writing objects: 100% (21/21), 3.92 KiB, done.
        Total 21 (delta 3), reused 0 (delta 0)

        -----> Heroku receiving push
        -----> Sinatra app detected
        -----> Gemfile detected, running Bundler version 1.0.7
               Unresolved dependencies detected; Installing...
               Using --without development:test

               Fetching source index for http://rubygems.org/
               Installing addressable (2.2.6) 
{'fraction_non_alphanumeric': 0.0963371801304566, 'fraction_numerical': 0.02308078273958856, 'mean_word_length': 2.6814404432132966, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7497793', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1070, 'n_words': 452}