Skip to content

Commit

Permalink
Added support for ssh port specification in gitServer. Also clarity f…
Browse files Browse the repository at this point in the history
…ix for access box.
  • Loading branch information
kubitron committed Jan 28, 2012
1 parent 2c24a71 commit a472dbe
Show file tree
Hide file tree
Showing 42 changed files with 53 additions and 48 deletions.
4 changes: 2 additions & 2 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ The *httpServer* variable should be set to the hostname which will be used to ac
may optionally include a port using the ':portnum' syntax, i.e. www.my-own-person-git-host-server.com:8000. Unlike earlier versions of this plugin, this variable should
*not* include the path to your Redmine root.

The *gitServer* variable should be set to the hostname which will be used to access the gitolite repositories via ssh. In most configurations, this
variable will be identical to the *httpServer*, except for the fact that *gitServer* will never include an optional port number.
The *gitServer* variable should be set to the hostname which will be used to access the gitolite repositories via ssh. Like *httpServer*, this variable may optionally include a port using the ':portnum' syntax, i.e. www.my-own-person-git-host-server.com:444. In most configurations, the *gitServer*
variable will be identical to the *httpServer*, except when ports are involved.

The *gitUser* is the user under which gitolite is installed.

Expand Down
8 changes: 4 additions & 4 deletions app/models/git_hosting_settings_observer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ def before_save(object)
valuehash['gitoliteIdentityPublicKeyFile'] = @@old_valuehash['gitoliteIdentityPublicKeyFile']
end

# Server should not include any path components
# Server should not include any path components. Also, ports should be numeric.
if valuehash['gitServer']
normalizedServer = valuehash['gitServer'].lstrip.rstrip.split('/').first
if (normalizedServer == '')
if (!normalizedServer.match(/^[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(:\d+)?$/))
valuehash['gitServer'] = @@old_valuehash['gitServer']
else
valuehash['gitServer'] = normalizedServer
end
end

# Server should not include any path components
# Server should not include any path components. Also, ports should be numeric.
if valuehash['httpServer']
normalizedServer = valuehash['httpServer'].lstrip.rstrip.split('/').first
if (normalizedServer == '')
if (!normalizedServer.match(/^[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(:\d+)?$/))
valuehash['httpServer'] = @@old_valuehash['httpServer']
else
valuehash['httpServer'] = normalizedServer
Expand Down
7 changes: 5 additions & 2 deletions app/views/repositories/git_instructions.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

<%# This is used to display basic git setup instructions, like on github... %>
<% flash.now[:warning] = "Repository is empty. Get started by following the instructions below." %>
<% git_ssh_url = Setting.plugin_redmine_git_hosting['gitUser'] + "@" + Setting.plugin_redmine_git_hosting['gitServer'] + ":" + GitHosting.repository_name(@project) + '.git' %>

<% gitSHP = Setting.plugin_redmine_git_hosting['gitServer'].match(/:\d+$/) %>
<% git_ssh_url =
"#{gitSHP ? 'ssh://' : ''}#{Setting.plugin_redmine_git_hosting['gitUser']}@#{Setting.plugin_redmine_git_hosting['gitServer']}#{gitSHP ? '/' : ':'}#{GitHosting.repository_name(@project)}.git" %>

<div class="box">

<h2>Git Setup:</h2>
Expand Down
3 changes: 2 additions & 1 deletion app/views/settings/_display_access.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
%>
<br/>
<label><%= l(:label_ssh_access)%>:</label>
<%= "ssh://#{@settings['gitUser']}@#{@settings['gitServer']}:#{@settings['gitRedmineSubdir']}<em>#{(GitHosting.repository_hierarchy)?'project1/project2/':''}project3.git</em>"
<% gitSHP = Setting.plugin_redmine_git_hosting['gitServer'].match(/:\d+$/) %>
<%= "#{gitSHP ? 'ssh://' : ''}#{@settings['gitUser']}@#{@settings['gitServer']}#{gitSHP ? '/' : ':'}#{@settings['gitRedmineSubdir']}<em>#{(GitHosting.repository_hierarchy)?'project1/project2/':''}project3.git</em>"
%>
<br/>
<label><%= l(:label_http_access)%>:</label>
Expand Down
3 changes: 2 additions & 1 deletion assets/javascripts/git_url_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ function updateGitUrl(el)
guHttpBase = guHttpBase.replace(/\/$/, "")

var urls=[]
urls["git_url_ssh"] = [guGitUser + "@" + guGitServer + ":" + guSshURL, guUserIsCommitter]
var gitSHP = /:\d+$/.test(guGitServer)
urls["git_url_ssh"] = [(gitSHP ? "ssh://" : "") + guGitUser + "@" + guGitServer + (gitSHP ? "/" : ":") + guSshURL, guUserIsCommitter]
urls["git_url_http"] = [guHttpProto + "://" + ( (!guProjectIsPublic) || guUserIsCommitter ? guUser + "@" : "") + guHttpBase + "/" + guHttpURL, guUserIsCommitter]
urls["git_url_git"] = ["git://" + guGitServer + "/" + guSshURL, false]
var allGitUrlIds = ["git_url_ssh", "git_url_http", "git_url_git"]
Expand Down
2 changes: 1 addition & 1 deletion config/locales/bg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/bs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/el.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/gl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/hu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
2 changes: 1 addition & 1 deletion config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
mirror_push_sucess: Success.
mirror_push_fail: Failed!

display_access_setup: Assuming that project1 is a parent of project2, and project2 is a parent of project3. Given the current configuration, project3's repository has the following properties
display_access_setup: Assume that <em>project1</em> is a parent of <em>project2</em>, and <em>project2</em> is a parent of <em>project3</em>. Given the current configuration, <em>project3</em>'s repository has the following properties
display_access_emphasis: In the above patterns, <em>emphasized</em> components represent context-dependent elements.
display_access_hierarchical: Parent projects are included in the URLs, since the repository is in <em>Hierarchical</em> mode.
display_access_flat: Parent projects are not included in the URLs, since the repository is in <em>Flat</em> mode.
Loading

0 comments on commit a472dbe

Please sign in to comment.