Commit 473445c76fe6d99243a0e6b0247bc79cc47c3e44
1 parent
57ac5fe9
Exists in
master
and in
4 other branches
complete hooks for post receive
Showing
7 changed files
with
64 additions
and
5 deletions
Show diff stats
.foreman
app/controllers/projects_controller.rb
| @@ -68,7 +68,7 @@ class ProjectsController < ApplicationController | @@ -68,7 +68,7 @@ class ProjectsController < ApplicationController | ||
| 68 | 68 | ||
| 69 | def show | 69 | def show |
| 70 | return render "projects/empty" unless @project.repo_exists? && @project.has_commits? | 70 | return render "projects/empty" unless @project.repo_exists? && @project.has_commits? |
| 71 | - limit = (params[:limit] || 10).to_i | 71 | + limit = (params[:limit] || 20).to_i |
| 72 | @activities = @project.cached_updates(limit) | 72 | @activities = @project.cached_updates(limit) |
| 73 | end | 73 | end |
| 74 | 74 |
app/controllers/repositories_controller.rb
| @@ -9,7 +9,7 @@ class RepositoriesController < ApplicationController | @@ -9,7 +9,7 @@ class RepositoriesController < ApplicationController | ||
| 9 | layout "project" | 9 | layout "project" |
| 10 | 10 | ||
| 11 | def show | 11 | def show |
| 12 | - @activities = @project.fresh_commits(10) | 12 | + @activities = @project.fresh_commits(20) |
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | def branches | 15 | def branches |
| @@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
| 1 | +<% data_ex_str = <<eos | ||
| 2 | +{ | ||
| 3 | + :before => "95790bf891e76fee5e1747ab589903a6a1f80f22", | ||
| 4 | + :after => "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", | ||
| 5 | + :ref => "refs/heads/master", | ||
| 6 | + :repository => { | ||
| 7 | + :name => "Diaspora", | ||
| 8 | + :url => "localhost/diaspora", | ||
| 9 | + :description => "", | ||
| 10 | + :homepage => "localhost/diaspora", | ||
| 11 | + :private => true | ||
| 12 | + }, | ||
| 13 | + :commits => [ | ||
| 14 | + [0] { | ||
| 15 | + :id => "450d0de7532f8b663b9c5cce183b...", | ||
| 16 | + :message => "Update Catalan translation to e38cb41.", | ||
| 17 | + :timestamp => "2011-12-12T14:27:31+02:00", | ||
| 18 | + :url => "http://localhost/diaspora/commits/450d0de7532f...", | ||
| 19 | + :author => { | ||
| 20 | + :name => "Jordi Mallach", | ||
| 21 | + :email => "jordi@softcatala.org" | ||
| 22 | + } | ||
| 23 | + }, | ||
| 24 | + | ||
| 25 | + .... | ||
| 26 | + | ||
| 27 | + [3] { | ||
| 28 | + :id => "da1560886d4f094c3e6c9ef40349...", | ||
| 29 | + :message => "fixed readme", | ||
| 30 | + :timestamp => "2012-01-03T23:36:29+02:00", | ||
| 31 | + :url => "http://localhost/diaspora/commits/da1560886d...", | ||
| 32 | + :author => { | ||
| 33 | + :name => "gitlab dev user", | ||
| 34 | + :email => "gitlabdev@dv6700.(none)" | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + ] | ||
| 38 | +} | ||
| 39 | +eos | ||
| 40 | +%> | ||
| 41 | +<% js_lexer = Pygments::Lexer[:js] %> | ||
| 42 | +<%= raw js_lexer.highlight(data_ex_str) %> |
app/views/hooks/index.html.haml
| 1 | = render "repositories/head" | 1 | = render "repositories/head" |
| 2 | + | ||
| 3 | + | ||
| 4 | + | ||
| 5 | + | ||
| 2 | .right= link_to "Add new", new_project_hook_path(@project), :class => "grey-button append-bottom-10" | 6 | .right= link_to "Add new", new_project_hook_path(@project), :class => "grey-button append-bottom-10" |
| 3 | - unless @hooks.empty? | 7 | - unless @hooks.empty? |
| 4 | %div.update-data.ui-box.ui-box-small | 8 | %div.update-data.ui-box.ui-box-small |
| @@ -14,3 +18,13 @@ | @@ -14,3 +18,13 @@ | ||
| 14 | - else | 18 | - else |
| 15 | %h3 No hooks | 19 | %h3 No hooks |
| 16 | 20 | ||
| 21 | +.clear | ||
| 22 | +%h3 Help | ||
| 23 | +%p | ||
| 24 | + Post receive hooks. For now only POST request allowed. We send some data with request. Example below | ||
| 25 | + | ||
| 26 | +.view_file | ||
| 27 | + .view_file_header | ||
| 28 | + %strong POST data passed | ||
| 29 | + .data.no-padding | ||
| 30 | + = render "data_ex" |
app/views/hooks/show.html.haml
config/database.yml