We now have a project service for 
this: 
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/models/project_services/emails_on_push_service.rb


On Wednesday, July 3, 2013 3:40:32 PM UTC+2, Дмитрий Рубцов wrote:
>
> Hello. You can:
> 1. install the gem: 
> https://github.com/git-commit-notifier/git-commit-notifier (sudo gem 
> install git-commit-notifier).
> 2. put files notyf.yml and post-receive (in attachments) in 
> /home/git/repositories/ (change notyf.yml - you have to correct smtp 
> settings)
> 3. and modify the /home/git/gitlab/app/observers/project_observer.rb (in 
> attachments), function after_update():
>
>  def after_update(project)
>     project.send_move_instructions if project.namespace_id_changed?
>     project.rename_repo if project.path_changed?
>     unless project.namespace_id_changed? then
>     require 'fileutils'
>     users_mails = []
>     file_etalon = "/home/git/repositories/notyf.yml"
>     file_target = 
> "/home/git/repositories/#{project.path_with_namespace}.git/notyf.yml"
>     file_etalon_hook = "/home/git/repositories/post-receive"
>     file_target_hook = 
> "/home/git/repositories/#{project.path_with_namespace}.git/hooks/post-receive"
>     File.delete(file_target_hook)
>     project.send_move_instructions if project.namespace_id_changed?
>     ActiveRecord::Base.connection.select_all("SELECT user_id FROM 
> users_projects WHERE project_id = #{project.id} AND (project_access=30 OR 
> project_access=40)").each do |line|
>       users_mails << User.where(:id=>line['user_id']).pluck(:email)
>     end
>     emails=users_mails.join(",")
>     File.open(file_target,'w') do |out|
>        out<<File.open(file_etalon).read.gsub(/mailinglist/,"mailinglist: 
> #{emails}")
>     end
>     File.open(file_target_hook,'w') do |out|
>        
> out<<File.open(file_etalon_hook).read.gsub(/git-commit-notifier/,"git-commit-notifier
>  
> #{file_target}")
>     end
>     File.chmod(0776,file_target_hook)
>     log_info("id changed")
>     end
>     log_info("Project updated...")
>   end
>
> So. When you press Save in page with properties of project, all users with 
> roles Developers (30) and Masters (40) written in file notyf.yml. And they 
> get messages about push.
> It is veeery ugly... and hard to explain but, it works.
>
> пятница, 21 июня 2013 г., 8:36:36 UTC+6 пользователь Zhiping Deng написал:
>>
>> Hi,
>>
>>
>> How can I configure gitlab to send email if someone push to the repo?
>>
>> I'm using gitlab 5.2. Currently no email was sent.  
>>
>> btw, commit comment email notification is ok.
>>
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to gitlabhq+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to