Add status messages to updater script
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
28b36dda66
commit
c9a5bf26f9
1 changed files with 10 additions and 0 deletions
|
@ -12,6 +12,7 @@ feed = ARGV[0] || 'mercury'
|
||||||
site_dir = "#{Dir.home}/Source/Repos/kode54-net/cog"
|
site_dir = "#{Dir.home}/Source/Repos/kode54-net/cog"
|
||||||
|
|
||||||
appcast = open("#{site_dir}/#{feed}_builds/#{feed}.xml")
|
appcast = open("#{site_dir}/#{feed}_builds/#{feed}.xml")
|
||||||
|
puts "Reading feed..."
|
||||||
|
|
||||||
appcastdoc = Nokogiri::XML(appcast)
|
appcastdoc = Nokogiri::XML(appcast)
|
||||||
|
|
||||||
|
@ -82,6 +83,7 @@ if 1 #appcast_revision < latest_revision
|
||||||
filenamedesc = "Cog-#{revision_code}.html"
|
filenamedesc = "Cog-#{revision_code}.html"
|
||||||
deltamask = "Cog#{revision_number}-"
|
deltamask = "Cog#{revision_number}-"
|
||||||
temp_path = "/tmp";
|
temp_path = "/tmp";
|
||||||
|
puts "Generating zip file for Cog..."
|
||||||
%x[rm -rf '#{temp_path}/Cog.app' '#{temp_path}/Cog.zip']
|
%x[rm -rf '#{temp_path}/Cog.app' '#{temp_path}/Cog.zip']
|
||||||
|
|
||||||
#Copy the replacement build
|
#Copy the replacement build
|
||||||
|
@ -105,31 +107,39 @@ if 1 #appcast_revision < latest_revision
|
||||||
%x[rm '#{descriptiondoc.path}']
|
%x[rm '#{descriptiondoc.path}']
|
||||||
|
|
||||||
#Update appcast
|
#Update appcast
|
||||||
|
puts "Generating appcast..."
|
||||||
%x[generate_appcast '#{site_dir}/#{feed}_builds']
|
%x[generate_appcast '#{site_dir}/#{feed}_builds']
|
||||||
|
|
||||||
#List out the deltas
|
#List out the deltas
|
||||||
deltas = Dir.entries("#{site_dir}/#{feed}_builds").select { |f| f =~ /\A#{Regexp.escape(deltamask)}.+\.delta\z/ }
|
deltas = Dir.entries("#{site_dir}/#{feed}_builds").select { |f| f =~ /\A#{Regexp.escape(deltamask)}.+\.delta\z/ }
|
||||||
|
|
||||||
#Upload them to R2
|
#Upload them to R2
|
||||||
|
puts "Uploading full build to R2..."
|
||||||
%x[rclone copy '#{site_dir}/#{feed}_builds/#{filename}' r2:cog/ --progress]
|
%x[rclone copy '#{site_dir}/#{feed}_builds/#{filename}' r2:cog/ --progress]
|
||||||
deltas.each do |f|
|
deltas.each do |f|
|
||||||
|
puts "Uploading delta #{f} to R2..."
|
||||||
%x[rclone copy '#{site_dir}/#{feed}_builds/#{f}' r2:cog/ --progress]
|
%x[rclone copy '#{site_dir}/#{feed}_builds/#{f}' r2:cog/ --progress]
|
||||||
end
|
end
|
||||||
|
|
||||||
#Upload the changelog that Sparkle will display
|
#Upload the changelog that Sparkle will display
|
||||||
|
puts "Uploading changelog to R2..."
|
||||||
%x[rclone copy '#{site_dir}/#{feed}_builds/#{filenamedesc}' r2:cog/ --progress]
|
%x[rclone copy '#{site_dir}/#{feed}_builds/#{filenamedesc}' r2:cog/ --progress]
|
||||||
|
|
||||||
#Clean up
|
#Clean up
|
||||||
%x[rm -rf '#{temp_path}/Cog.app']
|
%x[rm -rf '#{temp_path}/Cog.app']
|
||||||
|
|
||||||
#Convert to JSON
|
#Convert to JSON
|
||||||
|
puts "Converting to JSON..."
|
||||||
%x[pushd '#{site_dir}/#{feed}_builds' && '#{__dir__}/sparkleToJSON' '#{site_dir}/#{feed}_builds/#{feed}.xml' && popd]
|
%x[pushd '#{site_dir}/#{feed}_builds' && '#{__dir__}/sparkleToJSON' '#{site_dir}/#{feed}_builds/#{feed}.xml' && popd]
|
||||||
|
|
||||||
#Upload to R2
|
#Upload to R2
|
||||||
|
puts "Uploading XML feed to R2..."
|
||||||
%x[rclone copy '#{site_dir}/#{feed}_builds/#{feed}.xml' r2:cog/ --progress]
|
%x[rclone copy '#{site_dir}/#{feed}_builds/#{feed}.xml' r2:cog/ --progress]
|
||||||
|
puts "Uploading JSON feed to R2..."
|
||||||
%x[rclone copy '#{site_dir}/#{feed}_builds/#{feed}.json' r2:cog/ --progress]
|
%x[rclone copy '#{site_dir}/#{feed}_builds/#{feed}.json' r2:cog/ --progress]
|
||||||
|
|
||||||
#Send web hook to update site
|
#Send web hook to update site
|
||||||
|
puts "Sending web hook to update site..."
|
||||||
update_uri = %x[security find-generic-password -w -a #{ENV['LOGNAME']} -s cogupdateurl].chop
|
update_uri = %x[security find-generic-password -w -a #{ENV['LOGNAME']} -s cogupdateurl].chop
|
||||||
update_parameter = URI.escape(latest_revision)
|
update_parameter = URI.escape(latest_revision)
|
||||||
%x[curl -X POST '#{update_uri}?trigger_title=#{update_parameter}']
|
%x[curl -X POST '#{update_uri}?trigger_title=#{update_parameter}']
|
||||||
|
|
Loading…
Reference in a new issue