gitauth 0.0.5.0 → 0.0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -13,7 +13,7 @@ from Gitorius - http://gitorious.org
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 http://gems.github.com/
16
+ sudo gem install gitauth --source http://gemcutter.org/
17
17
 
18
18
  Or, if you want to avoid the gems approach, you can use simply clone the repository
19
19
  as follows and use the git submodule setup in order to vendor rack, sinatra and perennial:
@@ -118,13 +118,17 @@ module GitAuth
118
118
  alias_method :h, :escape_html
119
119
 
120
120
  def link_to(text, link)
121
- "<a href='#{link}'>#{text}</a>"
121
+ "<a href='#{u link}'>#{text}</a>"
122
+ end
123
+
124
+ def u(url)
125
+ "#{request.script_name}#{url}"
122
126
  end
123
127
 
124
128
  def delete_link(text, url)
125
129
  id = "deleteable-#{Digest::SHA256.hexdigest(url.to_s)[0, 6]}"
126
130
  html = "<div class='deletable-container' style='display: none; margin: 0; padding: 0;'>"
127
- html << "<form method='post' action='#{url}' id='#{id}'>"
131
+ html << "<form method='post' action='#{u url}' id='#{id}'>"
128
132
  html << "<input name='_method' type='hidden' value='delete' />"
129
133
  html << "</form></div>"
130
134
  html << "<a href='#' onclick='if(confirm(\"Are you sure you want to do that? Deletion can not be reversed.\")) $(\"##{id}\").submit(); return false;'>#{text}</a>"
@@ -196,7 +200,7 @@ module GitAuth
196
200
  make_empty = (params[:repo][:make_empty] == "1")
197
201
  repo.make_empty! if make_empty
198
202
  if repo.execute_post_create_hook!
199
- redirect "/?repo_name=#{URI.encode(name)}&made_empty=#{make_empty ? "yes" : "no"}"
203
+ redirect u("/?repo_name=#{URI.encode(name)}&made_empty=#{make_empty ? "yes" : "no"}")
200
204
  else
201
205
  redirect root_with_message("Repository added but the post-create hook exited unsuccessfully.")
202
206
  end
@@ -226,7 +230,7 @@ module GitAuth
226
230
  new_permissions.each_value { |v| v.uniq! }
227
231
  repo.permissions = new_permissions
228
232
  GitAuth::Repo.save!
229
- redirect "/repos/#{URI.encode(repo.name)}"
233
+ redirect u("/repos/#{URI.encode(repo.name)}")
230
234
  end
231
235
  end
232
236
 
@@ -286,7 +290,7 @@ module GitAuth
286
290
  end.compact - [group.to_s]
287
291
  GitAuth::Group.save!
288
292
  end
289
- redirect "/groups/#{URI.encode(group.name)}"
293
+ redirect u("/groups/#{URI.encode(group.name)}")
290
294
  end
291
295
  end
292
296
 
@@ -303,7 +307,7 @@ module GitAuth
303
307
  # Misc Helpers
304
308
 
305
309
  def root_with_message(message)
306
- "/?message=#{URI.encode(message)}"
310
+ u("/?message=#{URI.encode(message)}")
307
311
  end
308
312
 
309
313
  end
data/lib/gitauth.rb CHANGED
@@ -28,7 +28,7 @@ module GitAuth
28
28
  include Perennial
29
29
  include Loggable
30
30
 
31
- VERSION = [0, 0, 5, 0]
31
+ VERSION = [0, 0, 5, 1]
32
32
  BASE_DIR = Pathname(__FILE__).dirname.join("..").expand_path
33
33
  GITAUTH_DIR = Pathname("~/.gitauth/").expand_path
34
34
 
data/views/auth_setup.erb CHANGED
@@ -2,12 +2,12 @@
2
2
  <html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
3
3
  <head>
4
4
  <title>GitAuth</title>
5
- <link rel="stylesheet" type="text/css" href="/gitauth.css" media="screen" />
5
+ <link rel="stylesheet" type="text/css" href="<%=u "/gitauth.css" %>" media="screen" />
6
6
  </head>
7
7
  <body>
8
8
  <div id="container">
9
9
  <div id="header">
10
- <h1><a href="/">GitAuth Admin Area</a></h1>
10
+ <h1><%= link-to "GitAuth Admin Area", "/ "%></h1>
11
11
  </div>
12
12
  <div id="contents">
13
13
  <div id='error-container'>
data/views/group.erb CHANGED
@@ -11,14 +11,14 @@
11
11
  <% end %>
12
12
  </ul>
13
13
 
14
- <form action="/groups/<%= URI.encode(@group.name) %>" method="post">
14
+ <form action="<%=u "/groups/#{URI.encode(@group.name)}" %>" method="post">
15
15
  <div class="row">
