2014-09-02 18:07:02 +05:30
|
|
|
class Projects::RepositoriesController < Projects::ApplicationController
|
|
|
|
# Authorize
|
2015-09-11 14:41:01 +05:30
|
|
|
before_action :require_non_empty_project, except: :create
|
|
|
|
before_action :authorize_download_code!
|
|
|
|
before_action :authorize_admin_project!, only: :create
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def create
|
|
|
|
@project.create_repository
|
|
|
|
|
|
|
|
redirect_to project_path(@project)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def archive
|
2015-10-24 18:46:33 +05:30
|
|
|
render json: ArchiveRepositoryService.new(@project, params[:ref], params[:format]).execute
|
|
|
|
rescue => ex
|
|
|
|
logger.error("#{self.class.name}: #{ex}")
|
|
|
|
return git_not_found!
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|