diff options
-rw-r--r-- | .foreman | 1 | ||||
-rw-r--r-- | Procfile | 2 | ||||
-rw-r--r-- | app/controllers/hooks_controller.rb | 9 | ||||
-rw-r--r-- | app/views/hooks/show.html.haml | 3 | ||||
-rw-r--r-- | config/routes.rb | 6 |
5 files changed, 19 insertions, 2 deletions
diff --git a/.foreman b/.foreman new file mode 100644 index 00000000000..549e85b1490 --- /dev/null +++ b/.foreman @@ -0,0 +1 @@ +port: 9999 diff --git a/Procfile b/Procfile new file mode 100644 index 00000000000..2f73f49416d --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +web: bundle exec rails s -p $PORT +worker: bundle exec rake environment resque:work QUEUE=* diff --git a/app/controllers/hooks_controller.rb b/app/controllers/hooks_controller.rb index 9205a6a6f67..7c5f7631f4e 100644 --- a/app/controllers/hooks_controller.rb +++ b/app/controllers/hooks_controller.rb @@ -29,6 +29,15 @@ class HooksController < ApplicationController end end + def test + @hook = @project.web_hooks.find(params[:id]) + commits = @project.commits(@project.default_branch, nil, 3) + data = @project.web_hook_data(commits.last.id, commits.first.id, "refs/heads/#{@project.default_branch}") + @hook.execute(data) + + redirect_to :back + end + def show @hook = @project.web_hooks.find(params[:id]) end diff --git a/app/views/hooks/show.html.haml b/app/views/hooks/show.html.haml index 56b5fa9d3a1..6bc1132de27 100644 --- a/app/views/hooks/show.html.haml +++ b/app/views/hooks/show.html.haml @@ -1,7 +1,8 @@ = render "repositories/head" -= debug @hook +%h3= @hook.url - if can? current_user, :admin_project, @project .merge-tabs + = link_to 'Test Hook', test_project_hook_path(@project, @hook), :class => "grey-button" .right = link_to 'Remove', project_hook_path(@project, @hook), :confirm => 'Are you sure?', :method => :delete, :class => "red-button" diff --git a/config/routes.rb b/config/routes.rb index 5f129c904d0..9d1e7089209 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,7 +85,11 @@ Gitlab::Application.routes.draw do end resources :snippets - resources :hooks, :only => [:index, :new, :create, :destroy, :show] + resources :hooks, :only => [:index, :new, :create, :destroy, :show] do + member do + get :test + end + end resources :commits resources :team_members resources :issues do |