]> nos-oignons.net Git - gestion-adh.git/blob - bin/update-ag-subscribers
Finish implenting update-ag-subscribers
[gestion-adh.git] / bin / update-ag-subscribers
1 #!/usr/bin/ruby1.9.1
2 #-*- coding: utf-8 -*-
3
4 require 'rubygems'
5 require 'bundler'
6 Bundler.setup
7
8 require 'nos_oignons/mailman'
9 require 'nos_oignons/subscriptions'
10
11 LIST = 'ag'
12
13 current_emails = NosOignons::Mailman.list_members(LIST)
14 uptodate_emails = NosOignons::Subscription.all.select(&:up_to_date?).collect(&:email)
15
16 NosOignons::Mailman.add_members(LIST, uptodate_emails - current_emails)
17 NosOignons::Mailman.remove_members(LIST, current_emails - uptodate_emails)