Method: Torque#email_notes
- Defined in:
- lib/torque.rb
#email_notes(notes_string, project_name, mailer = nil) ⇒ Object
Emails notes_string to the email list specified in the torque info file
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/torque.rb', line 129 def email_notes(notes_string, project_name, mailer=nil) print_if_not_silent "Emailing notes..." mailer ||= Mailer.new(@settings.email_address, @settings.email_password) if @settings.email_address.blank? print_if_not_silent "Emailing notes failed: No sender email address found. (Set this with 'torque email')" elsif @settings.email_password.blank? print_if_not_silent "Emailing notes failed: No sender email password found. (Set this with 'torque email')" elsif(@settings.email_to.length == 0) print_if_not_silent "No email addresses found. (Add them with 'torque email')" else address_list = "" @settings.email_to.each_with_index { |address, i| if i!=0 address_list << ", " end address_list << address } subject_line = \ "Release Notes: Project #{@settings.project} - '#{project_name}' (" \ + (@settings.custom_date_range ? "Custom " : "") \ + "#{@settings.accept_from.strftime('%Y/%m/%d')} - " \ + "#{@settings.accept_to.strftime('%Y/%m/%d')}" \ + ")" mailer.send_notes(notes_string, subject_line, address_list) print_if_not_silent "Emailed notes to #{address_list}" end end |