Skip to content

Commit

Permalink
allow users to specify multiple base urls and read-only urls for disp…
Browse files Browse the repository at this point in the history
…lay in overview section
  • Loading branch information
ericpaulbishop committed May 9, 2010
1 parent da09742 commit 6fd9527
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
11 changes: 10 additions & 1 deletion app/views/projects/_redmine_gitosis.rhtml
@@ -1,8 +1,17 @@
<% if @project.repository && @project.repository.is_a?(Repository::Git) %>
<div class="box">
<h3>Git Repository</h3>
<p>
<%= Gitosis::renderUrls(Setting.plugin_redmine_gitosis['readOnlyBaseUrls'], @project.id, true) %>
</p>
<p>
<%= Gitosis::renderUrls(Setting.plugin_redmine_gitosis['developerBaseUrls'], @project.id, false) %>

</p>
<!--
<ul>
<li>Developer URL: <input style="width: 95%;" class="url-field" type="text" readonly="true" value="<%= Setting.plugin_redmine_gitosis['developerBaseUrl'] + @project.identifier %>.git"/></li>
</ul>
-->
</div>
<% end %>
<% end %>
9 changes: 5 additions & 4 deletions init.rb
Expand Up @@ -13,10 +13,11 @@
description 'Enables Redmine to update a gitosis server.'
version '0.0.4'
settings :default => {
'gitosisUrl' => 'git@localhost:gitosis-admin.git',
'gitosisIdentityFile' => '/opt/redmine/.ssh/id_rsa',
'developerBaseUrl' => 'git@localhost:',
'basePath' => '/opt/git/repositories/'
'gitosisUrl' => 'git@localhost:gitosis-admin.git',
'gitosisIdentityFile' => '/srv/projects/redmine/miner/.ssh/id_rsa',
'developerBaseUrls' => ['git@localhost:'],
'readOnlyBaseUrls' => [],
'basePath' => '/srv/projects/git/repositories/',
},
:partial => 'redmine_gitosis'
end
Expand Down
24 changes: 17 additions & 7 deletions lib/gitosis.rb
Expand Up @@ -4,15 +4,25 @@

module Gitosis

# commands
# ENV['GIT_SSH'] = SSH_WITH_IDENTITY_FILE = File.join(RAILS_ROOT, 'vendor/plugins/redmine_gitosis/extra/ssh_with_identity_file.sh')
def self.renderUrls(baseUrlList, projectId, isReadOnly)
rendered = ""
if(not defined?(baseUrlList.length))
return rendered
end

if(baseUrlList.length == 0)
return rendered
end
rendered = rendered + "<strong>" + (isReadOnly? "Read Only" : "Developer") + " " + (baseUrlList.length == 1 ? "URL" : "URLs") + ": </strong><br/>"
rendered = rendered + "<ul>";
for baseUrl in baseUrlList do
rendered = rendered + "<li>" + "<input style=\"width: 95%;\" class=\"url-field\" type=\"text\" readonly=\"true\" value=\"" + baseUrl + projectId + ".git\" /></li>"
end
rendered = rendered + "</ul>\n"
return rendered
end

# def self.destroy_repository(project)
# path = File.join(GITOSIS_BASE_PATH, "#{project.identifier}.git")
# `rm -Rf #{path}`
# end


def self.update_repositories(projects)
projects = (projects.is_a?(Array) ? projects : [projects])

Expand Down

0 comments on commit 6fd9527

Please sign in to comment.