Skip to content

Commit

Permalink
Disabled ssh private key in plugin (for now). Allow creation of proje…
Browse files Browse the repository at this point in the history
…cts without git repo
  • Loading branch information
untoldwind committed Apr 19, 2010
1 parent 5406045 commit 290fbd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
16 changes: 8 additions & 8 deletions app/models/gitosis_observer.rb
Expand Up @@ -2,13 +2,13 @@ class GitosisObserver < ActiveRecord::Observer
observe :project, :user, :gitosis_public_key, :member, :role, :repository


def before_create(object)
if object.is_a?(Project)
repo = Repository::Git.new
repo.url = repo.root_url = File.join(Gitosis::GITOSIS_BASE_PATH,"#{object.identifier}.git")
object.repository = repo
end
end
# def before_create(object)
# if object.is_a?(Project)
# repo = Repository::Git.new
# repo.url = repo.root_url = File.join(Gitosis::GITOSIS_BASE_PATH,"#{object.identifier}.git")
# object.repository = repo
# end
# end

def after_save(object) ; update_repositories(object) ; end
def after_destroy(object) ; update_repositories(object) ; end
Expand All @@ -26,4 +26,4 @@ def update_repositories(object)
end
end

end
end
9 changes: 4 additions & 5 deletions lib/gitosis.rb
Expand Up @@ -4,11 +4,11 @@

module Gitosis
# server config
GITOSIS_URI = 'git@your-server.com:/gitosis-admin.git'
GITOSIS_BASE_PATH = '/opt/gitosis/repositories/'
GITOSIS_URI = 'git@localhost:gitosis-admin.git'
GITOSIS_BASE_PATH = '/opt/git/repositories/'

# commands
ENV['GIT_SSH'] = SSH_WITH_IDENTITY_FILE = File.join(RAILS_ROOT, 'vendor/plugins/redmine_gitosis/extra/ssh_with_identity_file.sh')
# ENV['GIT_SSH'] = SSH_WITH_IDENTITY_FILE = File.join(RAILS_ROOT, 'vendor/plugins/redmine_gitosis/extra/ssh_with_identity_file.sh')

def self.destroy_repository(project)
path = File.join(GITOSIS_BASE_PATH, "#{project.identifier}.git")
Expand All @@ -29,7 +29,7 @@ def self.update_repositories(projects)

# clone repo
`git clone #{GITOSIS_URI} #{local_dir}/gitosis`

changed = false

projects.select{|p| p.repository.is_a?(Repository::Git)}.each do |project|
Expand Down Expand Up @@ -60,7 +60,6 @@ def self.update_repositories(projects)
changed = true
end
end

if changed
# add, commit, push, and remove local tmp dir
`cd #{File.join(local_dir,'gitosis')} ; git add keydir/* gitosis.conf`
Expand Down

0 comments on commit 290fbd4

Please sign in to comment.