Class: Fastlane::ActHelper::FilePatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/act/helper/file_patcher.rb

Class Method Summary collapse

Class Method Details

.remove(archive, file_values) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/act/helper/file_patcher.rb', line 17

def self.remove(archive, file_values)
  file_values.each do |file_to_delete|
    UI.message("Deleting #{file_to_delete}")

    relative_path = ActHelper::ArchivePaths.expand(archive, file_to_delete)

    archive.delete relative_path
  end
end

.replace(archive, file_values) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fastlane/plugin/act/helper/file_patcher.rb', line 4

def self.replace(archive, file_values)
  file_values.each do |old_file, new_file|
    UI.message("Replacing #{old_file}")

    relative_path = ActHelper::ArchivePaths.expand(archive, old_file)
    local_path = archive.local_path(relative_path)

    `mkdir -p #{File.dirname(local_path).shellescape}`
    `cp #{new_file.shellescape} #{local_path.shellescape}`
    archive.replace(relative_path)
  end
end