brownbeagle-gitauth 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gitauth +1 -1
- data/lib/gitauth.rb +4 -0
- data/lib/gitauth/command.rb +2 -2
- data/lib/gitauth/repo.rb +1 -5
- data/lib/gitauth/user.rb +1 -1
- data/views/repo.erb +1 -0
- metadata +1 -1
data/bin/gitauth
CHANGED
@@ -93,7 +93,7 @@ class GitAuthRunner < Thor
|
|
93
93
|
$stderr.puts "Please log in as the correct user and re-run"
|
94
94
|
exit! 1
|
95
95
|
end
|
96
|
-
if !GitAuth
|
96
|
+
if !GitAuth.has_git?
|
97
97
|
$stderr.puts "'git' was not found in your path - please install it before continuing."
|
98
98
|
exit! 1
|
99
99
|
end
|
data/lib/gitauth.rb
CHANGED
@@ -43,6 +43,10 @@ module GitAuth
|
|
43
43
|
return (name =~ /^@/ ? Group : User).get(name)
|
44
44
|
end
|
45
45
|
|
46
|
+
def self.has_git?
|
47
|
+
!`which git`.strip.empty?
|
48
|
+
end
|
49
|
+
|
46
50
|
def self.setup!
|
47
51
|
unless File.exist?(GITAUTH_DIR) && File.directory?(GITAUTH_DIR)
|
48
52
|
$stderr.puts "GitAuth not been setup, please run: gitauth install"
|
data/lib/gitauth/command.rb
CHANGED
@@ -34,7 +34,7 @@ module GitAuth
|
|
34
34
|
# Standard Commands
|
35
35
|
READ_COMMANDS = ["git-upload-pack", "git upload-pack"]
|
36
36
|
WRITE_COMMANDS = ["git-receive-pack", "git receive-pack"]
|
37
|
-
PATH_REGEXP = /^'([\w\_\-\.\+]+(\.git)?)'$/i.freeze
|
37
|
+
PATH_REGEXP = /^'([\w\_\-\~\.\+\/]+\/)?([\w\_\-\.\+]+(\.git)?)'$/i.freeze
|
38
38
|
|
39
39
|
attr_reader :path, :verb, :command
|
40
40
|
|
@@ -73,7 +73,7 @@ module GitAuth
|
|
73
73
|
raise BadCommandError
|
74
74
|
end
|
75
75
|
if PATH_REGEXP =~ @argument
|
76
|
-
@path = $
|
76
|
+
@path = $2
|
77
77
|
raise BadCommandError unless @path
|
78
78
|
else
|
79
79
|
raise BadCommandError
|
data/lib/gitauth/repo.rb
CHANGED
@@ -83,7 +83,7 @@ module GitAuth
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def create_repo!
|
86
|
-
return false if !
|
86
|
+
return false if !GitAuth.has_git?
|
87
87
|
path = self.real_path
|
88
88
|
unless File.exist?(path) && File.directory?(path)
|
89
89
|
FileUtils.mkdir_p(path)
|
@@ -101,9 +101,5 @@ module GitAuth
|
|
101
101
|
self.class.save!
|
102
102
|
end
|
103
103
|
|
104
|
-
def self.has_git?
|
105
|
-
!`which git`.strip.empty?
|
106
|
-
end
|
107
|
-
|
108
104
|
end
|
109
105
|
end
|
data/lib/gitauth/user.rb
CHANGED
data/views/repo.erb
CHANGED
@@ -35,6 +35,7 @@
|
|
35
35
|
<div class="row">
|
36
36
|
<label for="repo_all"> Read & Write Access:</label>
|
37
37
|
<textarea name="repo[all]" id="repo_all" cols="38" rows="5"><%= @all_access.join("\n") %></textarea>
|
38
|
+
<p class="hint">One user / group per line, groups starting with @'s</p>
|
38
39
|
</div>
|
39
40
|
|
40
41
|
<div class="row">
|