class BlastOff::Template

Public Class Methods

new(ipa_file) click to toggle source
# File lib/blast_off/template.rb, line 6
def initialize(ipa_file)
  @ipa = ipa_file
end

Public Instance Methods

html(manifest_plist_url) click to toggle source
# File lib/blast_off/template.rb, line 29
def html(manifest_plist_url)
  opts = OpenStruct.new({
    ipa: @ipa,
    install_url: URI.escape(
      "itms-services://?action=download-manifest&url=#{manifest_plist_url}"
    )
  })
  template_file = File.join(File.dirname(File.expand_path(__FILE__)), 'template/index.html.erb')

  ::ERB.new(File.read(template_file)).result(opts.instance_eval {binding})
end
manifest_plist(ipa_file_url) click to toggle source
# File lib/blast_off/template.rb, line 10
def manifest_plist(ipa_file_url)
  {
    items: [
      assets: [
        {
          kind: 'software-package',
          url: ipa_file_url
        }
      ],
      metadata: {
        'bundle-identifier' => @ipa.bundle_identifier,
        'bundle-version' => @ipa.version,
        kind: 'software',
        title: @ipa.name
      }
    ]
  }.to_plist(plist_format: CFPropertyList::List::FORMAT_XML)
end