jekyll-auth 1.0.2 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +3 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
  5. data/.github/config.yml +23 -0
  6. data/.github/funding.yml +1 -0
  7. data/.github/no-response.yml +15 -0
  8. data/.github/release-drafter.yml +4 -0
  9. data/.github/settings.yml +33 -0
  10. data/.github/stale.yml +29 -0
  11. data/.rubocop.yml +28 -0
  12. data/.travis.yml +5 -1
  13. data/Gemfile +2 -0
  14. data/Rakefile +9 -7
  15. data/bin/jekyll-auth +36 -36
  16. data/docs/CODE_OF_CONDUCT.md +46 -0
  17. data/docs/CONTRIBUTING.md +88 -0
  18. data/docs/README.md +33 -0
  19. data/docs/SECURITY.md +3 -0
  20. data/docs/_config.yml +2 -0
  21. data/docs/configuring.md +36 -0
  22. data/docs/getting-started.md +63 -0
  23. data/docs/running-locally.md +24 -0
  24. data/docs/troubleshooting.md +31 -0
  25. data/jekyll-auth.gemspec +22 -15
  26. data/lib/jekyll-auth.rb +16 -13
  27. data/lib/jekyll_auth/auth_site.rb +12 -15
  28. data/lib/jekyll_auth/commands.rb +12 -9
  29. data/lib/jekyll_auth/config.rb +15 -8
  30. data/lib/jekyll_auth/config_error.rb +3 -2
  31. data/lib/jekyll_auth/helpers.rb +6 -3
  32. data/lib/jekyll_auth/jekyll_site.rb +6 -5
  33. data/lib/jekyll_auth/sinatra/auth/github.rb +8 -4
  34. data/lib/jekyll_auth/version.rb +3 -1
  35. data/script/cibuild +5 -0
  36. data/spec/jekyll_auth_auth_site_spec.rb +17 -17
  37. data/spec/jekyll_auth_bin_spec.rb +12 -11
  38. data/spec/jekyll_auth_commands_spec.rb +6 -5
  39. data/spec/jekyll_auth_helpers_spec.rb +5 -4
  40. data/spec/jekyll_auth_jekyll_site_spec.rb +2 -1
  41. data/spec/jekyll_auth_spec.rb +5 -4
  42. data/spec/spec_helper.rb +14 -9
  43. data/templates/.gitignore +0 -1
  44. data/templates/Rakefile +2 -0
  45. data/templates/config.ru +2 -0
  46. metadata +150 -45
  47. data/README.md +0 -149
metadata CHANGED
@@ -1,99 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-16 00:00:00.000000000 Z
11
+ date: 2021-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: jekyll
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '5'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7'
33
+ - !ruby/object:Gem::Dependency
34
+ name: colorator
15
35
  requirement: !ruby/object:Gem::Requirement
16
36
  requirements:
17
37
  - - "~>"
18
38
  - !ruby/object:Gem::Version
19
- version: '2.0'
39
+ version: '1.0'
20
40
  type: :runtime
21
41
  prerelease: false
22
42
  version_requirements: !ruby/object:Gem::Requirement
23
43
  requirements:
24
44
  - - "~>"
25
45
  - !ruby/object:Gem::Version
26
- version: '2.0'
46
+ version: '1.0'
27
47
  - !ruby/object:Gem::Dependency
28
- name: sinatra-index
48
+ name: dotenv
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
51
  - - "~>"
32
52
  - !ruby/object:Gem::Version
33
- version: '0.0'
53
+ version: '2.0'
34
54
  type: :runtime
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
58
  - - "~>"
39
59
  - !ruby/object:Gem::Version
40
- version: '0.0'
60
+ version: '2.0'
41
61
  - !ruby/object:Gem::Dependency
42
- name: sinatra_auth_github
62
+ name: jekyll
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
65
  - - "~>"
46
66
  - !ruby/object:Gem::Version
47
- version: '1.1'
67
+ version: '4.0'
48
68
  type: :runtime
49
69
  prerelease: false
50
70
  version_requirements: !ruby/object:Gem::Requirement
51
71
  requirements:
52
72
  - - "~>"
53
73
  - !ruby/object:Gem::Version
54
- version: '1.1'
74
+ version: '4.0'
55
75
  - !ruby/object:Gem::Dependency
56
- name: rack
76
+ name: mercenary
57
77
  requirement: !ruby/object:Gem::Requirement
58
78
  requirements:
59
- - - '='
79
+ - - "~>"
60
80
  - !ruby/object:Gem::Version
61
- version: 1.5.2
81
+ version: '0.3'
62
82
  type: :runtime
63
83
  prerelease: false
64
84
  version_requirements: !ruby/object:Gem::Requirement
65
85
  requirements:
66
- - - '='
86
+ - - "~>"
67
87
  - !ruby/object:Gem::Version
68
- version: 1.5.2
88
+ version: '0.3'
69
89
  - !ruby/object:Gem::Dependency
70
- name: dotenv
90
+ name: rack
71
91
  requirement: !ruby/object:Gem::Requirement
72
92
  requirements:
73
93
  - - "~>"
74
94
  - !ruby/object:Gem::Version
75
- version: '1.0'
95
+ version: '1.6'
76
96
  type: :runtime
77
97
  prerelease: false
78
98
  version_requirements: !ruby/object:Gem::Requirement
79
99
  requirements:
80
100
  - - "~>"
81
101
  - !ruby/object:Gem::Version
82
- version: '1.0'
102
+ version: '1.6'
83
103
  - !ruby/object:Gem::Dependency
84
- name: rake
104
+ name: rack-protection
85
105
  requirement: !ruby/object:Gem::Requirement
86
106
  requirements:
87
107
  - - "~>"
88
108
  - !ruby/object:Gem::Version
89
- version: '10.3'
109
+ version: '1.5'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 1.5.5
90
113
  type: :runtime
91
114
  prerelease: false
92
115
  version_requirements: !ruby/object:Gem::Requirement
93
116
  requirements:
94
117
  - - "~>"
95
118
  - !ruby/object:Gem::Version
96
- version: '10.3'
119
+ version: '1.5'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 1.5.5
97
123
  - !ruby/object:Gem::Dependency
98
124
  name: rack-ssl-enforcer
99
125
  requirement: !ruby/object:Gem::Requirement
@@ -109,19 +135,19 @@ dependencies:
109
135
  - !ruby/object:Gem::Version
110
136
  version: '0.2'
111
137
  - !ruby/object:Gem::Dependency
112
- name: mercenary
138
+ name: rake
113
139
  requirement: !ruby/object:Gem::Requirement
114
140
  requirements:
115
141
  - - "~>"
116
142
  - !ruby/object:Gem::Version
117
- version: '0.3'
143
+ version: '13.0'
118
144
  type: :runtime
119
145
  prerelease: false
120
146
  version_requirements: !ruby/object:Gem::Requirement
121
147
  requirements:
122
148
  - - "~>"
123
149
  - !ruby/object:Gem::Version
124
- version: '0.3'
150
+ version: '13.0'
125
151
  - !ruby/object:Gem::Dependency
126
152
  name: safe_yaml
127
153
  requirement: !ruby/object:Gem::Requirement
@@ -137,33 +163,47 @@ dependencies:
137
163
  - !ruby/object:Gem::Version
138
164
  version: '1.0'
139
165
  - !ruby/object:Gem::Dependency
140
- name: colorator
166
+ name: sinatra-index
141
167
  requirement: !ruby/object:Gem::Requirement
142
168
  requirements:
143
169
  - - "~>"
144
170
  - !ruby/object:Gem::Version
145
- version: '0.1'
171
+ version: '0.0'
146
172
  type: :runtime
147
173
  prerelease: false
148
174
  version_requirements: !ruby/object:Gem::Requirement
149
175
  requirements:
150
176
  - - "~>"
151
177
  - !ruby/object:Gem::Version
152
- version: '0.1'
178
+ version: '0.0'
153
179
  - !ruby/object:Gem::Dependency
154
- name: rspec
180
+ name: sinatra_auth_github
155
181
  requirement: !ruby/object:Gem::Requirement
