Class: Fastlane::RearchiveHelper::XCArchive

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/rearchive/helper/archives/xc_archive.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(archive_path) ⇒ XCArchive

Returns a new instance of XCArchive.



7
8
9
10
# File 'lib/fastlane/plugin/rearchive/helper/archives/xc_archive.rb', line 7

def initialize(archive_path)
  @archive_path = archive_path
  @app_path = "Products/#{self.class.extract_app_path(archive_path)}"
end

Class Method Details

.extract_app_path(archive_path) ⇒ Object



42
43
44
45
# File 'lib/fastlane/plugin/rearchive/helper/archives/xc_archive.rb', line 42

def self.extract_app_path(archive_path)
  plist_buddy = PlistBuddy.new("#{archive_path}/Info.plist")
  plist_buddy.exec("Print :ApplicationProperties:ApplicationPath")
end

Instance Method Details

#app_path(path) ⇒ Object

Returns an archive-relative path to the given application file



18
19
20
21
22
23
24
# File 'lib/fastlane/plugin/rearchive/helper/archives/xc_archive.rb', line 18

def app_path(path)
  if path.start_with?("/")
    path.sub(%r{^/}, "")
  else
    "#{@app_path}/#{path}"
  end
end

#delete(path) ⇒ Object

Delete path inside the ipa



36
37
38
39
40
# File 'lib/fastlane/plugin/rearchive/helper/archives/xc_archive.rb', line 36

def delete(path)
  FastlaneCore::UI.verbose("Deleting #{path}")

  Dir.glob(local_path(path)).each { |f| File.delete(f) }
end

#extract(path) ⇒ Object

Extract files to the temp dir



27
28
29
# File 'lib/fastlane/plugin/rearchive/helper/archives/xc_archive.rb', line 27

def extract(path)
  path
end

#local_path(path) ⇒ Object

Returns the full path to the given file that can be modified



13
14
15
# File 'lib/fastlane/plugin/rearchive/helper/archives/xc_archive.rb', line 13

def local_path(path)
  "#{@archive_path}/#{path}"
end

#replace(path) ⇒ Object

Restore extracted files from the temp dir



32
33
# File 'lib/fastlane/plugin/rearchive/helper/archives/xc_archive.rb', line 32

def replace(path)
end