Skip to content

Instantly share code, notes, and snippets.

@adamvduke
Created December 12, 2013 20:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamvduke/7934457 to your computer and use it in GitHub Desktop.
Save adamvduke/7934457 to your computer and use it in GitHub Desktop.
A minimal ruby script to generate a manifest.json for Safari push notification push packages.
require 'digest'
require 'json'
REQUIRED_ICONSET_FILES = ["icon_16x16.png", "icon_16x16@2x.png", "icon_32x32.png", "icon_32x32@2x.png", "icon_128x128.png", "icon_128x128@2x.png" ]
manifest_keys = REQUIRED_ICONSET_FILES.map{|f| 'icon.iconset/' + f }
manifest_keys << 'website.json'
manifest_values = manifest_keys.map {|file| Digest::SHA1.file(file).hexdigest }
manifest_data = Hash[manifest_keys.zip(manifest_values)].to_json
File.open('manifest.json', 'w+') do |manifest|
manifest.write(manifest_data)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment