2013-03-26 16:11:38 +00:00
|
|
|
class ProjectObserver < BaseObserver
|
2012-11-21 05:54:05 +00:00
|
|
|
def after_create(project)
|
2013-06-14 13:30:48 +00:00
|
|
|
return true if project.forked? || project.imported?
|
|
|
|
|
|
|
|
GitlabShellWorker.perform_async(
|
|
|
|
:add_repository,
|
|
|
|
project.path_with_namespace
|
|
|
|
)
|
|
|
|
|
|
|
|
log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"")
|
2012-03-04 13:35:15 +00:00
|
|
|
end
|
|
|
|
|
2012-12-20 20:16:51 +00:00
|
|
|
def after_update(project)
|
|
|
|
project.send_move_instructions if project.namespace_id_changed?
|
2013-05-24 21:07:19 +00:00
|
|
|
project.rename_repo if project.path_changed?
|
2012-11-21 05:54:05 +00:00
|
|
|
end
|
|
|
|
|
2013-06-04 15:20:50 +00:00
|
|
|
def before_destroy(project)
|
|
|
|
project.repository.expire_cache unless project.empty_repo?
|
|
|
|
end
|
|
|
|
|
2012-03-04 13:35:15 +00:00
|
|
|
def after_destroy(project)
|
2013-02-11 17:27:26 +00:00
|
|
|
GitlabShellWorker.perform_async(
|
2013-02-04 13:07:56 +00:00
|
|
|
:remove_repository,
|
2013-02-05 10:47:50 +00:00
|
|
|
project.path_with_namespace
|
2013-02-04 13:07:56 +00:00
|
|
|
)
|
2012-09-11 20:24:53 +00:00
|
|
|
|
2013-03-04 03:43:52 +00:00
|
|
|
GitlabShellWorker.perform_async(
|
|
|
|
:remove_repository,
|
|
|
|
project.path_with_namespace + ".wiki"
|
|
|
|
)
|
|
|
|
|
2013-01-28 15:22:45 +00:00
|
|
|
project.satellite.destroy
|
2012-09-11 20:24:53 +00:00
|
|
|
|
2013-02-04 13:07:56 +00:00
|
|
|
log_info("Project \"#{project.name}\" was removed")
|
2012-09-11 20:24:53 +00:00
|
|
|
end
|
2012-03-04 13:35:15 +00:00
|
|
|
end
|