gitlabhq/app/observers/project_observer.rb

32 lines
689 B
Ruby
Raw Normal View History

class ProjectObserver < ActiveRecord::Observer
def after_create(project)
2013-02-11 18:27:26 +01:00
GitlabShellWorker.perform_async(
2013-02-04 14:07:56 +01:00
:add_repository,
project.path_with_namespace
)
log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"")
end
def after_update(project)
project.send_move_instructions if project.namespace_id_changed?
end
def after_destroy(project)
2013-02-11 18:27:26 +01:00
GitlabShellWorker.perform_async(
2013-02-04 14:07:56 +01:00
:remove_repository,
project.path_with_namespace
2013-02-04 14:07:56 +01:00
)
2012-09-11 22:24:53 +02:00
project.satellite.destroy
2012-09-11 22:24:53 +02:00
2013-02-04 14:07:56 +01:00
log_info("Project \"#{project.name}\" was removed")
2012-09-11 22:24:53 +02:00
end
protected
def log_info message
Gitlab::AppLogger.info message
end
end