brownbeagle-gitauth 0.0.3.3 → 0.0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +19 -0
- data/USAGE +1 -1
- data/bin/gitauth +157 -214
- data/bin/gitauth-shell +7 -14
- data/config.ru +5 -0
- data/gitauth.gemspec +28 -0
- data/lib/gitauth/auth_setup_middleware.rb +44 -0
- data/lib/gitauth/client.rb +12 -7
- data/lib/gitauth/command.rb +10 -14
- data/lib/gitauth/group.rb +2 -2
- data/lib/gitauth/message.rb +69 -0
- data/lib/gitauth/repo.rb +52 -33
- data/lib/gitauth/saveable_class.rb +25 -22
- data/lib/gitauth/settings.rb +49 -0
- data/lib/gitauth/user.rb +21 -18
- data/lib/gitauth/web_app.rb +72 -11
- data/lib/gitauth.rb +64 -44
- data/public/gitauth.css +25 -2
- data/resources/messages.yml +9 -0
- data/views/auth_setup.erb +27 -0
- data/views/clone_repo.erb +22 -0
- data/views/layout.erb +1 -1
- metadata +34 -41
data/lib/gitauth.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# Copyright (C) 2009 Brown Beagle Software
|
3
|
-
# Copyright (C)
|
3
|
+
# Copyright (C) 2009 Darcy Laycock <sutto@sutto.net>
|
4
4
|
#
|
5
5
|
# This program is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Affero General Public License as published by
|
@@ -16,64 +16,84 @@
|
|
16
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
#++
|
18
18
|
|
19
|
-
|
20
|
-
require 'logger'
|
21
|
-
require 'yaml'
|
19
|
+
require 'pathname'
|
22
20
|
require 'ostruct'
|
23
21
|
|
24
22
|
module GitAuth
|
25
23
|
|
26
|
-
|
27
|
-
|
24
|
+
VERSION = [0, 0, 4, 0]
|
25
|
+
BASE_DIR = Pathname.new(__FILE__).dirname.join("..").expand_path
|
26
|
+
LIB_DIR = BASE_DIR.join("lib", "gitauth")
|
27
|
+
GITAUTH_DIR = Pathname.new("~/.gitauth/").expand_path
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
# This is the first declaration because we need it so that we can
|
30
|
+
# load a vendored version of perennial if present.
|
31
|
+
def self.require_vendored(lib)
|
32
|
+
vendored_path = BASE_DIR.join("vendor", lib, "lib", "#{lib}.rb")
|
33
|
+
if File.exist?(vendored_path)
|
34
|
+
$:.unshift File.dirname(vendored_path)
|
35
|
+
require lib
|
36
|
+
else
|
37
|
+
require 'rubygems' unless defined?(Gem)
|
38
|
+
require lib
|
39
|
+
end
|
31
40
|
end
|
32
41
|
|
33
|
-
|
34
|
-
|
35
|
-
|
42
|
+
require_vendored 'perennial'
|
43
|
+
include Perennial
|
44
|
+
include Loggable
|
36
45
|
|
37
|
-
|
38
|
-
@settings = nil
|
39
|
-
end
|
46
|
+
require LIB_DIR.join("settings")
|
40
47
|
|
41
|
-
|
42
|
-
|
43
|
-
return (name =~ /^@/ ? Group : User).get(name)
|
48
|
+
%w(message saveable_class repo user command client group).each do |file|
|
49
|
+
require LIB_DIR.join(file)
|
44
50
|
end
|
45
51
|
|
46
|
-
|
47
|
-
|
52
|
+
autoload :AuthSetupMiddleware, LIB_DIR.join('auth_setup_middleware').to_s
|
53
|
+
autoload :WebApp, LIB_DIR.join('web_app').to_s
|
54
|
+
|
55
|
+
manifest do |m, l|
|
56
|
+
Settings.root = File.dirname(__FILE__)
|
57
|
+
Settings.default_settings_path = GITAUTH_DIR.join("settings.yml")
|
58
|
+
Logger.default_logger_path = GITAUTH_DIR.join("gitauth.log")
|
59
|
+
l.before_run { GitAuth.each_model(:load!) }
|
60
|
+
l.register_controller :web_app, 'GitAuth::WebApp'
|
48
61
|
end
|
49
62
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
63
|
+
class << self
|
64
|
+
|
65
|
+
def prepare
|
66
|
+
Settings.setup
|
67
|
+
reload_models!
|
54
68
|
end
|
55
|
-
|
56
|
-
|
57
|
-
|
69
|
+
|
70
|
+
def version
|
71
|
+
VERSION.join(".")
|
58
72
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
|
74
|
+
def msg(type, message)
|
75
|
+
Message.new(type, message)
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_user_or_group(name)
|
79
|
+
name = name.to_s.strip
|
80
|
+
return if name.empty?
|
81
|
+
(name =~ /^@/ ? Group : User).get(name)
|
82
|
+
end
|
83
|
+
|
84
|
+
def has_git?
|
85
|
+
!`which git`.blank?
|
86
|
+
end
|
87
|
+
|
88
|
+
def each_model(method = nil, &blk)
|
89
|
+
[Repo, User, Group].each { |m| m.send(method) } if method.present?
|
90
|
+
[Repo, User, Group].each(&blk) unless blk.nil?
|
91
|
+
end
|
92
|
+
|
93
|
+
def reload_models!
|
94
|
+
each_model(:load!)
|
95
|
+
end
|
96
|
+
|
77
97
|
end
|
78
98
|
|
79
99
|
end
|
data/public/gitauth.css
CHANGED
@@ -277,7 +277,6 @@ br.clear { clear: both; }
|
|
277
277
|
color: #C55E25;
|
278
278
|
}
|
279
279
|
|
280
|
-
|
281
280
|
#repository-details code {
|
282
281
|
display: block;
|
283
282
|
white-space: pre;
|
@@ -285,5 +284,29 @@ br.clear { clear: both; }
|
|
285
284
|
font-family: Consolas, Lucida Console, Monaco, monospace;
|
286
285
|
background: #F4F4F4;
|
287
286
|
margin: 0.25em 0;
|
288
|
-
|
287
|
+
}
|
288
|
+
|
289
|
+
#error-container {
|
290
|
+
padding: 1em 3em 1.5em;
|
291
|
+
}
|
292
|
+
|
293
|
+
#error-container h2 {
|
294
|
+
font-size: 1.5em;
|
295
|
+
text-align: center;
|
296
|
+
font-weight: bold;
|
297
|
+
padding: 0 0 0.5em;
|
298
|
+
color: red;
|
299
|
+
}
|
300
|
+
|
301
|
+
#error-container p {
|
302
|
+
font-size: 1.2em;
|
303
|
+
line-height: 1.5em;
|
304
|
+
color: #222;
|
305
|
+
text-align: center;
|
306
|
+
}
|
307
|
+
|
308
|
+
#error-container p code {
|
309
|
+
font-style: italic;
|
310
|
+
color: black;
|
311
|
+
font-weight: bold;
|
289
312
|
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
error:
|
2
|
+
hook_failed: "Your GitAuth post-create hook, located at ~/.gitauth/post-create, failed to run successfully."
|
3
|
+
unknown: "An unknown error has occured"
|
4
|
+
warning:
|
5
|
+
unknown: "Ruh-roh, something went wrong"
|
6
|
+
notice:
|
7
|
+
unknown: ""
|
8
|
+
skipped_post_create: "Post create hook didn't exist"
|
9
|
+
post_create_hook_run: "Post create hook successfully was run"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head>
|
4
|
+
<title>GitAuth</title>
|
5
|
+
<link rel="stylesheet" type="text/css" href="/gitauth.css" media="screen" />
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div id="container">
|
9
|
+
<div id="header">
|
10
|
+
<h1><a href="/">GitAuth Admin Area</a></h1>
|
11
|
+
</div>
|
12
|
+
<div id="contents">
|
13
|
+
<div id='error-container'>
|
14
|
+
<h2>Ruh-roh Scooby!</h2>
|
15
|
+
<p>
|
16
|
+
It looks like you need to setup a username and password for GitAuth to function
|
17
|
+
correctly. Please log in the computer running this GitAuth install and run
|
18
|
+
<code>gitauth web-app</code> manually once. Thanks!
|
19
|
+
</p>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<div id="footer">
|
23
|
+
Powered by GitAuth v<%= GitAuth.version %>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% repo_url = "git@#{request.host}:#{h params[:repo_name]}.git" %>
|
2
|
+
<div id="repository-details">
|
3
|
+
<h3>Congratulations! Your repository was added!</h3>
|
4
|
+
<p>
|
5
|
+
If you have an existing local git repository you wish to push, try...
|
6
|
+
</p>
|
7
|
+
<code> cd your-repo
|
8
|
+
git remote add origin <%= repo_url %>
|
9
|
+
git push origin master</code>
|
10
|
+
<p>
|
11
|
+
Otherwise, to initialize an empty repository:
|
12
|
+
</p>
|
13
|
+
<code> mkdir your-repo
|
14
|
+
cd your-repo
|
15
|
+
git init
|
16
|
+
touch .gitignore
|
17
|
+
git add .gitignore
|
18
|
+
git commit -m "Added blank .gitignore to initialize repository"
|
19
|
+
git remote add origin <%= repo_url %>
|
20
|
+
git push origin master</code>
|
21
|
+
<p>And you should be good to go! <a href="#" onclick="$('#repository-details').slideUp(); return false;">(close instructions)</a></p>
|
22
|
+
</div>
|
data/views/layout.erb
CHANGED
metadata
CHANGED
@@ -1,78 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brownbeagle-gitauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darcy Laycock
|
8
|
-
- Alex Pooley
|
9
|
-
- Matt Didcoe
|
10
8
|
autorequire:
|
11
9
|
bindir: bin
|
12
10
|
cert_chain: []
|
13
11
|
|
14
|
-
date: 2009-
|
15
|
-
default_executable:
|
16
|
-
dependencies:
|
17
|
-
|
18
|
-
|
19
|
-
type: :runtime
|
20
|
-
version_requirement:
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
-
requirements:
|
23
|
-
- - ">="
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
version: 0.9.7
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: sinatra
|
29
|
-
type: :runtime
|
30
|
-
version_requirement:
|
31
|
-
version_requirements: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: "0.9"
|
36
|
-
version:
|
37
|
-
description: Git Authentication Server
|
12
|
+
date: 2009-09-06 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A library to enable per user / group authentication on a read / write basis for git repositories running over ssh
|
38
17
|
email: sutto@sutto.net
|
39
18
|
executables:
|
40
19
|
- gitauth
|
41
20
|
- gitauth-shell
|
42
21
|
extensions: []
|
43
22
|
|
44
|
-
extra_rdoc_files:
|
45
|
-
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files:
|
46
26
|
- LICENSE
|
27
|
+
- README.rdoc
|
28
|
+
- Rakefile
|
47
29
|
- USAGE
|
48
|
-
|
30
|
+
- bin
|
49
31
|
- bin/gitauth
|
50
32
|
- bin/gitauth-shell
|
33
|
+
- config.ru
|
34
|
+
- gitauth.gemspec
|
35
|
+
- lib
|
36
|
+
- lib/gitauth
|
37
|
+
- lib/gitauth.rb
|
38
|
+
- lib/gitauth/auth_setup_middleware.rb
|
51
39
|
- lib/gitauth/client.rb
|
52
40
|
- lib/gitauth/command.rb
|
53
41
|
- lib/gitauth/group.rb
|
42
|
+
- lib/gitauth/message.rb
|
54
43
|
- lib/gitauth/repo.rb
|
55
44
|
- lib/gitauth/saveable_class.rb
|
45
|
+
- lib/gitauth/settings.rb
|
56
46
|
- lib/gitauth/user.rb
|
57
47
|
- lib/gitauth/web_app.rb
|
58
|
-
-
|
59
|
-
- LICENSE
|
48
|
+
- public
|
60
49
|
- public/gitauth.css
|
61
50
|
- public/gitauth.js
|
62
51
|
- public/jquery.js
|
63
|
-
-
|
64
|
-
-
|
52
|
+
- resources
|
53
|
+
- resources/messages.yml
|
54
|
+
- vendor
|
55
|
+
- views
|
56
|
+
- views/auth_setup.erb
|
57
|
+
- views/clone_repo.erb
|
65
58
|
- views/group.erb
|
66
59
|
- views/index.erb
|
67
60
|
- views/layout.erb
|
68
61
|
- views/repo.erb
|
69
62
|
- views/user.erb
|
70
63
|
has_rdoc: false
|
71
|
-
homepage: http://
|
64
|
+
homepage: http://brownbeagle.com.au/
|
65
|
+
licenses:
|
72
66
|
post_install_message:
|
73
|
-
rdoc_options:
|
74
|
-
|
75
|
-
- --charset=UTF-8
|
67
|
+
rdoc_options: []
|
68
|
+
|
76
69
|
require_paths:
|
77
70
|
- lib
|
78
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -90,9 +83,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
83
|
requirements: []
|
91
84
|
|
92
85
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.
|
86
|
+
rubygems_version: 1.3.5
|
94
87
|
signing_key:
|
95
|
-
specification_version:
|
96
|
-
summary: Git
|
88
|
+
specification_version: 3
|
89
|
+
summary: An authentication manager for Git repositories served over SSH
|
97
90
|
test_files: []
|
98
91
|
|