lib/choctop/appcast.rb in choctop-0.9.2 vs lib/choctop/appcast.rb in choctop-0.9.3

- old
+ new

@@ -5,52 +5,75 @@ def make_appcast app_name = File.basename(File.expand_path('.')) FileUtils.mkdir_p "#{build_path}" - appcast = File.open("#{build_path}/#{appcast_filename}", 'w') + appcast = File.open("#{build_path}/#{appcast_filename}", 'w') do |f| + xml = Builder::XmlMarkup.new(:indent => 2) + xml.instruct! + xml_string = xml.rss('xmlns:atom' => "http://www.w3.org/2005/Atom", + 'xmlns:sparkle' => "http://www.andymatuschak.org/xml-namespaces/sparkle", + :version => "2.0") do + xml.channel do + xml.title(app_name) + xml.description("#{app_name} updates") + xml.link(base_url) + xml.language('en') + xml.pubDate Time.now.to_s(:rfc822) + # xml.lastBuildDate(Time.now.rfc822) + xml.atom(:link, :href => "#{base_url}/#{appcast_filename}", + :rel => "self", :type => "application/rss+xml") - xml = Builder::XmlMarkup.new(:target => appcast, :indent => 2) - - xml.instruct! - xml.rss('xmlns:atom' => "http://www.w3.org/2005/Atom", - 'xmlns:sparkle' => "http://www.andymatuschak.org/xml-namespaces/sparkle", - :version => "2.0") do - xml.channel do - xml.title(app_name) - xml.description("#{app_name} updates") - xml.link(base_url) - xml.language('en') - xml.pubDate Time.now.to_s(:rfc822) - # xml.lastBuildDate(Time.now.rfc822) - xml.atom(:link, :href => "#{base_url}/#{appcast_filename}", - :rel => "self", :type => "application/rss+xml") - - xml.item do - xml.title("#{name} #{version}") - xml.tag! "sparkle:releaseNotesLink", "#{base_url}/#{release_notes}" - xml.pubDate Time.now.to_s(:rfc822) #(File.mtime(pkg)) - xml.guid("#{name}-#{version}", :isPermaLink => "false") - xml.enclosure(:url => "#{base_url}/#{pkg_name}", - :length => "#{File.size(pkg)}", - :type => "application/dmg", - :"sparkle:version" => version, - :"sparkle:dsaSignature" => dsa_signature) + xml.item do + xml.title("#{name} #{version}") + xml.tag! "sparkle:releaseNotesLink", "#{base_url}/#{release_notes}" + xml.pubDate Time.now.to_s(:rfc822) #(File.mtime(pkg)) + xml.guid("#{name}-#{version}", :isPermaLink => "false") + xml.enclosure(:url => "#{base_url}/#{pkg_name}", + :length => "#{File.size(pkg)}", + :type => "application/dmg", + :"sparkle:version" => version, + :"sparkle:dsaSignature" => dsa_signature) + end end end + f << xml_string end end def make_index_redirect File.open("#{build_path}/index.php", 'w') do |f| f << %Q{<?php header("Location: #{pkg_relative_url}"); ?>} end end + + def make_release_notes + File.open("#{build_path}/#{release_notes}", "w") do |f| + template = File.read(release_notes_template) + f << ERB.new(template).result(binding) + end + end + + def release_notes_content + if File.exists?("ReleaseNotes.txt") + File.read("ReleaseNotes.txt") + else + <<-TEXTILE.gsub(/^ /, '') + h1. #{version} #{Date.today} + + h2. Another awesome release! + TEXTILE + end + end + + def release_notes_html + RedCloth.new(release_notes_content).to_html + end def upload_appcast _host = host.blank? ? "" : "#{host}:" - sh %{rsync -aCv appcast/build/ #{_host}#{remote_dir}} + sh %{rsync #{rsync_args} #{build_path}/ #{_host}#{remote_dir}} end # Returns a file path to the dsa_priv.pem file # If private key + public key haven't been generated yet then # generate them @@ -59,9 +82,15 @@ puts "Creating new private and public keys for signing the DMG..." `openssl dsaparam 2048 < /dev/urandom > dsaparam.pem` `openssl gendsa dsaparam.pem -out dsa_priv.pem` `openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem` `rm dsaparam.pem` + puts <<-EOS.gsub(/^ /, '') + + WARNING: DO NOT PUT dsa_priv.pem IN YOUR SOURCE CONTROL + Remember to add it to your ignore list + + EOS end File.expand_path('dsa_priv.pem') end def dsa_signature