class Fastlane::Helper::IPAArchive

Public Class Methods

new(ipa_file, app_name, temp_dir) click to toggle source
# File lib/fastlane/plugin/facelift/helper/ipa_archive.rb, line 4
def initialize(ipa_file, app_name, temp_dir)
  @ipa_file = ipa_file
  @app_path = "Payload/#{app_name}"
  @temp_dir = temp_dir
end

Public Instance Methods

clean() click to toggle source
# File lib/fastlane/plugin/facelift/helper/ipa_archive.rb, line 50
def clean
  `rm -rf #{temp_dir}/*`
end
contains(path = nil) click to toggle source
# File lib/fastlane/plugin/facelift/helper/ipa_archive.rb, line 45
def contains(path = nil)
  `zipinfo -1 #{@ipa_file} #{@app_path}/#{path}`
  $?.exitstatus.zero?
end
delete(path) click to toggle source

Delete path inside the ipa

# File lib/fastlane/plugin/facelift/helper/ipa_archive.rb, line 38
def delete(path)
  UI.verbose("Deleting #{@app_path}/#{path}")
  Dir.chdir(@temp_dir) do
    `zip -dq #{@ipa_file} #{@app_path}/#{path}`
  end
end
extract(path) click to toggle source

Extract files to the temp dir

# File lib/fastlane/plugin/facelift/helper/ipa_archive.rb, line 16
def extract(path)
  UI.verbose("Extracting #{@app_path}/#{path}")

  Dir.chdir(@temp_dir) do
    result = `unzip -o -q #{@ipa_file} #{@app_path}/#{path}`

    if $?.exitstatus.nonzero?
      UI.important result
      raise "extract operation failed with exit code #{$?.exitstatus}"
    end
  end
end
local_path(path) click to toggle source

Returns the full path to the given file within the temp dir

# File lib/fastlane/plugin/facelift/helper/ipa_archive.rb, line 11
def local_path(path)
  "#{@temp_dir}/#{@app_path}/#{path}"
end
replace(path) click to toggle source

Restore extracted files from the temp dir

# File lib/fastlane/plugin/facelift/helper/ipa_archive.rb, line 30
def replace(path)
  UI.verbose("Replacing #{@app_path}/#{path}")
  Dir.chdir(@temp_dir) do
    `zip -q #{@ipa_file} #{@app_path}/#{path}`
  end
end