2012-03-04 14:35:15 +01:00
|
|
|
class ProjectObserver < ActiveRecord::Observer
|
2012-11-21 06:54:05 +01:00
|
|
|
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}\"")
|
2012-03-04 14:35:15 +01:00
|
|
|
end
|
|
|
|
|
2012-12-20 21:16:51 +01:00
|
|
|
def after_update(project)
|
|
|
|
project.send_move_instructions if project.namespace_id_changed?
|
2012-11-21 06:54:05 +01:00
|
|
|
end
|
|
|
|
|
2012-03-04 14:35:15 +01:00
|
|
|
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,
|
2013-02-05 11:47:50 +01:00
|
|
|
project.path_with_namespace
|
2013-02-04 14:07:56 +01:00
|
|
|
)
|
2012-09-11 22:24:53 +02:00
|
|
|
|
2013-01-28 16:22:45 +01: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
|
2012-03-04 14:35:15 +01:00
|
|
|
end
|