Commit 77d958ec45ac695864f92ce16233546b3a9d39b6
- Date: Thu May 01 23:17:02 +0000 2008
- Committer: David A. Cuadrado (krawek@gmail.com)
- Author: David A. Cuadrado (krawek@gmail.com)
- Commit SHA1: 77d958ec45ac695864f92ce16233546b3a9d39b6
- Tree SHA1: 6fc556a15fa38457c809264cd26044fa6e1dd726
- app/models/project.rb 5 --+++
- data/hooks/post-receive 6 ---+++
Commit diff
- Diff rendering mode:
- inline
- side by side
app/models/project.rb
|   | ||
| 134 | 134 | super({:procs => [info]}.merge(opts)) |
| 135 | 135 | end |
| 136 | 136 | |
| 137 | ||
| 138 | ||
| 137 | def create_event(action_id, target, user, data = nil, body = nil, date = Time.now.utc) | |
| 138 | events.create(:action => action_id, :target => target, :user => user, | |
| 139 | :body => body, :data => data, :created_at => date) | |
| 139 | 140 | end |
| 140 | 141 | |
| 141 | 142 | protected |
| toggle raw diff | ||
data/hooks/post-receive
|   | ||
| 79 | 79 | user_map = users.inject({}) { |hash, user| hash[user.email] = user; hash } |
| 80 | 80 | |
| 81 | 81 | revs.each do |sha1| |
| 82 | ||
| 82 | info = git.show({ :pretty => "format:author: %cn%nemail: %ce%ndate: %ct%nmessage: %s", :s => true}, sha1) | |
| 83 | 83 | |
| 84 | 84 | hash = {} |
| 85 | 85 | info.each { |line| |
| … | … | |
| 87 | 87 | key = $1.to_sym |
| 88 | 88 | value = $2 |
| 89 | 89 | |
| 90 | ||
| 90 | value = Time.at(value.to_i).utc if key == :date | |
| 91 | 91 | |
| 92 | 92 | hash[key] = value |
| 93 | 93 | end |
| … | … | |
| 144 | 144 | # puts "#{hash[:author]}: #{Action.name(action_id)} #{ref} on #{slug} [#{hash[:date]}]" |
| 145 | 145 | # puts " #{hash[:message]}" |
| 146 | 146 | |
| 147 | ||
| 147 | project.create_event(action_id, repository, user, ref, hash[:message], hash[:date]) | |
| 148 | 148 | end |
| 149 | 149 | end |
| 150 | 150 | |
| toggle raw diff | ||