156
182
  requirements:
157
183
  - - "~>"
158
184
  - !ruby/object:Gem::Version
159
- version: '3.1'
185
+ version: '1.1'
186
+ type: :runtime
187
+ prerelease: false
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - "~>"
191
+ - !ruby/object:Gem::Version
192
+ version: '1.1'
193
+ - !ruby/object:Gem::Dependency
194
+ name: pry
195
+ requirement: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - "~>"
198
+ - !ruby/object:Gem::Version
199
+ version: '0.10'
160
200
  type: :development
161
201
  prerelease: false
162
202
  version_requirements: !ruby/object:Gem::Requirement
163
203
  requirements:
164
204
  - - "~>"
165
205
  - !ruby/object:Gem::Version
166
- version: '3.1'
206
+ version: '0.10'
167
207
  - !ruby/object:Gem::Dependency
168
208
  name: rack-test
169
209
  requirement: !ruby/object:Gem::Requirement
@@ -179,34 +219,82 @@ dependencies:
179
219
  - !ruby/object:Gem::Version
180
220
  version: '0.6'
181
221
  - !ruby/object:Gem::Dependency
182
- name: webmock
222
+ name: rspec
183
223
  requirement: !ruby/object:Gem::Requirement
184
224
  requirements:
185
225
  - - "~>"
186
226
  - !ruby/object:Gem::Version
187
- version: '1.2'
227
+ version: '3.1'
188
228
  type: :development
189
229
  prerelease: false
190
230
  version_requirements: !ruby/object:Gem::Requirement
191
231
  requirements:
192
232
  - - "~>"
193
233
  - !ruby/object:Gem::Version
194
- version: '1.2'
234
+ version: '3.1'
195
235
  - !ruby/object:Gem::Dependency
196
- name: pry
236
+ name: rubocop
197
237
  requirement: !ruby/object:Gem::Requirement
198
238
  requirements:
199
239
  - - "~>"
200
240
  - !ruby/object:Gem::Version
201
- version: '0.10'
241
+ version: '0.49'
242
+ - - ">="
243
+ - !ruby/object:Gem::Version
244
+ version: 0.49.0
202
245
  type: :development
203
246
  prerelease: false
204
247
  version_requirements: !ruby/object:Gem::Requirement
205
248
  requirements:
206
249
  - - "~>"
207
250
  - !ruby/object:Gem::Version
208
- version: '0.10'
209
- description: A simple way to use Github Oauth to serve a protected jekyll site to
251
+ version: '0.49'
252
+ - - ">="
253
+ - !ruby/object:Gem::Version
254
+ version: 0.49.0
255
+ - !ruby/object:Gem::Dependency
256
+ name: rubocop-jekyll
257
+ requirement: !ruby/object:Gem::Requirement
258
+ requirements:
259
+ - - "~>"
260
+ - !ruby/object:Gem::Version
261
+ version: 0.11.0
262
+ type: :development
263
+ prerelease: false
264
+ version_requirements: !ruby/object:Gem::Requirement
265
+ requirements:
266
+ - - "~>"
267
+ - !ruby/object:Gem::Version
268
+ version: 0.11.0
269
+ - !ruby/object:Gem::Dependency
270
+ name: rubocop-performance
271
+ requirement: !ruby/object:Gem::Requirement
272
+ requirements:
273
+ - - "~>"
274
+ - !ruby/object:Gem::Version
275
+ version: '1.0'
276
+ type: :development
277
+ prerelease: false
278
+ version_requirements: !ruby/object:Gem::Requirement
279
+ requirements:
280
+ - - "~>"
281
+ - !ruby/object:Gem::Version
282
+ version: '1.0'
283
+ - !ruby/object:Gem::Dependency
284
+ name: webmock
285
+ requirement: !ruby/object:Gem::Requirement
286
+ requirements:
287
+ - - "~>"
288
+ - !ruby/object:Gem::Version
289
+ version: '2.3'
290
+ type: :development
291
+ prerelease: false
292
+ version_requirements: !ruby/object:Gem::Requirement
293
+ requirements:
294
+ - - "~>"
295
+ - !ruby/object:Gem::Version
296
+ version: '2.3'
297
+ description: A simple way to use GitHub OAuth to serve a protected jekyll site to
210
298
  your GitHub organization.
