gollum-auth 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c48dfb142646b389d1c3f48b86669da0aefbb8a7
4
- data.tar.gz: a1c0fad00212b93bea5c9f02da882f1328ab1814
3
+ metadata.gz: 21e3fcbf6ef454027dd8f5b99eda8fc9ff17305c
4
+ data.tar.gz: b21cfd50602573f4333f7943e8675a9b5a2b0b41
5
5
  SHA512:
6
- metadata.gz: ad314b474affd015c15cd2f37d6abfeae2078f4cdd1226df18e91c731fff6ac9ae7488c68320ff1800f0362c4c10c82fd1515f84cfad2097cd57753ade246dbb
7
- data.tar.gz: d5523c25c2c68d61f8496ad6970969add84a61e00b810abf6e1192493664ac7e56b1548394a86db6a1f9f15f34342d3d593817b51263862c6286f62e5c8c6621
6
+ metadata.gz: 6d6b2b231c7c448a1c4a72f24d329df4e5ae9ca1f28ab2873c50541425a33cd3f702251817a3acae66aa86d75f263cc43f5128101d33c73a11549cf05bcdbf09
7
+ data.tar.gz: 0837e90a2b85b1d04a769e05c6ebfadb47bbd0089bc83fdd8f58ccd21b83d01e1226b1cb891c8ee1b00aa2ce172517e100963f74309e270fb31a14c7f19e6920
data/README.md CHANGED
@@ -39,18 +39,26 @@ Here is a sample `config.ru`:
39
39
  ```ruby
40
40
  #!/usr/bin/env ruby
41
41
  require 'rubygems'
42
- require 'gollum/auth' # Load the gem!
42
+ require 'gollum/auth' # Don't forget to load the gem!
43
43
  require 'gollum/app'
44
44
 
45
- # Enable Authentication and define users *before* running Precious::App!
46
- use Gollum::Auth, users: YAML.load(%q{
45
+ # Define list of authorized users where each must have a "name", "password"
46
+ and "email":
47
+ users = YAML.load %q{
47
48
  ---
48
- - user: admin
49
- password: test
50
- - user: foo
51
- password: bar
52
- })
53
-
49
+ - name: Rick Sanchez
50
+ password: asdf754&1129-@lUZw
51
+ email: rick@example.com
52
+ - name: Morty Smith
53
+ password: 12345
54
+ email: morty@example.com
55
+ }
56
+
57
+ # Allow only authenticated users to access and change the wiki.
58
+ # (NOTE: This must be loaded *before* Precious::App!)
59
+ use Gollum::Auth, users
60
+
61
+ # That's it. The rest is for gollum only.
54
62
  gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
55
63
  wiki_options = {:universal_toc => false}
56
64
  Precious::App.set(:gollum_path, gollum_path)
@@ -65,12 +73,6 @@ After checking out the repo, run `bin/setup` to install dependencies.
65
73
  Then, run `rake spec` to run the tests. You can also run `bin/console` for an
66
74
  interactive prompt that will allow you to experiment.
67
75
 
68
- To install this gem onto your local machine, run `bundle exec rake install`.
69
- To release a new version, update the version number in `version.rb`, and then
70
- run `bundle exec rake release`, which will create a git tag for the version,
71
- push git commits and tags, and push the `.gem` file to
72
- [rubygems.org](https://rubygems.org).
73
-
74
76
 
75
77
  ## Contributing
76
78
 
data/gollum-auth.gemspec CHANGED
@@ -28,4 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'rake', '~> 10.0'
29
29
  spec.add_development_dependency 'rspec', '~> 3.0'
30
30
  spec.add_development_dependency 'rack-test', '~> 0.6'
31
+ spec.add_development_dependency 'factory_girl', '~> 4.8'
32
+ spec.add_development_dependency 'faker', '~> 1.7'
31
33
  end
data/lib/gollum/auth.rb CHANGED
@@ -10,9 +10,9 @@ module Gollum
10
10
  end
11
11
 
12
12
  class App
13
- def initialize(app, opts = { })
13
+ def initialize(app, users)
14
14
  @app = app
15
- opts.fetch(:users, [ ]).map { |args| User.new(args).save! }
15
+ users.each { |args| User.new(args).save! }
16
16
  end
17
17
 
18
18
  def call(env)
@@ -33,8 +33,8 @@ module Gollum
33
33
  private
34
34
 
35
35
  def valid?(credentials)
36
- user, password = credentials
37
- current_user = User.find(user)
36
+ username, password = credentials
37
+ current_user = User.find(username)
38
38
  current_user && current_user.valid_password?(password)
39
39
  end
40
40
 
@@ -5,13 +5,13 @@ module Gollum::Auth
5
5
  class User
6
6
  include ActiveModel::Model
7
7
 
8
- attr_accessor :user, :password
8
+ attr_accessor :name, :password, :email
9
9
 
10
- validates_presence_of :user, :password
10
+ validates_presence_of :name, :password, :email
11
11
 
12
12
  class << self
13
- def find(user)
14
- all.select { |u| u.user == user }.first
13
+ def find(name)
14
+ all.select { |u| u.name == name }.first
15
15
  end
16
16
 
17
17
  def all
@@ -1,5 +1,5 @@
1
1
  module Gollum
2
2
  module Auth
3
- VERSION = '0.1.2'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Björn Albers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: factory_girl
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '4.8'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '4.8'
111
+ - !ruby/object:Gem::Dependency
112
+ name: faker
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '1.7'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '1.7'
97
125
  description: Authentication Middleware for Gollum Wiki
98
126
  email:
99
127
  - bjoernalbers@gmail.com
@@ -139,5 +167,5 @@ rubyforge_project:
139
167
  rubygems_version: 2.6.10
140
168
  signing_key:
141
169
  specification_version: 4
142
- summary: gollum-auth-0.1.2
170
+ summary: gollum-auth-0.2.0
143
171
  test_files: []