summaryrefslogtreecommitdiffstats
path: root/tasks/ann.rake
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-18 17:19:21 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-18 17:19:21 +0200
commit5dc46fec654ec6ee57334e61005967dc5e557e6c (patch)
treea48524eb060af5d9f2c13ed8f5cf6b763720fc1d /tasks/ann.rake
parentcb0ffa6cfd04dfae81bce57fbbe528f719d3efe5 (diff)
downloadedoors-ruby-5dc46fec654ec6ee57334e61005967dc5e557e6c.zip
edoors-ruby-5dc46fec654ec6ee57334e61005967dc5e557e6c.tar.gz
remove rake tasks
Diffstat (limited to 'tasks/ann.rake')
-rw-r--r--tasks/ann.rake83
1 files changed, 0 insertions, 83 deletions
diff --git a/tasks/ann.rake b/tasks/ann.rake
deleted file mode 100644
index 4515ccb..0000000
--- a/tasks/ann.rake
+++ /dev/null
@@ -1,83 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-begin
- require 'bones/smtp_tls'
-rescue LoadError
- require 'net/smtp'
-end
-require 'time'
-
-namespace :ann do
-
- # A prerequisites task that all other tasks depend upon
- task :prereqs
- file PROJ.ann.file do
- ann = PROJ.ann
- puts "Generating #{ann.file}"
- File.open(ann.file,'w') do |fd|
- fd.puts("#{PROJ.name} version #{PROJ.version}")
- fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
- fd.puts(" #{PROJ.url}") if PROJ.url.valid?
- fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
- fd.puts
- fd.puts("== DESCRIPTION")
- fd.puts
- fd.puts(PROJ.description)
- fd.puts
- fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
- fd.puts
- ann.paragraphs.each do |p|
- fd.puts "== #{p.upcase}"
- fd.puts
- fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
- fd.puts
- end
- fd.puts ann.text if ann.text
- end
- end
-
- desc "Create an announcement file"
- task :announcement => ['ann:prereqs', PROJ.ann.file]
-
- desc "Send an email announcement"
- task :email => ['ann:prereqs', PROJ.ann.file] do
- ann = PROJ.ann
- from = ann.email[:from] || Array(PROJ.authors).first || PROJ.email
- to = Array(ann.email[:to])
-
- ### build a mail header for RFC 822
- rfc822msg = "From: #{from}\n"
- rfc822msg << "To: #{to.join(',')}\n"
- rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
- rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
- rfc822msg << "\n"
- rfc822msg << "Date: #{Time.new.rfc822}\n"
- rfc822msg << "Message-Id: "
- rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
- rfc822msg << File.read(ann.file)
-
- params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
- ann.email[key]
- end
-
- params[3] = (PROJ.ann.email[:from] || PROJ.email) if params[3].nil?
-
-# if ann.email[:tls] and params[4].nil?
- if params[4].nil?
- STDOUT.write "Please enter your e-mail password (#{params[3]}): "
- params[4] = STDIN.gets.chomp
- end
-# params = params.shift 2 if not ann.email[:tls]
-
- ### send email
- # TODO find a way to bypass /var/lib/gems/1.9/gems/bones-3.6.5/lib/bones/smtp_tls.rb which forces starttls usage
- Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
- end
-end # namespace :ann
-
-desc 'Alias to ann:announcement'
-task :ann => 'ann:announcement'
-
-CLOBBER << PROJ.ann.file
-
-# EOF