16
16
  <label for="group_members">Members:</label>
17
17
  <textarea name="group[members]" id="group_members" cols="38" rows="10"><%= @group.members.join("\n") %></textarea>
18
18
  <p class="hint">Members are one-per line, groups starting with @'s</p>
19
19
  </div>
20
20
  <div class="buttons">
21
- <input type="submit" value="Update Group" /> or <a href="/">Go Back</a>
21
+ <input type="submit" value="Update Group" /> or <%= link_to "Go Back", "/" %>
22
22
  </div>
23
23
  </form>
24
24
  </div>
data/views/index.erb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div class="section">
6
6
  <h2>Repositories <a href="#" onclick="showForm('repo'); return false;" title="Add a new repository" id="add-repo-link">[+]</a></h2>
7
- <form id="add-repo" action="/repos" method="post" class="hidden">
7
+ <form id="add-repo" action="<%=u "/repos" %>" method="post" class="hidden">
8
8
  <div class="row">
9
9
  <label for="repo_name">Name:</label>
10
10
  <input type="text" name="repo[name]" id="repo_name" />
@@ -35,7 +35,7 @@
35
35
 
36
36
  <div class="section">
37
37
  <h2>Users <a href="#" onclick="showForm('user'); return false;" title="Add a new user" id="add-user-link">[+]</a></h2>
38
- <form id="add-user" action="/users" method="post" class="hidden">
38
+ <form id="add-user" action="<%=u "/users" %>" method="post" class="hidden">
39
39
  <div class="row">
40
40
  <label for="user_name">Name:</label>
41
41
  <input type="text" name="user[name]" id="user_name" />
@@ -66,7 +66,7 @@
66
66
 
67
67
  <div class="section">
68
68
  <h2>Groups <a href="#" onclick="showForm('group'); return false;" title="Add a new group" id="add-group-link">[+]</a></h2>
69
- <form id="add-group" action="/groups" method="post" class="hidden">
69
+ <form id="add-group" action="<%=u "/groups" %>" method="post" class="hidden">
70
70
  <div class="row">
71
71
  <label for="group_name">Name:</label>
72
72
  <input type="text" name="group[name]" id="group_name" />
data/views/layout.erb CHANGED
@@ -2,14 +2,14 @@
2
2
  <html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
3
3
  <head>
4
4
  <title>GitAuth</title>
5
- <link rel="stylesheet" type="text/css" href="/gitauth.css" media="screen" />
6
- <script type="text/javascript" src="/jquery.js"></script>
7
- <script type="text/javascript" src="/gitauth.js"></script>
5
+ <link rel="stylesheet" type="text/css" href="<%= u "/gitauth.css" %>" media="screen" />
6
+ <script type="text/javascript" src="<%= u "/jquery.js" %>"></script>
7
+ <script type="text/javascript" src="<%= u "/gitauth.js" %>"></script>
8
8
  </head>
9
9
  <body>
10
10
  <div id="container">
11
11
  <div id="header">
12
- <h1><a href="/">GitAuth Admin Area</a></h1>
12
+ <h1><%= link_to "GitAuth Admin Area", "/" %></h1>
13
13
  </div>
14
14
  <% if params[:message] %>
15
15
  <div class="message">
data/views/repo.erb CHANGED
@@ -31,7 +31,7 @@
31
31
  <% end %>
32
32
  </ul>
33
33
 
34
- <form action="/repos/<%= URI.encode(@repo.name) %>" method="post">
34
+ <form action="<%=u "/repos/#{URI.encode(@repo.name)}" %>" method="post">
35
35
  <div class="row">
36
36
  <label for="repo_all"> Read &amp; Write Access:</label>
37
37
  <textarea name="repo[all]" id="repo_all" cols="38" rows="5"><%= @all_access.join("\n") %></textarea>
@@ -49,7 +49,7 @@
49
49
  </div>
50
50
 
51
51
  <div class="buttons">
52
- <input type="submit" value="Update Permissions" /> or <a href="/">Go Back</a>
52
+ <input type="submit" value="Update Permissions" /> or <%= link_to "Go Back", "/" %>
53
53
  </div>
54
54
  </form>
55
55
  </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.0
4
+ version: 0.0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darcy Laycock
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-29 00:00:00 +08:00
12
+ date: 2009-09-30 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: "1.0"
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: sinatra-sinatra
26
+ name: sinatra
27
27
  type: :runtime
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
@@ -33,14 +33,14 @@ dependencies:
33
33
  version: 0.9.0
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
- name: Sutto-perennial
36
+ name: perennial
37
37
  type: :runtime
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.2.3.1
43
+ version: 1.0.0.1
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: thoughtbot-shoulda