]> nos-oignons.net Git - gestion-adh.git/blobdiff - bin/update-ag-subscribers
Move script logic into module methods
[gestion-adh.git] / bin / update-ag-subscribers
index f10978ebc0fb26a5c657a4d6f722e48bf4a49281..59d5a91d659abad97decbdab7710a4470469527e 100755 (executable)
@@ -5,13 +5,6 @@ require 'rubygems'
 require 'bundler'
 Bundler.setup
 
 require 'bundler'
 Bundler.setup
 
-require 'nos_oignons/mailman'
-require 'nos_oignons/subscriptions'
+require 'nos_oignons'
 
 
-LIST = 'ag'
-
-current_emails = NosOignons::Mailman.list_members(LIST)
-uptodate_emails = NosOignons::Subscription.all.select(&:up_to_date?).collect(&:email)
-
-NosOignons::Mailman.add_members(LIST, uptodate_emails - current_emails)
-NosOignons::Mailman.remove_members(LIST, current_emails - uptodate_emails)
+NosOignons.update_ag_subscribers!