2012-03-04 15:35:15 +02:00
|
|
|
class ProjectObserver < ActiveRecord::Observer
|
2012-11-21 08:54:05 +03:00
|
|
|
def after_create(project)
|
2013-02-11 19:27:26 +02:00
|
|
|
GitlabShellWorker.perform_async(
|
2013-02-04 15:07:56 +02:00
|
|
|
:add_repository,
|
|
|
|
project.path_with_namespace
|
|
|
|
)
|
|
|
|
|
|
|
|
log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"")
|
2012-03-04 15:35:15 +02:00
|
|
|
end
|
|
|
|
|
2012-12-20 22:16:51 +02:00
|
|
|
def after_update(project)
|
|
|
|
project.send_move_instructions if project.namespace_id_changed?
|
2012-11-21 08:54:05 +03:00
|
|
|
end
|
|
|
|
|
2012-03-04 15:35:15 +02:00
|
|
|
def after_destroy(project)
|
2013-02-11 19:27:26 +02:00
|
|
|
GitlabShellWorker.perform_async(
|
2013-02-04 15:07:56 +02:00
|
|
|
:remove_repository,
|
2013-02-05 12:47:50 +02:00
|
|
|
project.path_with_namespace
|
2013-02-04 15:07:56 +02:00
|
|
|
)
|
2012-09-11 23:24:53 +03:00
|
|
|
|
2013-01-28 17:22:45 +02:00
|
|
|
project.satellite.destroy
|
2012-09-11 23:24:53 +03:00
|
|
|
|
2013-02-04 15:07:56 +02:00
|
|
|
log_info("Project \"#{project.name}\" was removed")
|
2012-09-11 23:24:53 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def log_info message
|
|
|
|
Gitlab::AppLogger.info message
|
|
|
|
end
|
2012-03-04 15:35:15 +02:00
|
|
|
end
|