Commit 473445c76fe6d99243a0e6b0247bc79cc47c3e44

Authored by Dmitriy Zaporozhets
1 parent 57ac5fe9

complete hooks for post receive

.foreman
1   -port: 9999
  1 +port: 3000
... ...
app/controllers/projects_controller.rb
... ... @@ -68,7 +68,7 @@ class ProjectsController < ApplicationController
68 68  
69 69 def show
70 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 72 @activities = @project.cached_updates(limit)
73 73 end
74 74  
... ...
app/controllers/repositories_controller.rb
... ... @@ -9,7 +9,7 @@ class RepositoriesController < ApplicationController
9 9 layout "project"
10 10  
11 11 def show
12   - @activities = @project.fresh_commits(10)
  12 + @activities = @project.fresh_commits(20)
13 13 end
14 14  
15 15 def branches
... ...
app/views/hooks/_data_ex.html.erb 0 → 100644
... ... @@ -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 1 = render "repositories/head"
  2 +
  3 +
  4 +
  5 +
2 6 .right= link_to "Add new", new_project_hook_path(@project), :class => "grey-button append-bottom-10"
3 7 - unless @hooks.empty?
4 8 %div.update-data.ui-box.ui-box-small
... ... @@ -14,3 +18,13 @@
14 18 - else
15 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
1 1 = render "repositories/head"
2   -%h3= @hook.url
  2 +%h3
  3 + %span.commit.tag POST
  4 + = @hook.url
  5 +
3 6  
4 7 - if can? current_user, :admin_project, @project
5 8 .merge-tabs
... ...
config/database.yml
... ... @@ -20,6 +20,6 @@ test:
20 20  
21 21 production:
22 22 adapter: sqlite3
23   - database: db/production.sqlite3
  23 + database: db/development.sqlite3
24 24 pool: 5
25 25 timeout: 5000
... ...