diff options
author | Raphael Sofaer <raphael@joindiaspora.com> | 2011-08-02 01:49:21 +0400 |
---|---|---|
committer | Raphael Sofaer <raphael@joindiaspora.com> | 2011-08-02 01:49:21 +0400 |
commit | 3d88095ba2f934be92263275e3206b2cbfd47786 (patch) | |
tree | 9914572c70d4ae73ca86061e59e542aefce1daa6 /lib/rake_helpers.rb | |
parent | 983d4e55981af68e5c5810cfd3618403c58a40fb (diff) |
Updating batch inviter
Diffstat (limited to 'lib/rake_helpers.rb')
-rw-r--r-- | lib/rake_helpers.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/rake_helpers.rb b/lib/rake_helpers.rb index 6ff16ef7f..ea25274b3 100644 --- a/lib/rake_helpers.rb +++ b/lib/rake_helpers.rb @@ -2,26 +2,32 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. module RakeHelpers - def process_emails(csv, num_to_process, offset, num_invites=10, test=true) + + def load_yaml + + end + + def process_emails(csv, num_to_process, offset, test=true) if RUBY_VERSION.include? "1.8" + require 'fastercsv' backers = FasterCSV.read(csv) else require 'csv' backers = CSV.read(csv) end - puts "IN TEST MODE" if test + puts "DRY RUN" if test churn_through = 0 num_to_process.times do |n| if backers[n+offset] == nil break end churn_through = n - backer_name = backers[n+offset][0].to_s.strip - backer_email = backers[n+offset][1].to_s.gsub('.ksr', '').strip - unless User.find_by_email(backer_email) + backer_name = backers[n+offset][1].to_s.strip + backer_email = backers[n+offset][0].to_s.strip + unless User.find_by_email(backer_email) || User.find_by_invitation_identifier(backer_email) puts "sending email to: #{backer_name} #{backer_email}" unless Rails.env == 'test' - Invitation.create_invitee(:service => 'email', :identifier => backer_email, :name => backer_name, :invites => num_invites) unless test + Invitation.create_invitee(:service => 'email', :identifier => backer_email, :name => backer_name ) unless test else puts "user with the email exists: #{backer_email} , #{backer_name} " unless Rails.env == 'test' end |