Class: Rake::Delphi::Sendmail
- Defined in:
- lib/rake/common/sendmailtask.rb
Instance Method Summary collapse
-
#initialize(task, opts) ⇒ Sendmail
constructor
A new instance of Sendmail.
- #sendmail ⇒ Object
Methods inherited from BasicTask
Constructor Details
#initialize(task, opts) ⇒ Sendmail
Returns a new instance of Sendmail.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rake/common/sendmailtask.rb', line 10 def initialize(task, opts) super(task) cmd = '' predefined = { :from => '-f', :"from.full" => '-F', :extra => nil, :to => nil } predefined.keys.sort{|a, b| a.to_s <=> b.to_s}.each do |k| cmd += "#{predefined[k]} #{opts[k]} " if opts[k] end cmd = "#{sendmail} -i #{cmd}" Logger.trace(Logger::VERBOSE, cmd) if @task.application.windows? && Rake.ruby18? require 'win32/open3' else require 'open3' end Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr| stdin.puts(opts[:text]) stdin.close while s = stdout.gets puts s end while s = stderr.gets puts s end end end |
Instance Method Details
#sendmail ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/rake/common/sendmailtask.rb', line 36 def sendmail if @task.application.unix? "sendmail" else ENV['SENDMAIL'] end end |