2012-11-19 20:34:05 +01:00
|
|
|
class ServicesController < ProjectResourceController
|
|
|
|
# Authorize
|
|
|
|
before_filter :authorize_admin_project!
|
|
|
|
|
|
|
|
respond_to :html
|
|
|
|
|
|
|
|
def index
|
|
|
|
@gitlab_ci_service = @project.gitlab_ci_service
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@service = @project.gitlab_ci_service
|
|
|
|
|
|
|
|
# Create if missing
|
|
|
|
@service = @project.create_gitlab_ci_service unless @service
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@service = @project.gitlab_ci_service
|
|
|
|
|
|
|
|
if @service.update_attributes(params[:service])
|
2012-11-20 13:16:04 +01:00
|
|
|
redirect_to edit_project_service_path(@project, :gitlab_ci)
|
2012-11-19 20:34:05 +01:00
|
|
|
else
|
|
|
|
render 'edit'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test
|
2013-03-20 15:41:59 +01:00
|
|
|
data = GitPushService.new.sample_data(project, current_user)
|
2012-11-19 20:34:05 +01:00
|
|
|
|
|
|
|
@service = project.gitlab_ci_service
|
|
|
|
@service.execute(data)
|
|
|
|
|
|
|
|
redirect_to :back
|
|
|
|
end
|
|
|
|
end
|