brownbeagle-gitauth 0.0.3 → 0.0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -7,13 +7,13 @@ At the moment configuration / adding users is done via a single command - +gitau
7
7
  === License
8
8
 
9
9
  GitAuth is licensed under AGPL, with parts of the code being derived
10
- from Gitorius - http://gitorious.org/
10
+ from Gitorius - http://gitorious.org
11
11
 
12
12
  === Installing GitAuth
13
13
 
14
14
  Getting started is relatively simple. First of, you'll need to log onto the remote server / your git host. Next, you'll need to install the gem:
15
15
 
16
- sudo gem install brownbeagle-gitauth --source=https://gems.github.com/
16
+ sudo gem install brownbeagle-gitauth --source http://gems.github.com/
17
17
 
18
18
  Once that's done, the +gitauth+ and +gitauth-shell+ commands should be in your path.
19
19
  Next, you'll want to (in most cases anyway) use a specific +git+ user to host repositories.
@@ -99,4 +99,17 @@ to use the full form:
99
99
 
100
100
  git push origin master
101
101
 
102
- As it starts as an empty repo.
102
+ As it starts as an empty repo.
103
+
104
+ Alternatively, if you get the error "fatal: no matching remote head" when you
105
+ clone and it doesn't create a local copy, you'll instead have to do the following
106
+ on your local PC (due to the way git handles remote repositories):
107
+
108
+ mkdir my-repo
109
+ cd my-repo
110
+ git init
111
+ touch README
112
+ git add .
113
+ git commit -m "Added blank readme"
114
+ git add remote origin git@your-server:my-repo.git
115
+ git push origin master
data/USAGE ADDED
@@ -0,0 +1,27 @@
1
+ GitAuth is an SSH and Ruby based authenticated Git server.
2
+
3
+ gitauth install ADMIN_PUBLIC_KEY
4
+ Pass in a valid SSH public key that will be used by the GitAuth administrator
5
+
6
+ gitauth permissions REPO USERORGROUP [PERMISSION=all,read,write]
7
+ REPO: the repository name you wish to set permissions on
8
+ USER/GROUP: the user or group name you with to give permissions
9
+ PERMISSION:
10
+ Default = all
11
+ The level of permissions you want to give the user or group on the repository in question
12
+ all = read/write
13
+ read = the user can see the repository and pull it, but cannot push changes
14
+ write = user can push changes but can't pull it.
15
+
16
+ gitauth addrepo NAME PATH
17
+ NAME: the name you want your repository to have
18
+ PATH: the part path you want the repository to have, will be ~REPOBASE~/PATH
19
+
20
+ gitauth adduser [--admin] NAME PUBLIC_KEY
21
+ NAME: the name of your new user
22
+ PUBLIC_KEY: a valid path to a copy of the users SSH public key file
23
+
24
+ --admin: pass this flag if you want your user to be able to administer the gitauth install
25
+
26
+ gitauth addgroup NAME
27
+ NAME: the name of your new group
data/bin/gitauth CHANGED
@@ -26,6 +26,10 @@ require File.join(File.dirname(__FILE__), "..", "lib", "gitauth")
26
26
 
27
27
  class GitAuthRunner < Thor
28
28
 
29
+ map "-h" => :help
30
+ map "--help" => :help
31
+ map "--usage" => :usage
32
+
29
33
  # Adding users, groups and repos
30
34
 
31
35
  desc "addrepo REPO-NAME [PATH-PART]", "Adds a new repository"
@@ -219,6 +223,16 @@ class GitAuthRunner < Thor
219
223
  exit! 1
220
224
  end
221
225
 
226
+ def usage
227
+ counter = 1
228
+ file = File.new("USAGE", "r")
229
+ while (line = file.gets)
230
+ puts line
231
+ counter = counter + 1
232
+ end
233
+ file.close
234
+ end
235
+
222
236
  protected
223
237
 
224
238
  def read_password
data/lib/gitauth/repo.rb CHANGED
@@ -32,7 +32,7 @@ module GitAuth
32
32
  repository = self.new(name, path)
33
33
  return false unless repository.create_repo!
34
34
  self.add_item(repository)
35
- return true
35
+ return repository
36
36
  end
37
37
 
38
38
  attr_accessor :name, :path, :permissions
@@ -89,7 +89,7 @@ module GitAuth
89
89
  FileUtils.mkdir_p(path)
