bunto-auth 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rubocop.yml +24 -0
- data/.travis.yml +29 -0
- data/Gemfile +3 -0
- data/README.md +177 -0
- data/Rakefile +20 -0
- data/bin/bunto-auth +134 -0
- data/bunto-auth.gemspec +33 -0
- data/lib/bunto-auth.rb +25 -0
- data/lib/bunto_auth/auth_site.rb +42 -0
- data/lib/bunto_auth/bunto_site.rb +13 -0
- data/lib/bunto_auth/commands.rb +72 -0
- data/lib/bunto_auth/config.rb +23 -0
- data/lib/bunto_auth/config_error.rb +7 -0
- data/lib/bunto_auth/helpers.rb +18 -0
- data/lib/bunto_auth/sinatra/auth/github.rb +13 -0
- data/lib/bunto_auth/version.rb +3 -0
- data/script/bootstrap +7 -0
- data/script/cibuild +13 -0
- data/script/console +1 -0
- data/script/release +38 -0
- data/script/server +3 -0
- data/script/setup +5 -0
- data/spec/bunto_auth_auth_site_spec.rb +74 -0
- data/spec/bunto_auth_bin_spec.rb +43 -0
- data/spec/bunto_auth_bunto_site_spec.rb +43 -0
- data/spec/bunto_auth_commands_spec.rb +75 -0
- data/spec/bunto_auth_helpers_spec.rb +61 -0
- data/spec/bunto_auth_spec.rb +46 -0
- data/spec/spec_helper.rb +62 -0
- data/templates/.gitignore +3 -0
- data/templates/Rakefile +9 -0
- data/templates/config.ru +5 -0
- data/templates/index.html +19 -0
- metadata +307 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 248270edeba387af87bdb1106b5441fc0e831b55
|
4
|
+
data.tar.gz: 38ad5bb01ecec02667f589fd518e808b1364108b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 37bdfed3a5f18776c97a996927cd7142441b88a10fd07ebfd06927d657c034e675c05a109884839817c7bf60c6d26b5c1253cfbf1934061d0f528b6e238ec134
|
7
|
+
data.tar.gz: e0f72f48d7fb2e2d77648f0f19abf1fc18d60add1c0062bac468720875d0ee152a85f8df023549cf523ff2dc07aaeffa8c059d7889568cc85eb91c0098df81a8
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
bunto: .rubocop.yml
|
3
|
+
|
4
|
+
Style/Documentation:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Metrics/MethodLength:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/LineLength:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Style/FileName:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/DoubleNegation:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
AllCops:
|
23
|
+
Exclude:
|
24
|
+
- vendor/**/*
|
data/.travis.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Travis CI
|
2
|
+
language: ruby
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- 2.3.1
|
6
|
+
- 2.3.0
|
7
|
+
- 2.2.5
|
8
|
+
|
9
|
+
before_script:
|
10
|
+
- chmod a+x script/bootstrap
|
11
|
+
- chmod a+x script/cibuild
|
12
|
+
- chmod a+x script/console
|
13
|
+
- chmod a+x script/release
|
14
|
+
- chmod a+x script/server
|
15
|
+
- chmod a+x script/setup
|
16
|
+
- git config --global user.email "isc.suriyaa@gmail.com"
|
17
|
+
- git config --global user.name "Suriyaa Kudo"
|
18
|
+
|
19
|
+
script: "./script/cibuild"
|
20
|
+
|
21
|
+
sudo: false
|
22
|
+
|
23
|
+
cache: bundler
|
24
|
+
|
25
|
+
env:
|
26
|
+
global:
|
27
|
+
- GITHUB_CLIENT_ID=FOO
|
28
|
+
- GITHUB_CLIENT_SECRET=BAR
|
29
|
+
- GITHUB_ORG_NAME="bunto"
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
# Bunto Auth
|
2
|
+
|
3
|
+
*A simple way to use GitHub OAuth to serve a protected Bunto site to your GitHub organization*
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/bunto-auth.png)](https://badge.fury.io/rb/bunto-auth) [![Build Status](https://travis-ci.org/bunto/bunto-auth.png?branch=master)](https://travis-ci.org/bunto/bunto-auth)
|
6
|
+
|
7
|
+
## The problem
|
8
|
+
|
9
|
+
[Bunto](https://github.com/bunto/bunto) and [GitHub Pages](https://pages.github.com) are awesome, right? Static site, lightning fast, everything versioned in Git. What else could you ask for?
|
10
|
+
|
11
|
+
But what if you only want to share that site with a select number of people? Before, you were SOL. Now, simply host the site on a free, [Heroku](https://heroku.com) Dyno, and whenever someone tries to access it, it will Oauth them against GitHub, and make sure they're a member of your Organization. Pretty cool, huh?
|
12
|
+
|
13
|
+
## Requirements
|
14
|
+
|
15
|
+
1. A GitHub account (one per user)
|
16
|
+
2. A GitHub Organization (of which members will have access to the Bunto site)
|
17
|
+
3. A GitHub Application (you can [register one](https://github.com/settings/applications/new) for free)
|
18
|
+
4. A Heroku account (you can technically use this elsewhere, but the instructions are for Heroku)
|
19
|
+
|
20
|
+
## Getting Started
|
21
|
+
|
22
|
+
### Create a GitHub Application
|
23
|
+
|
24
|
+
1. Navigate to [the GitHub app registration page](https://github.com/settings/applications/new)
|
25
|
+
2. Give your app a name
|
26
|
+
3. Tell GitHub the URL you want the app to eventually live at. If using a free Heroku account, this will be something like <http://my-site.herokuapp.com>
|
27
|
+
4. Specify the callback URL; should be like this: <https://my-site.herokuapp.com/auth/github/callback>; note that this is **https**, not http.
|
28
|
+
5. Hit Save, but leave the page open, you'll need some of the information in a moment
|
29
|
+
|
30
|
+
Remember the 'my-site' part for later on when using `heroku create`. Also, my-site is often called 'app-name' in Heroku documentation.
|
31
|
+
|
32
|
+
### Add Bunto Auth to your site
|
33
|
+
|
34
|
+
1. Within your new site repository or orphaned github [branch](https://help.github.com/articles/creating-project-pages-manually/) (the branch could be named anything except 'gh-pages' since this would then be public on GitHub!), add `gem 'bunto-auth'` to your `Gemfile` or if you don't already have a `Gemfile`, create a file called `Gemfile` in the root of your site's repository with the following content:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
source "https://rubygems.org"
|
38
|
+
|
39
|
+
gem 'bunto-auth'
|
40
|
+
```
|
41
|
+
|
42
|
+
2. `cd` into your project's directory and run `bundle install`. If you get an error using `bundle install`, see Troubleshooting below.
|
43
|
+
|
44
|
+
3. Run `bundle exec bunto-auth new` which will copy the necessary files to set up the server
|
45
|
+
|
46
|
+
### Setting up hosting with Heroku
|
47
|
+
|
48
|
+
#### Automatically
|
49
|
+
|
50
|
+
Run `bundle exec bunto-auth setup --client_id XXX --client_secret XXX --org_name XXX`
|
51
|
+
|
52
|
+
(or `--team_id XXX`)
|
53
|
+
|
54
|
+
#### Manually
|
55
|
+
|
56
|
+
1. You may need to add and commit the files generated by `bunto-auth new` to Git before continuing
|
57
|
+
2. Make sure you have [the Heroku toolbelt](https://toolbelt.heroku.com/) installed
|
58
|
+
3. Run `heroku create my-site` from your site's directory; make sure my-site matches what you specified in the GitHub application registration above.
|
59
|
+
4. `heroku config:set GITHUB_CLIENT_ID=XXX GITHUB_CLIENT_SECRET=XXX GITHUB_ORG_NAME=XXX` (or `GITHUB_TEAM_ID`)
|
60
|
+
5. `git push heroku`, or if you are maintaining the site in an orphaned branch of your GitHub repo (say 'heroku-pages'), do `git push heroku heroku-pages:master`
|
61
|
+
6. `heroku open` to open the site in your browser
|
62
|
+
|
63
|
+
#### Find the Organization ID (needed to find Team ID)
|
64
|
+
|
65
|
+
If you need to find an organization's ID, you can use the following cURL command:
|
66
|
+
|
67
|
+
```
|
68
|
+
curl https://api.github.com/orgs/{org_name}
|
69
|
+
```
|
70
|
+
|
71
|
+
#### Finding the Team ID
|
72
|
+
|
73
|
+
If you need help finding a team's numeric ID, you can use the `bunto-auth team_id` command.
|
74
|
+
|
75
|
+
For example, to find the team ID for @bunto/maintainers you'd run the command:
|
76
|
+
|
77
|
+
```
|
78
|
+
bunto-auth team_id --org bunto --team maintainers
|
79
|
+
```
|
80
|
+
|
81
|
+
You'll want to add a [personal access token](https://github.com/settings/tokens/new) to your `.env` file so that Bunto-Auth can make the necessary API request, but the command will run you through the process if you do not provide this.
|
82
|
+
|
83
|
+
## Configuration
|
84
|
+
|
85
|
+
### Whitelisting
|
86
|
+
|
87
|
+
Don't want to require authentication for every part of your site? Fine! Add a whitelist to your Bunto's **config.yml** file:
|
88
|
+
|
89
|
+
```yaml
|
90
|
+
bunto_auth:
|
91
|
+
whitelist:
|
92
|
+
- drafts?
|
93
|
+
```
|
94
|
+
|
95
|
+
`bunto_auth.whitelist` takes an array of regular expressions as strings. The default auth behavior checks (and blocks) against root (`/`). Any path defined in the whitelist won't require authentication on your site.
|
96
|
+
|
97
|
+
What if you want to go the other way, and unauthenticate the entire site *except* for certain portions? You can define some regex magic for that:
|
98
|
+
|
99
|
+
```yaml
|
100
|
+
bunto_auth:
|
101
|
+
whitelist:
|
102
|
+
- "^((?!draft).)*$"
|
103
|
+
```
|
104
|
+
|
105
|
+
### Requiring SSL
|
106
|
+
|
107
|
+
If [you've got SSL set up](https://devcenter.heroku.com/articles/ssl-endpoint), simply add the following your your `_config.yml` file to ensure SSL is enforced.
|
108
|
+
|
109
|
+
```yaml
|
110
|
+
bunto_auth:
|
111
|
+
ssl: true
|
112
|
+
```
|
113
|
+
|
114
|
+
### Using a custom 404
|
115
|
+
|
116
|
+
Just like GitHub Pages, Bunto Auth will honor a custom 404 page, if it's generated as `/404.html` in the built site.
|
117
|
+
|
118
|
+
## Running locally
|
119
|
+
|
120
|
+
Want to run it locally?
|
121
|
+
|
122
|
+
### Without authentication
|
123
|
+
|
124
|
+
Just run `bunto serve` as you would normally.
|
125
|
+
|
126
|
+
### With authentication
|
127
|
+
|
128
|
+
1. `export GITHUB_CLIENT_ID=[your github app client id]`
|
129
|
+
2. `export GITHUB_CLIENT_SECRET=[your github app client secret]`
|
130
|
+
3. `export GITHUB_ORG_NAME=[org name]` or `export GITHUB_TEAM_ID=[team id]` or `export GITHUB_TEAM_IDS=1234,5678`
|
131
|
+
4. `bunto-auth serve`
|
132
|
+
|
133
|
+
*Pro-tip #1:* For sanity's sake, and to avoid problems with your callback URL, you may want to have two apps, one with a local Oauth callback, and one for production if you're going to be testing auth locally.
|
134
|
+
|
135
|
+
*Pro-tip #2*: Bunto Auth supports [dotenv](https://github.com/bkeepers/dotenv) out of the box. You can create a `.env` file in the root of site and add your configuration variables there. It's ignored by `.gitignore` if you use `bunto-auth new`, but be sure not to accidentally commit your `.env` file. Here's what your `.env` file might look like:
|
136
|
+
|
137
|
+
```
|
138
|
+
GITHUB_CLIENT_SECRET=abcdefghijklmnopqrstuvwxyz0123456789
|
139
|
+
GITHUB_CLIENT_ID=qwertyuiop0001
|
140
|
+
GITHUB_TEAM_ID=12345
|
141
|
+
```
|
142
|
+
|
143
|
+
## Under the hood
|
144
|
+
|
145
|
+
Every time you push to Heroku, we take advantage of the fact that Heroku automatically runs the `rake assets:precompile` command (normally used for Rails sites) to build our Bunto site and store it statically, just like GitHub pages would.
|
146
|
+
|
147
|
+
Anytime a request comes in for a page, we run it through [Sinatra](http://www.sinatrarb.com/) (using the `_site` folder as the static file folder, just as `public` would be normally), and authenticate it using [sinatra\_auth\_github](https://github.com/atmos/sinatra_auth_github).
|
148
|
+
|
149
|
+
If they're in the org, they get the page. Otherwise, all they ever get is [the bouncer](https://octodex.github.com/bouncer/).
|
150
|
+
|
151
|
+
## Upgrading from Bunto Auth < 0.1.0
|
152
|
+
|
153
|
+
1. `cd` to your project directory
|
154
|
+
2. `rm config.ru`
|
155
|
+
3. `rm Procfile`
|
156
|
+
4. Remove any Bunto Auth specific requirements from your `Gemfile`
|
157
|
+
5. Follow [the instructions above](https://github.com/bunto/bunto-auth#add-bunto-auth-to-your-site) to get started
|
158
|
+
6. When prompted, select "n" if Heroku is already set up
|
159
|
+
|
160
|
+
## Troubleshooting
|
161
|
+
|
162
|
+
* **ERROR: YOUR SITE COULD NOT BE BUILT** during install, either locally or on Heroku. You likely need to add `exclude: [vendor]` to `_config.yml` in your branch's root directory (create the file if it does not exist already). If you still have problems on the *local* install, you may have better luck using `bundle install --deployment`, but be sure to add the resulting 'vendor' directory to .gitignore. For completeness, the full error may look something like this:
|
163
|
+
|
164
|
+
|
165
|
+
```
|
166
|
+
remote: Configuration file: none
|
167
|
+
remote: ERROR: YOUR SITE COULD NOT BE BUILT:
|
168
|
+
remote: ------------------------------------
|
169
|
+
remote: Invalid date '0000-00-00': Post '/vendor/bundle/ruby/2.0.0/gems/bunto-2.5.3/lib/site_template/_posts/0000-00-00-welcome-to-bunto.markdown.erb' does not have a valid date in the filename.
|
170
|
+
```
|
171
|
+
|
172
|
+
* **Pushing to heroku**. If you are working from a new GitHub-cloned repo (where you have not run `heroku create`), you may also want to push to Heroku. Instead of adding the remote in the standard way with Git, do this:
|
173
|
+
|
174
|
+
|
175
|
+
```
|
176
|
+
heroku git:remote -a my-site
|
177
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems/package_task'
|
2
|
+
require 'rubygems/specification'
|
3
|
+
require 'bundler'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'dotenv'
|
6
|
+
|
7
|
+
task default: [:spec]
|
8
|
+
|
9
|
+
task :site do
|
10
|
+
Dotenv.load
|
11
|
+
FileUtils.chdir 'templates'
|
12
|
+
`bundle exec bunto-auth`
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
desc 'Run specs'
|
17
|
+
RSpec::Core::RakeTask.new do |t|
|
18
|
+
t.pattern = 'spec/**/*_spec.rb'
|
19
|
+
t.rspec_opts = ['--order', 'rand', '--color']
|
20
|
+
end
|
data/bin/bunto-auth
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Command-line interface for bunto-auth
|
3
|
+
|
4
|
+
require "mercenary"
|
5
|
+
require "bunto-auth"
|
6
|
+
require "open3"
|
7
|
+
|
8
|
+
Mercenary.program("bunto-auth") do |p|
|
9
|
+
p.version BuntoAuth::VERSION
|
10
|
+
p.description "A simple way to use Github OAuth to serve a protected bunto site to your GitHub organization"
|
11
|
+
p.syntax "bunto-auth <subcommand> options"
|
12
|
+
|
13
|
+
p.command(:new) do |c|
|
14
|
+
c.syntax "new"
|
15
|
+
c.description "Initialize an existing Bunto site as a Bunto Auth site"
|
16
|
+
c.action do |_args, _options|
|
17
|
+
BuntoAuth::Commands.copy_templates
|
18
|
+
|
19
|
+
if BuntoAuth::Commands.changed?
|
20
|
+
puts "Looks like we've made some changes, you may want to do a git commit and git push sometime soon".yellow
|
21
|
+
end
|
22
|
+
|
23
|
+
puts "Setup complete. Run `bunto-auth` to view the authenticated site."
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Run the standard bunto build command
|
28
|
+
# Called by Rake task, to allow the gem
|
29
|
+
# to add functionality here in the future
|
30
|
+
p.command(:build) do |c|
|
31
|
+
c.syntax "build"
|
32
|
+
c.description "Build the Bunto site"
|
33
|
+
c.action do |_args, options|
|
34
|
+
require "bunto"
|
35
|
+
Bunto::Commands::Build.process(options)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
p.command(:team_id) do |c|
|
40
|
+
c.syntax "team_id --org <ORG> --team <TEAM>"
|
41
|
+
c.description "Retrieve a team's ID"
|
42
|
+
c.option "org", "--org <ORG>", 'The GitHub Organization, e.g., "bunto"'
|
43
|
+
c.option "team", "--team <TEAM>", 'The team name, e.g., "maintainers"'
|
44
|
+
|
45
|
+
c.action do |_args, options|
|
46
|
+
unless BuntoAuth::Commands.env_var_set? "GITHUB_TOKEN"
|
47
|
+
puts "You'll need to go to https://github.com/settings/tokens/new and create a personal access token".red
|
48
|
+
puts "Once you've got the token, prefix the bunto-auth command with GITHUB_TOKEN=[YOUR TOKEN]".red
|
49
|
+
puts "You can also add it to a `.env` file in this directory".red
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
|
53
|
+
org = options["org"] || ENV["GITHUB_ORG_NAME"]
|
54
|
+
team = options["team"]
|
55
|
+
|
56
|
+
if org.nil? || team.nil?
|
57
|
+
puts "An org name and team ID are required.".red
|
58
|
+
puts "Usage: bunto-auth team_id --org <ORG> --team <TEAM>"
|
59
|
+
exit 1
|
60
|
+
end
|
61
|
+
|
62
|
+
team_id = BuntoAuth::Commands.team_id(org, team)
|
63
|
+
|
64
|
+
if team_id
|
65
|
+
puts "The team ID for `@#{org}/#{team}` is `#{team_id}`".green
|
66
|
+
else
|
67
|
+
puts "Couldn't find the `@#{org}/#{team}` team.".red
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
p.command(:serve) do |c|
|
73
|
+
c.syntax "serve"
|
74
|
+
c.description "Run Bunto Auth site locally"
|
75
|
+
c.option "host", "--host <HOST>", "Listen at the given hostname, e.g., 127.0.0.1"
|
76
|
+
c.option "port", "--port <PORT>", "Listen on the given port, e.g., 4000"
|
77
|
+
|
78
|
+
c.action do |_args, options|
|
79
|
+
# Ensure environmental variables are set
|
80
|
+
unless %w(GITHUB_CLIENT_ID GITHUB_CLIENT_SECRET).all? { |v| BuntoAuth::Commands.env_var_set?(v) }
|
81
|
+
puts "Whoops. Looks like you forgot to tell Bunto Auth about your app".red
|
82
|
+
puts "Be sure to run export GITHUB_CLIENT_ID=[client id], export GITHUB_CLIENT_SECRET=[client secret], and export GITHUB_ORG_NAME=[org name] (or GITHUB_TEAM_ID)".red
|
83
|
+
puts "See the readme for more information on where to find these".red
|
84
|
+
exit 1
|
85
|
+
end
|
86
|
+
|
87
|
+
# build site
|
88
|
+
p.go ["build"]
|
89
|
+
|
90
|
+
host = options["host"] || "0.0.0.0"
|
91
|
+
port = options["port"] || "4000"
|
92
|
+
|
93
|
+
puts "Spinning up the server with authentication. Use CTRL-C to stop."
|
94
|
+
puts "To preview the site without authentication, use the `bunto serve` command"
|
95
|
+
BuntoAuth::Commands.execute_command "bundle", "exec", "rackup", "-o", host, "-p", port
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
p.command(:setup) do |c|
|
100
|
+
c.syntax "setup"
|
101
|
+
c.description "Configure Heroku for use with your Bunto Auth site"
|
102
|
+
c.option "client_id", "--client_id", "Your oauth app client id"
|
103
|
+
c.option "client_secret", "--client_secret", "Your oauth app client secret"
|
104
|
+
c.option "team_id", "--team_id", "The team to authenticate against"
|
105
|
+
c.option "org_name", "--org_name", "An organization to authenticate against"
|
106
|
+
c.action do |_args, options|
|
107
|
+
if find_executable("heroku").nil?
|
108
|
+
say "Looks like we're missing the Heroku client. Let's see if we can't install it..."
|
109
|
+
BuntoAuth::Commands.execute_command "wget", "-qO-", "https://toolbelt.heroku.com/install.sh", "|", "sh"
|
110
|
+
end
|
111
|
+
|
112
|
+
BuntoAuth::Commands.init_repo
|
113
|
+
BuntoAuth::Commands.initial_commit if BuntoAuth::Commands.changed?
|
114
|
+
|
115
|
+
if BuntoAuth::Commands.heroku_remote_set?
|
116
|
+
puts "Looks like you've already got heroku set up... skipping.".green
|
117
|
+
else
|
118
|
+
puts "Creating a new Heroku app."
|
119
|
+
BuntoAuth::Commands.execute_command "heroku", "create"
|
120
|
+
end
|
121
|
+
|
122
|
+
puts "Configuring the Heroku app"
|
123
|
+
BuntoAuth::Commands.configure_heroku(options)
|
124
|
+
|
125
|
+
puts "Pushing to Heroku"
|
126
|
+
BuntoAuth::Commands.execute_command "git", "push", "heroku", "master", "--force"
|
127
|
+
|
128
|
+
puts "Lets check if it worked"
|
129
|
+
BuntoAuth::Commands.execute_command "heroku", "open"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
p.default_command(:serve)
|
134
|
+
end
|
data/bunto-auth.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require './lib/bunto_auth/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'bunto-auth'
|
5
|
+
s.version = BuntoAuth::VERSION
|
6
|
+
s.summary = 'A simple way to use GitHub OAuth to serve a protected Bunto site to your GitHub organization'
|
7
|
+
s.description = 'A simple way to use GitHub OAuth to serve a protected Bunto site to your GitHub organization.'
|
8
|
+
s.authors = ['Ben Balter', 'Suriyaa Kudo']
|
9
|
+
s.email = ['ben@balter.com', 'suriyaa@bunto.tk']
|
10
|
+
s.homepage = 'https://github.com/bunto/bunto-auth'
|
11
|
+
s.license = 'MIT'
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
|
17
|
+
s.add_dependency 'bunto', '~> 3.2.1'
|
18
|
+
s.add_dependency 'sinatra-index', '~> 0.0'
|
19
|
+
s.add_dependency 'sinatra_auth_github', '~> 1.1'
|
20
|
+
s.add_dependency 'rack', '~> 1.6'
|
21
|
+
s.add_dependency 'dotenv', '~> 2.0'
|
22
|
+
s.add_dependency 'rake', '~> 10.3'
|
23
|
+
s.add_dependency 'rack-ssl-enforcer', '~> 0.2'
|
24
|
+
s.add_dependency 'mercenary', '~> 0.3'
|
25
|
+
s.add_dependency 'safe_yaml', '~> 1.0'
|
26
|
+
s.add_dependency 'colorator', '~> 1.0'
|
27
|
+
s.add_dependency 'activesupport', '~> 4.0'
|
28
|
+
s.add_development_dependency 'rspec', '~> 3.1'
|
29
|
+
s.add_development_dependency 'rack-test', '~> 0.6'
|
30
|
+
s.add_development_dependency 'webmock', '~> 1.2 '
|
31
|
+
s.add_development_dependency 'pry', '~> 0.10'
|
32
|
+
s.add_development_dependency 'rubocop', '~> 0.35'
|
33
|
+
end
|
data/lib/bunto-auth.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "sinatra-index"
|
2
|
+
require "sinatra_auth_github"
|
3
|
+
require "dotenv"
|
4
|
+
require "safe_yaml"
|
5
|
+
require "colorator"
|
6
|
+
require "mkmf"
|
7
|
+
require_relative "bunto_auth/version"
|
8
|
+
require_relative "bunto_auth/helpers"
|
9
|
+
require_relative "bunto_auth/config"
|
10
|
+
require_relative "bunto_auth/auth_site"
|
11
|
+
require_relative "bunto_auth/bunto_site"
|
12
|
+
require_relative "bunto_auth/config_error"
|
13
|
+
require_relative "bunto_auth/commands"
|
14
|
+
require_relative "bunto_auth/sinatra/auth/github"
|
15
|
+
|
16
|
+
Dotenv.load
|
17
|
+
|
18
|
+
class BuntoAuth
|
19
|
+
def self.site
|
20
|
+
Rack::Builder.new do
|
21
|
+
use BuntoAuth::AuthSite
|
22
|
+
run BuntoAuth::BuntoSite
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|