<commit_before>### A [Sinatra](http://www.sinatrarb.com/) template for [Grape-Doorkeep applications](https://github.com/sethherr/grape-doorkeeper)

This is a template application to build mini websites authenticated with OAuth2, such as [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) provides.

If you aren't connecting to an authentication with doorkeeper, you may have to change 

## Using it:

1. Fork or clone this repository
2. Update the values in [.env](.env) with [your values](#env-values)
3. Go to the directory this is contained in the terminal
4. Use `rerun rackup` to start the server 
5. The above command will print out something like `WEBrick::HTTPServer#start: pid=62447 port=9292`. Go to localhost:{that_port_number} - e.g. [http://localhost:9292](http://localhost:9292). 
6. Go there to the above url to see the app! :sparkles:

## Env Values

The `.env` file references the app you are using. You will need to create an app on the provider you're using.

The callback url for this sinatra template is `localhost:9292/auth/oauthed/callback` - change localhost:9292 to reflect your local conditions - e.g., if you're running on a different port, or if you deploy this to something with a domain name. You will have to add this to the application on the provider.

After you've created an application on the provider, add the client id and the client secret of it to the `.env` file.

For the `APPLICATION_SCOPES_REQUESTED`, separate scopes with whitespace
For `USER_ATTRIBUTES`, separate values with whitespace

## Directories / files

*The directory structure of this app is set up to loosely resemble rails*

- `assets`
  - javascript, coffeescript, css, scss - compiled, minified, concatenated.
- `views`
  - haml, erb or html files. `layout.haml` is the layout file that wraps everything else up.
- `public` 
  - files in here are served directly from the base url
- `config/routes.rb`
  - the routes for the app


## Rails Assets

This template includes [rails-assets](https://rails-assets.org/), which makes it easy to use [bower](http://bower.io/) packages.

**View [the list of bower packages](http://bower.io/search/)** 

Add bower packages to the Gemfile by putting them in the Bower packages block in this format:

    gem 'rails-assets-BOWER_PACKAGE_NAME'`.

Since Javascript packages change quickly, it's a particularly good idea to lock the packages with a loose version after you `bundle install`. e.g. for the jQuery version currently installed,

    `gem 'rails-assets-jquery', '~> 2.1.4'`

*(which means >= 2.1.4 and < 2.2.0).*

So you can safely update your packages with `bundle update`

----

Many thanks to [sinatra_auth_github](https://github.com/atmos/sinatra_auth_github) from which this draws inspiration.<commit_msg>README improvement :cake:<commit_after>### A [Sinatra](http://www.sinatrarb.com/) template for [Grape-Doorkeep applications](https://github.com/sethherr/grape-doorkeeper)

A template application for building mini web sites/services authenticated with OAuth2.

- No database required
- [warden-oauth](https://github.com/Zensaburou/warden-oauthed) for authentication
- [Includes rails assets for bower package management](#rails-assets)


## Using it:

1. Fork or clone this repository
2. Update the values in [.env](.env) with [your values](#env-values)
3. Go to the directory this is contained in the terminal
4. Use `rerun rackup` to start the server 
5. The above command will print out something like `WEBrick::HTTPServer#start: pid=62447 port=9292`. Go to localhost:{that_port_number} - e.g. [http://localhost:9292](http://localhost:9292). 
6. Go there to the above url to see the app! :sparkles:

## Env Values

The `.env` file references the app you are using. You will need to create an app on the provider you're using.

The callback url for this sinatra template is `localhost:9292/auth/oauthed/callback` - change localhost:9292 to reflect your local conditions - e.g., if you're running on a different port, or if you deploy this to something with a domain name. You will have to add this to the application on the provider.

After you've created an application on the provider, add the client id and the client secret of it to the `.env` file.

For the `APPLICATION_SCOPES_REQUESTED`, separate scopes with whitespace
For `USER_ATTRIBUTES`, separate values with whitespace

## Directories / files

*The directory structure of this app is set up to loosely resemble rails*

- `assets`
  - javascript, coffeescript, css, scss - compiled, minified, concatenated.
- `views`
  - haml, erb or html files. `layout.haml` is the layout file that wraps everything else up.
- `public` 
  - files in here are served directly from the base url
- `config/routes.rb`
  - the routes for the app


## Rails Assets

This template includes [rails-assets](https://rails-assets.org/), which makes it easy to use [bower](http://bower.io/) packages.

**View [the list of bower packages](http://bower.io/search/)** 

Add bower packages to the Gemfile by putting them in the Bower packages block in this format:

    gem 'rails-assets-BOWER_PACKAGE_NAME'`.

Since Javascript packages change quickly, it's a particularly good idea to lock the packages with a loose version after you `bundle install`. e.g. for the jQuery version currently installed,

    `gem 'rails-assets-jquery', '~> 2.1.4'`

*(which means >= 2.1.4 and < 2.2.0).*

So you can safely update your packages with `bundle update`

=======

Many thanks to [sinatra_auth_github](https://github.com/atmos/sinatra_auth_github) :shipit: from which this draws inspiration.
{'fraction_non_alphanumeric': 0.09717251252684324, 'fraction_numerical': 0.01467430207587688, 'mean_word_length': 4.247887323943662, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, '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': '5023247', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1608, 'n_words': 712}