90
90
  output = ""
91
91
  Dir.chdir(path) do
92
- IO.popen("git init --bare") { |f| output << f.read }
92
+ IO.popen("git --bare init") { |f| output << f.read }
93
93
  end
94
94
  return !!(output =~ /Initialized empty Git repository/)
95
95
  end
@@ -101,5 +101,16 @@ module GitAuth
101
101
  self.class.save!
102
102
  end
103
103
 
104
+ def execute_post_create_hook!
105
+ script = File.expand_path("~/.gitauth/post-create")
106
+ if File.exist?(script) && File.executable?(script)
107
+ system(script, @name, @path)
108
+ return $?.success?
109
+ else
110
+ # If there isn't a file, run it ourselves.
111
+ return true
112
+ end
113
+ end
114
+
104
115
  end
105
116
  end
data/lib/gitauth/user.rb CHANGED
@@ -111,7 +111,7 @@ module GitAuth
111
111
  end
112
112
 
113
113
  def self.clean_ssh_key(key)
114
- if key =~ /^(ssh-\w+ [a-zA-Z0-9\/\+]+==).*$/
114
+ if key =~ /^(ssh-\w+ [a-zA-Z0-9\/\+]+==?).*$/
115
115
  return $1
116
116
  else
117
117
  return nil
@@ -117,8 +117,12 @@ module GitAuth
117
117
  name = params[:repo][:name]
118
118
  path = params[:repo][:path]
119
119
  path = name if path.to_s.strip.empty?
120
- if GitAuth::Repo.create(name, path)
121
- redirect root_with_message("Repository successfully added")
120
+ if repo = GitAuth::Repo.create(name, path)
121
+ if repo.execute_post_create_hook!
122
+ redirect "/repo_name=#{URI.encode(name)}"
123
+ else
124
+ redirect root_with_message("Repository added but the post-create hook exited unsuccessfully.")
125
+ end
122
126
  else
123
127
  redirect root_with_message("There was an error adding the repository.")
124
128
  end
data/public/gitauth.css CHANGED
@@ -217,7 +217,7 @@ div.message {
217
217
  background: #17768A;
218
218
  }
219
219
 
220
- .section ul li a {
220
+ .section ul li a, #repository-details a {
221
221
  text-decoration: none;
222
222
  color: #395F99;
223
223
  }
@@ -261,4 +261,29 @@ br.clear { clear: both; }
261
261
  .view ul li a {
262
262
  text-decoration: none;
263
263
  color: #416999;
264
+ }
265
+
266
+ #repository-details {
267
+ line-height: 1.8em;
268
+ padding: 0.5em 1em;
269
+ margin-bottom: 2em;
270
+ }
271
+
272
+ #repository-details h3 {
273
+ font-weight: bold;
274
+ font-size: 1.1em;
275
+ text-align: center;
276
+ margin-bottom: 0.75em;
277
+ color: #C55E25;
278
+ }
279
+
280
+
281
+ #repository-details code {
282
+ display: block;
283
+ white-space: pre;
284
+ padding: 0.5em;
285
+ font-family: Consolas, Lucida Console, Monaco, monospace;
286
+ background: #F4F4F4;
287
+ margin: 0.25em 0;
288
+
264
289
  }
data/views/index.erb CHANGED
@@ -1,3 +1,7 @@
1
+ <% if params[:repo_name] %>
2
+ <%= erb :clone_repo, :layout => false %>
3
+ <% end %>
4
+
1
5
  <div class="section">
2
6
  <h2>Repositories <a href="#" onclick="showForm('repo'); return false;" title="Add a new repository" id="add-repo-link">[+]</a></h2>
3
7
  <form id="add-repo" action="/repos" method="post" class="hidden">
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brownbeagle-gitauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darcy Laycock
8
8
  - Alex Pooley
9
+ - Matt Didcoe
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -43,6 +44,7 @@ extensions: []
43
44
  extra_rdoc_files:
44
45
  - README.rdoc
45
46
  - LICENSE
47
+ - USAGE
46
48
  files:
47
49
  - bin/gitauth
48
50
  - bin/gitauth-shell
@@ -59,6 +61,7 @@ files:
59
61
  - public/gitauth.js
60
62
  - public/jquery.js
61
63
  - README.rdoc
64
+ - USAGE
62
65
  - views/group.erb
63
66
  - views/index.erb
64
67
  - views/layout.erb