Class: Reap::Hosts::Mailinglist

Inherits:
Host
  • Object
show all
Defined in:
lib/reap/hosts/mailinglist.rb

Overview

Mailinglist

Gerneic Mailing list “host”. Mailinglist hosts support the @announce@ task.

Direct Known Subclasses

RubyTalk

Instance Attribute Summary

Attributes inherited from Tool

#project

Instance Method Summary collapse

Methods inherited from Host

factory, inherited, #inspect, register, registry, #release_confirm?

Methods inherited from Tool

#debug?, #dryrun?, #force?, from_project, #initialize, #metadata, #trace?, #verbose?

Methods included from Utilities

#ask, #bin?, #cd, #command_paths, #compress, #dir!, #dir?, directory!, directory?, #email, exist!, exist?, #exists!, #exists?, #file!, #file?, #fileutils, #glob, #list_option, #multiglob, #multiglob_r, #out_of_date?, #password, path!, path?, #read, #rm_r, #safe?, #sh, #stage, #stage_manifest, #status, #write, #ziputils

Constructor Details

This class inherits a constructor from Reap::Tool

Instance Method Details

#announce(options) ⇒ Object

Email message. Options are:

message     Message to send.
mailto      Email address to whom to mail.
from        Email address from whom.
subject     Subject line (default is "ANN: project version").
server      Email server
port        Emails server port (default is usually correct).
account     Email account name (defaults to from).
domain      User domain (not sure why SMTP requires this?)
login       Login type (plain, login)
secure      Use TLS/SSL true or false?


29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/reap/hosts/mailinglist.rb', line 29

def announce(options)
  options = announce_options(options)

  subject = options[:subject]
  mailto  = options[:mailto] || options[:to]
  to      = [mailto].flatten.join(", ")

  if dryrun?
    puts "email '#{subject}' to #{to}"
  else
    emailer = Emailer.new(options)
    emailer.email
  end
end

#announce_confirm?(options) ⇒ Boolean

Confirm announcement

Returns:

  • (Boolean)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/reap/hosts/mailinglist.rb', line 46

def announce_confirm?(options)
  options = announce_options(options)

  if mailto = options[:mailto] || options[:to]
    return true if force?
    to  = [mailto].flatten.join(", ")
    ans = ask("Announce to #{to}?", "yN")
    case ans.downcase
    when 'y', 'yes'
      true
    else
      false
    end
  end
end

#announce_options(options) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/reap/hosts/mailinglist.rb', line 64

def announce_options(options)
  options  = options.rekey
  environ  = Emailer.environment_options
  defaults = project.defaults['email'].rekey

  result = {}
  result.update(defaults)
  result.update(environ)
  result.update(options)

  result[:subject] = (result[:subject] % [.unixname, .version])

  result
end