diff --git a/Scripts/update_feed.rb b/Scripts/update_feed.rb index b84ea47f8..db6e9c6e1 100755 --- a/Scripts/update_feed.rb +++ b/Scripts/update_feed.rb @@ -12,7 +12,8 @@ appcast = open("https://kode54.net/cog/#{feed}.xml") appcastdoc = Document.new(appcast) #Get the latest revision from the appcast -appcast_revision = REXML::XPath.match(appcastdoc, "//channel/item/enclosure/sparkle:version", {"sparkle" => 'http://www.andymatuschak.org/xml-namespaces/sparkle'}).to_s() || 0 +appcast_enclosure = REXML::XPath.match(appcastdoc, "//channel/item/enclosure")[0] +appcast_revision = appcast_enclosure.attributes['sparkle:version']; appcast_revision_split = appcast_revision.split( /-/ ) appcast_revision_code = appcast_revision_split[2] @@ -27,54 +28,40 @@ revision_code = revision_split[2] if appcast_revision < latest_revision #Get the changelog - if appcast_revision_code - changelog = %x[hg log --template '{desc}\n' -r #{revision_code}:children\\(#{appcast_revision_code}\\)] + changelog = %x[hg log --template '{desc}\n' -r #{revision_code}:children(#{appcast_revision_code})] - description = '' - ignore_next = false - changelog.each_line do |line| - if (ignore_next) - ignore_next = false - next - end - if Regexp.new('^-+$').match(line) - ignore_next = true - next - elsif Regexp.new('^\s*$').match(line) - next - end - description += line + description = '' + ignore_next = false + changelog.each_line do |line| + if (ignore_next) + ignore_next = false + next end - else - description = '' - end + if Regexp.new('^-+$').match(line) + ignore_next = true + next + elsif Regexp.new('^\s*$').match(line) + next + end + description += line +end - #Remove the previous build directories - %x[find . -type d -name build -print0 | xargs -0 rm -r ] - - #Build Cog! - %x[xcodebuild -alltargets -configuration Release 2>&1].each_line do |line| - if line.match(/\*\* BUILD FAILED \*\*/) - exit - end - end - filename = "Cog-#{revision_code}.tbz" #Zip the app! - %x[rm -f build/Release/#{feed}.tar.bz2] - %x[tar -C build/Release -cjf build/Release/#{feed}.tar.bz2 Cog.app] + %x[rm -f ~/Documents/#{feed}.tar.bz2] + %x[tar -C ~/Documents -cjf #{feed}.tar.bz2 Cog.app] - filesize = File.size("build/Release/#{feed}.tar.bz2") + filesize = File.size("~/Documents/#{feed}.tar.bz2") #Send the new build to the server - %x[scp build/Release/#{feed}.tar.bz2 ec2-user@kode54.net:/usr/share/nginx/html/cog/#{feed}_builds/#{filename}] + %x[scp ~/Documents/#{feed}.tar.bz2 ec2-user@kode54.net:/usr/share/nginx/html/cog/#{feed}_builds/#{filename}] #Add new entry to appcast new_item = Element.new('item') new_item.add_element('title') - new_item.elements['title'].text = "Cog {latest_revision}" + new_item.elements['title'].text = "Version 0.08 ({latest_revision})" new_item.add_element('description') new_item.elements['description'].text = description @@ -86,7 +73,7 @@ if appcast_revision < latest_revision new_item.elements['sparkle:minimumSystemVersion'].text = '10.7.0' new_item.add_element('enclosure') - new_item.elements['enclosure'].add_attribute('url', "http://kode54.net/cog/#{feed}_builds/#{filename}") + new_item.elements['enclosure'].add_attribute('url', "https://kode54.net/cog/#{feed}_builds/#{filename}") new_item.elements['enclosure'].add_attribute('length', filesize) new_item.elements['enclosure'].add_attribute('type', 'application/octet-stream') new_item.elements['enclosure'].add_attribute('sparkle:version', "{latest_revision}")