Sha256: f7b0f359a13fa70e7d002d41f46de3a86b7572b4ffce6c4e2e2026de92f225b4

Contents?: true

Size: 1.24 KB

Versions: 28

Compression:

Stored size: 1.24 KB

Contents

# encoding: utf-8

require 'rake/common/classes'
require 'rake/helpers/rake'

module Rake
  module Delphi
    class Sendmail < BasicTask

        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

        def sendmail
            if @task.application.unix?
                "sendmail"
            else
                ENV['SENDMAIL']
            end
        end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rake-delphi-0.0.33 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.32 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.31 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.29 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.30 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.28 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.27 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.26 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.25 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.24 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.23 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.22 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.21 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.20 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.19 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.18 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.17 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.16 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.15 lib/rake/common/sendmailtask.rb
rake-delphi-0.0.14 lib/rake/common/sendmailtask.rb