Class: Fastlane::ActHelper::IPAArchive
- Inherits:
-
Object
- Object
- Fastlane::ActHelper::IPAArchive
- Defined in:
- lib/fastlane/plugin/act/helper/ipa_archive.rb
Instance Method Summary collapse
- #clean ⇒ Object
- #contains(path = nil) ⇒ Object
-
#delete(path) ⇒ Object
Delete path inside the ipa.
-
#extract(path) ⇒ Object
Extract files to the temp dir.
-
#initialize(ipa_file, app_name, temp_dir) ⇒ IPAArchive
constructor
A new instance of IPAArchive.
-
#local_path(path) ⇒ Object
Returns the full path to the given file within the temp dir.
-
#replace(path) ⇒ Object
Restore extracted files from the temp dir.
Constructor Details
#initialize(ipa_file, app_name, temp_dir) ⇒ IPAArchive
Returns a new instance of IPAArchive.
4 5 6 7 8 |
# File 'lib/fastlane/plugin/act/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 |
Instance Method Details
#clean ⇒ Object
50 51 52 |
# File 'lib/fastlane/plugin/act/helper/ipa_archive.rb', line 50 def clean `rm -rf #{temp_dir}/*` end |
#contains(path = nil) ⇒ Object
45 46 47 48 |
# File 'lib/fastlane/plugin/act/helper/ipa_archive.rb', line 45 def contains(path = nil) `zipinfo -1 #{@ipa_file} #{@app_path}/#{path}` $?.exitstatus.zero? end |
#delete(path) ⇒ Object
Delete path inside the ipa
38 39 40 41 42 43 |
# File 'lib/fastlane/plugin/act/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) ⇒ Object
Extract files to the temp dir
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fastlane/plugin/act/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) ⇒ Object
Returns the full path to the given file within the temp dir
11 12 13 |
# File 'lib/fastlane/plugin/act/helper/ipa_archive.rb', line 11 def local_path(path) "#{@temp_dir}/#{@app_path}/#{path}" end |
#replace(path) ⇒ Object
Restore extracted files from the temp dir
30 31 32 33 34 35 |
# File 'lib/fastlane/plugin/act/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 |