211
299
  email: ben@balter.com
212
300
  executables:
@@ -214,12 +302,30 @@ executables:
214
302
  extensions: []
215
303
  extra_rdoc_files: []
216
304
  files:
305
+ - ".github/CODEOWNERS"
306
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
307
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
308
+ - ".github/config.yml"
309
+ - ".github/funding.yml"
310
+ - ".github/no-response.yml"
311
+ - ".github/release-drafter.yml"
312
+ - ".github/settings.yml"
313
+ - ".github/stale.yml"
217
314
  - ".gitignore"
315
+ - ".rubocop.yml"
218
316
  - ".travis.yml"
219
317
  - Gemfile
220
- - README.md
221
318
  - Rakefile
222
319
  - bin/jekyll-auth
320
+ - docs/CODE_OF_CONDUCT.md
321
+ - docs/CONTRIBUTING.md
322
+ - docs/README.md
323
+ - docs/SECURITY.md
324
+ - docs/_config.yml
325
+ - docs/configuring.md
326
+ - docs/getting-started.md
327
+ - docs/running-locally.md
328
+ - docs/troubleshooting.md
223
329
  - jekyll-auth.gemspec
224
330
  - lib/jekyll-auth.rb
225
331
  - lib/jekyll_auth/auth_site.rb
@@ -252,7 +358,7 @@ homepage: https://github.com/benbalter/jekyll-auth
252
358
  licenses:
253
359
  - MIT
254
360
  metadata: {}
255
- post_install_message:
361
+ post_install_message:
256
362
  rdoc_options: []
257
363
  require_paths:
258
364
  - lib
@@ -267,11 +373,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
373
  - !ruby/object:Gem::Version
268
374
  version: '0'
269
375
  requirements: []
270
- rubyforge_project:
271
- rubygems_version: 2.2.0
272
- signing_key:
376
+ rubygems_version: 3.2.15
377
+ signing_key:
273
378
  specification_version: 4
274
- summary: A simple way to use Github OAuth to serve a protected jekyll site to your
379
+ summary: A simple way to use GitHub OAuth to serve a protected jekyll site to your
275
380
  GitHub organization
276
381
  test_files:
277
382
  - spec/jekyll_auth_auth_site_spec.rb
