]> nos-oignons.net Git - gestion-adh.git/blob - features/support/mock_mailman/add_members
Try to make Git play nicer with Aruba
[gestion-adh.git] / features / support / mock_mailman / add_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] != '-r'
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)) }