]> nos-oignons.net Git - gestion-adh.git/blob - features/support/mock_mailman/remove_members
Finish implenting update-ag-subscribers
[gestion-adh.git] / features / support / mock_mailman / remove_members
1 #!/usr/bin/ruby1.9.1
2
3 require 'json'
4
5 db = ENV['MOCK_MAILMAN_DB']
6
7 lists = JSON.load(File.read(db))
8 if ARGV[0] != '-f'
9   $stderr.puts "Bad call"
10   exit 1
11 else
12   emails = (ARGV[1] == '-' ? $stdin : File.open(ARGV[1])).read.split
13   lists[ARGV[2]] = (lists[ARGV[2]] || []) - emails
14 end
15 File.open(db, 'w') { |f| f.write(JSON.dump(lists)) }