omnigollum 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73942537eee3fb79bf6989e56f321c69ae2dc4e7
4
- data.tar.gz: 7f320cea5738ca60aea8146b49160fbf8351409a
3
+ metadata.gz: 7e71dec029dc000cf53c14360c11a05eef251188
4
+ data.tar.gz: 174f16d40ad98606bbd574f2381d988d49220496
5
5
  SHA512:
6
- metadata.gz: 5562795daf7d367bea28543e69167da5723568ec167709104004b8de8a7340f70c0db96a1a00e73178cbeff28e325b7b4e66188f7e84b5bd91a5025b4c352b5a
7
- data.tar.gz: c4cf2be7e76a75872c114688c1faf826cc3bef2403c908545a77492f4f177c9fe63282c69eb9eb0bc4f8ac826312c30df415b1db8ad9a9260dae856ecf9f9c3e
6
+ metadata.gz: 805e92e761842820825f42ffb31cf741a27ad58a3b806200849f941c5d8587ed14bc97e330600d29dbc057ae8607df7f93ab09ad8c5e8ae9faf12ec37e65480a
7
+ data.tar.gz: 1a39c99a8756d102e4623e2d81488ddd4063d9faa3e342a3bc1219e9ba8e004016afaf401ffb81688c21138df8f54f63c1c23e45b77575d56db726686a0f5e15
data/Readme.md CHANGED
@@ -67,7 +67,7 @@ By default, any authenticated user will be able to access the protected routes.
67
67
  options[:authorized_users] = ["example0@example.org", "example1@example.org", "example2@example.org"]
68
68
  ```
69
69
 
70
- Instead of setting these directly, you can use an [env var](http://www.12factor.net/config), maybe like this:
70
+ Instead of setting these directly, you can use an env var, maybe like this:
71
71
 
72
72
  ```ruby
73
73
  # in .env, or other
@@ -85,7 +85,7 @@ Precious::App.register Omnigollum::Sinatra
85
85
 
86
86
  ### Gollum
87
87
  You can (optionally) apply the patches here, to get a neat little auth
88
- status widget in the top right corner of the page https://github.com/arr2036/gollum/commit/32de2cad920ccc6e955b8e19f6e23c2b3b4c8964
88
+ status widget in the top right corner of the page https://github.com/arr2036/gollum/commit/30857db6ba5a2100c0d392cb0de205e644430d13
89
89
 
90
90
 
91
91
 
data/lib/omnigollum.rb CHANGED
@@ -97,6 +97,13 @@ module Omnigollum
97
97
  end
98
98
  end
99
99
 
100
+ def show_error
101
+ options = settings.send(:omnigollum)
102
+ auth_config
103
+ require options[:path_views] + '/error'
104
+ halt mustache Omnigollum::Views::Error
105
+ end
106
+
100
107
  def commit_message
101
108
  if user_authed?
102
109
  user = get_user
@@ -124,6 +131,8 @@ module Omnigollum
124
131
  '/edit',
125
132
  '/rename/*',
126
133
  '/rename/',
134
+ '/upload/*',
135
+ '/upload/',
127
136
  '/delete/*',
128
137
  '/delete'],
129
138
 
@@ -239,7 +248,7 @@ module Omnigollum
239
248
  @title = 'Authentication failed'
240
249
  @subtext = "Provider did not validate your credentials (#{params[:message]}) - please retry or choose another login service"
241
250
  @auth_params = "?origin=#{CGI.escape(request.env['omniauth.origin'])}" unless request.env['omniauth.origin'].nil?
242
- show_login
251
+ show_error
243
252
  end
244
253
 
245
254
  app.before options[:route_prefix] + '/auth/:name/callback' do
@@ -253,7 +262,7 @@ module Omnigollum
253
262
  @title = 'Authorization failed'
254
263
  @subtext = 'User was not found in the authorized users list'
255
264
  @auth_params = "?origin=#{CGI.escape(request.env['omniauth.origin'])}" unless request.env['omniauth.origin'].nil?
256
- show_login
265
+ show_error
257
266
  end
258
267
 
259
268
  session[:omniauth_user] = user
@@ -269,13 +278,13 @@ module Omnigollum
269
278
  @title = 'Authentication failed'
270
279
  @subtext = 'Omniauth experienced an error processing your request'
271
280
  @auth_params = "?origin=#{CGI.escape(request.env['omniauth.origin'])}" unless request.env['omniauth.origin'].nil?
272
- show_login
281
+ show_error
273
282
  end
274
283
  rescue StandardError => fail_reason
275
284
  @title = 'Authentication failed'
276
285
  @subtext = fail_reason
277
286
  @auth_params = "?origin=#{CGI.escape(request.env['omniauth.origin'])}" unless request.env['omniauth.origin'].nil?
278
- show_login
287
+ show_error
279
288
  end
280
289
  end
281
290
 
@@ -0,0 +1,7 @@
1
+ <div id="wiki-wrapper" class="markdown-body">
2
+ <h2>{{title}}</h2>
3
+ <div id="login" class="login_form">
4
+ <h3>{{subtext}}</h3>
5
+ <a href="{{loginurl}}">Try again</a>
6
+ </div>
7
+ </div>
data/views/error.rb ADDED
@@ -0,0 +1,20 @@
1
+ module Omnigollum
2
+ module Views
3
+ class Error < Mustache
4
+ self.template_path = File.expand_path("../../templates", __FILE__)
5
+ self.template_name = 'Error'
6
+
7
+ def title
8
+ @title
9
+ end
10
+
11
+ def subtext
12
+ @subtext
13
+ end
14
+
15
+ def loginurl
16
+ @auth[:route_prefix] + 'login' + (defined?(@auth_params) ? @auth_params : '')
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnigollum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arran Cudbard-Bell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-12 00:00:00.000000000 Z
12
+ date: 2014-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gollum
@@ -43,14 +43,14 @@ dependencies:
43
43
  name: mustache
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: 0.99.5
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.99.5
56
56
  description: |
@@ -76,7 +76,9 @@ files:
76
76
  - public/images/open_id_logo.png
77
77
  - public/images/twitter_logo.png
78
78
  - public/images/youtube_logo.png
79
+ - templates/Error.mustache
79
80
  - templates/Login.mustache
81
+ - views/error.rb
80
82
  - views/login.rb
81
83
  homepage: https://github.com/arr2036/omnigollum
82
84
  licenses:
@@ -99,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
101
  version: '0'
100
102
  requirements: []
101
103
  rubyforge_project:
102
- rubygems_version: 2.1.5
104
+ rubygems_version: 2.0.14
103
105
  signing_key:
104
106
  specification_version: 4
105
107
  summary: Omnigollum makes it easy to use OmniAuth with Gollum