data/README.md DELETED
@@ -1,149 +0,0 @@
1
- # Jekyll Auth
2
-
3
- *A simple way to use GitHub OAuth to serve a protected Jekyll site to your GitHub organization*
4
-
5
- [![Gem Version](https://badge.fury.io/rb/jekyll-auth.png)](http://badge.fury.io/rb/jekyll-auth) [![Build Status](https://travis-ci.org/benbalter/jekyll-auth.png?branch=master)](https://travis-ci.org/benbalter/jekyll-auth)
6
-
7
- ## The problem
8
-
9
- [Jekyll](http://github.com/mojombo/jekyll) and [GitHub Pages](http://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](http://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 Jekyll 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
27
- 4. Hit Save, but leave the page open, you'll need some of the information in a moment
28
-
29
- ### Add Jekyll Auth to your site
30
-
31
- 1. Add `gem 'jekyll-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:
32
-
33
- ```ruby
34
- source "https://rubygems.org"
35
-
36
- gem 'jekyll-auth'
37
- ```
38
-
39
- 2. `cd` into your project's directory and run `bundle install`.
40
-
41
- 3. Run `bundle exec jekyll-auth new` which will copy the necessary files to set up the server
42
-
43
- ### Setting up hosting with Heroku
44
-
45
- #### Automatically
46
-
47
- Run `bundle exec jekyll-auth --client_id XXX --client_secret XXX --org_id XXX`
48
-
49
- (or `--team_id XXX`)
50
-
51
- #### Manually
52
-
53
- 1. You may need to add and commit the files generated by `jekyll-auth new` to Git before continuing
54
- 2. Make sure you have [the Heroku toolbelt](https://toolbelt.heroku.com/) installed
55
- 3. Run `herkou create` from your site's directory
56
- 4. `heroku config:set GITHUB_CLIENT_ID=XXX GITHUB_CLIENT_SECRET=XXX GITHUB_ORG_ID=XXX` (or `GITHUB_TEAM_ID`)
57
- 5. `git push heroku`
58
- 6. `heroku open` to open the site in your browser
59
-
60
- #### Finding the team ID
61
-
62
- If you need help finding a team's numeric ID, you can use the `jekyll-auth team_id` command.
63
-
64
- For example, to find the team ID for @jekyll/maintainers you'd run the command:
65
-
66
- ```
67
- jekyll-auth team_id --org jekyll --team maintainers
68
- ```
69
-
70
- You'll want to add a [personal access token](https://github.com/settings/tokens/new) to your `.env` file so that Jekyll-Auth can make the necessary API request, but the command will run you through the process if you dont.
71
-
72
- ## Configuration
73
-
74
- ### Whitelisting
75
-
76
- Don't want to require authentication for every part of your site? Fine! Add a whitelist to your Jekyll's *_config.yml_* file:
77
-
78
- ```yaml
79
- jekyll_auth:
80
- whitelist:
81
- - drafts?
82
- ```
83
-
84
- `jekyll_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.
85
-
86
- 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:
87
-
88
- ```yaml
89
- jekyll_auth:
90
- whitelist:
91
- - "^((?!draft).)*$"
92
- ```
93
-
94
- There is also a more [extensive article containing installation instructions for Jekyll-Auth](http://fabian-kostadinov.github.io/2014/11/13/installation-of-jekyll-auth/) and a second one on [how to find your GitHub team ID](http://fabian-kostadinov.github.io/2015/01/16/how-to-find-a-github-team-id/).
95
-
96
- ### Requiring SSL
97
-
98
- 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.
99
-
100
- ```yaml
101
- jekyll_auth:
102
- ssl: true
103
- ```
104
-
105
- ### Using a custom 404
106
-
107
- Just like GitHub Pages, Jekyll Auth will honor a custom 404 page, if it's generated as `/404.html` in the built site.
108
-
109
- ## Running locally
110
-
111
- Want to run it locally?
112
-
113
- ### Without authentication
114
-
115
- Just run `jekyll serve` as you would normally
116
-
117
- ### With authentication
118
-
119
- 1. `export GITHUB_CLIENT_ID=[your github app client id]`
120
- 2. `export GITHUB_CLIENT_SECRET=[your github app client secret]`
121
- 3. `export GITHUB_ORG_ID=[org id]` or `export GITHUB_TEAM_ID=[team id]` or `export GITHUB_TEAM_IDS=1234,5678`
122
- 4. `jekyll-auth serve`
123
-
124
- *Pro-tip #1:* For sanity 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.
125
-
126
- *Pro-tip #2*: Jekyll 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 `jekyll-auth new`, but be sure not to accidentally commit your `.env` file. Here's what your `.env` file might look like:
127
-
128
- ```
129
- GITHUB_CLIENT_SECRET=abcdefghijklmnopqrstuvwxyz0123456789
130
- GITHUB_CLIENT_ID=qwertyuiop0001
131
- GITHUB_TEAM_ID=12345
132
- ```
133
-
134
- ## Under the hood
135
-
136
- 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 Jekyll site and store it statically, just like GitHub pages would.
137
-
138
- 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).
139
-
140
- If they're in the org, they get the page. Otherwise, all they ever get is [the bouncer](http://octodex.github.com/bouncer/).
141
-
142
- ## Upgrading from Jekyll Auth < 0.1.0
143
-
144
- 1. `cd` to your project directory
145
- 2. `rm config.ru`
146
- 3. `rm Procfile`
147
- 4. Remove any Jekyll Auth specific requirements from your `Gemfile`
148
- 5. Follow [the instructions above](https://github.com/benbalter/jekyll-auth#add-jekyll-auth-to-your-site) to get started
149
- 6. When prompted, select "n" if Heroku is already set up