lib/taskjuggler/SheetHandlerBase.rb in taskjuggler-0.0.11 vs lib/taskjuggler/SheetHandlerBase.rb in taskjuggler-0.1.0

- old
+ new

@@ -121,15 +121,17 @@ def addToScm(message, fileName) return unless @scmCommand cmd = @scmCommand.gsub(/%m/, message) cmd.gsub!(/%f/, fileName) - `#{cmd}` unless @dryRun - if $? == 0 - info("Added #{fileName} to SCM") - else - error("SCM command #{cmd} failed: #{$?}") + unless @dryRun + `#{cmd}` + if $? == 0 + info("Added #{fileName} to SCM") + else + error("SCM command #{cmd} failed: #{$?.class}") + end end end def info(message) puts message if @outputLevel >= 3 @@ -142,11 +144,11 @@ end def error(message) $stderr.puts message if @outputLevel >= 1 log("ERROR", message) if @logLevel >= 1 - exit 1 + raise TjRuntimeError end def log(type, message) timeStamp = Time.new.strftime("%Y-%m-%d %H:%M:%S") File.open(@logFile, 'a') do |f| @@ -185,18 +187,18 @@ self_ = self mail = Mail.new do subject subject text_part do content_type [ 'text', 'plain', { 'charset' => 'UTF-8' } ] - content_transfer_encoding 'quoted-printable' - body message.to_s.to_quoted_printable + content_transfer_encoding 'base64' + body message.to_s.to_base64 end if message.is_a?(RichTextIntermediate) html_part do content_type 'text/html; charset=UTF-8' - content_transfer_encoding 'quoted-printable' - body self_.htmlMailBody(message).to_quoted_printable + content_transfer_encoding 'base64' + body self_.htmlMailBody(message).to_base64 end end end mail.to = to mail.from = from || @senderEmail @@ -215,21 +217,21 @@ error("Email processing failed: #{$!}") end if @dryRun # For testing and debugging, we only print out the email. - puts mail.to_s + puts "-- Email Start #{'-' * 60}\n#{mail.to_s}-- Email End #{'-' * 62}" log('INFO', "Show email '#{subject}' to #{to}") else # Actually send out the email via SMTP. begin mail.deliver rescue # We try to send out another email. If that fails again, we abort # without further attempts. if @emailFailure log('ERROR', "Email double fault: #{$!}") - exit 1 + raise TjRuntimeError else @emailFailure = true error("Email transmission failed: #{$!}") end end