Sha256: bec64eeef8297d6cb2d2907efa57a43d97424a4e38e5415a5121079307e871bf
Contents?: true
Size: 1.33 KB
Versions: 4
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby ################################################################################ # notify # # This hook is reponsible for notifying the user of the results of a task, such # as a Continuous Integration build. # # PARAMETERS: # # This hook will be called with the form: # # .devver/hooks/notify TASK EXIT_STATUS # # * TASK is the name of the task that triggered the notification # * EXIT_STATUS is the numeric exit status of the task. 0 indicates success. # # INPUT: # # This hook will be provided with a transcript of the triggering task's output. # Both STDOUT and STDERR output will be included in the transcript. # # OUTPUT: # # This task should exit with a 0 status if the notification was successful, and # a nonzero status if the notification failed. # ################################################################################ require 'net/smtp' require 'time' to = "devs@devver.net" success = ARGV[0].to_i == 0 recipient = ENV.fetch('NOTIFY_RECIPIENT'){to} message = <<"EOF" From: support@devver.net To: #{recipient} Subject: Build #{success ? 'succeeded' : 'failed'} Date: #{Time.now.rfc2822} The task "#{ARGV[1]}" #{success ? 'succeeded' : 'failed'}. Output: #{$stdin.read} EOF Net::SMTP.start('localhost', 25) do |smtp| smtp.send_message(message, 'application@devver.net', recipient) end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
devver-construct-1.1.0 | .devver/hooks/notify |
test-construct-1.2.2 | .devver/hooks/notify |
test-construct-1.2.1 | .devver/hooks/notify |
test-construct-1.2.0 | .devver/hooks/notify |