Class: Antenna::Distributor
- Inherits:
-
Object
- Object
- Antenna::Distributor
- Defined in:
- lib/antenna/distributor.rb
Defined Under Namespace
Instance Method Summary collapse
- #distribute(ipa_file, options = {}) ⇒ Object
-
#initialize(distributor) ⇒ Distributor
constructor
A new instance of Distributor.
Constructor Details
#initialize(distributor) ⇒ Distributor
Returns a new instance of Distributor.
7 8 9 |
# File 'lib/antenna/distributor.rb', line 7 def initialize(distributor) @distributor = distributor end |
Instance Method Details
#distribute(ipa_file, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/antenna/distributor.rb', line 11 def distribute(ipa_file, = {}) base_filename = [:base] || File.basename(ipa_file, ".ipa") # Let distributor set things up (if necessary) @distributor.setup(ipa_file, ) if @distributor.respond_to?(:setup) # Distribute IPA ipa = process_ipa(ipa_file) ipa_url = @distributor.distribute( ipa.input_stream.read, "#{base_filename}.ipa", "application/octet-stream", ) # Distribute App Icon if app_icon = process_app_icon(ipa) app_icon_url = @distributor.distribute( app_icon, "#{base_filename}.png", "image/png", ) end # Distribute Manifest manifest = build_manifest(ipa, ipa_url, app_icon_url) manifest_url = @distributor.distribute( manifest.to_s, "#{base_filename}.plist", "text/xml", ) # Distribute HTML html = build_html(ipa, manifest_url, app_icon_url) html_url = @distributor.distribute( html.to_s, "#{base_filename}.html", "text/html", ) # Let distributor clean things up (if necessary) @distributor.teardown if @distributor.respond_to?(:teardown) return html_url end |