def define_publish_tasks
if need_rdoc then
task :isolate
desc "Generate rdoc"
task :docs => [:clobber_docs, :isolate] do
sh(*make_rdoc_cmd)
end
desc "Generate rdoc coverage report"
task :dcov => :isolate do
sh(*make_rdoc_cmd('-C'))
end
desc "Remove RDoc files"
task :clobber_docs do
rm_rf local_rdoc_dir
end
task :clobber => :clobber_docs
desc 'Generate ri locally for testing.'
task :ridocs => [:clean, :isolate] do
ruby(*make_rdoc_cmd('--ri', '-o', 'ri'))
end
end
desc "Publish RDoc to wherever you want."
task :publish_docs => [:clean, :docs] do
warn "no rdoc_location values" if rdoc_locations.empty?
self.rdoc_locations.each do |dest|
sh %{rsync #{rsync_args} #{local_rdoc_dir}/ #{dest}}
end
end
task :publish_on_announce do
with_config do |config, _|
Rake::Task['publish_docs'].invoke if config["publish_on_announce"]
end
end
desc 'Generate email announcement file.'
task :debug_email do
puts generate_email
end
desc 'Post announcement to blog. Uses the "blogs" array in your hoerc.'
task :post_blog do
with_config do |config, path|
break unless config['blogs']
config['blogs'].each do |site|
if site['path'] then
msg = "post_blog_#{site['type']}"
send msg, site
system site["cmd"] if site["cmd"]
else
require 'xmlrpc/client'
_, title, body, urls = announcement
body += "\n\n#{urls}"
server = XMLRPC::Client.new2(site['url'])
content = site['extra_headers'].merge(:title => title,
:description => body,
:categories => blog_categories)
server.call('metaWeblog.newPost',
site['blog_id'],
site['user'],
site['password'],
content,
true)
end
end
end
end
desc 'Announce your release.'
task :announce => [:post_blog, :publish_on_announce ]
end