Class: Pilot::PackageBuilder
- Inherits:
-
Object
- Object
- Pilot::PackageBuilder
- Defined in:
- lib/pilot/package_builder.rb
Constant Summary collapse
- METADATA_FILE_NAME =
"metadata.xml"
Instance Attribute Summary collapse
-
#package_path ⇒ Object
Returns the value of attribute package_path.
Instance Method Summary collapse
Instance Attribute Details
#package_path ⇒ Object
Returns the value of attribute package_path.
7 8 9 |
# File 'lib/pilot/package_builder.rb', line 7 def package_path @package_path end |
Instance Method Details
#generate(apple_id: nil, ipa_path: nil, package_path: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pilot/package_builder.rb', line 9 def generate(apple_id: nil, ipa_path: nil, package_path: nil) self.package_path = File.join(package_path, "#{apple_id}.itmsp") FileUtils.rm_rf self.package_path if File.directory?(self.package_path) FileUtils.mkdir_p self.package_path lib_path = Helper.gem_path("pilot") ipa_path = copy_ipa(ipa_path) @data = { apple_id: apple_id, file_size: File.size(ipa_path), ipa_path: File.basename(ipa_path), # this is only the base name as the ipa is inside the package md5: Digest::MD5.hexdigest(File.read(ipa_path)) } xml_path = File.join(lib_path, "lib/assets/XMLTemplate.xml.erb") xml = ERB.new(File.read(xml_path)).result(binding) # http://www.rrn.dk/rubys-erb-templating-system File.write(File.join(self.package_path, METADATA_FILE_NAME), xml) Helper.log.info "Wrote XML data to '#{self.package_path}'".green if $verbose return package_path end |