Class: Fastlane::Actions::RemoveFileAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/rearchive/actions/remove_file_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



29
30
31
# File 'lib/fastlane/plugin/rearchive/actions/remove_file_action.rb', line 29

def self.authors
  ["naoigcat"]
end

.available_optionsObject



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fastlane/plugin/rearchive/actions/remove_file_action.rb', line 33

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :archive_path,
                         description: "The path of the .ipa or .xcarchive to be modified",
                            optional: false,
                                type: String),

    FastlaneCore::ConfigItem.new(key: :files,
                         description: "Files that should be removed",
                            optional: false,
                                type: Array)
  ]
end

.descriptionObject



25
26
27
# File 'lib/fastlane/plugin/rearchive/actions/remove_file_action.rb', line 25

def self.description
  "Remove files inside .ipa/.xcarchive"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/fastlane/plugin/rearchive/actions/remove_file_action.rb', line 47

def self.is_supported?(platform)
  [:ios].include?(platform)
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/rearchive/actions/remove_file_action.rb', line 9

def self.run(params)
  archive_path = File.expand_path(params[:archive_path])
  raise "Archive path #{archive_path} does not exist" unless File.exist?(archive_path)

  if File.directory?(archive_path)
    archive = RearchiveHelper::XCArchive.new(archive_path)
  else
    archive = RearchiveHelper::IPAArchive.new(archive_path)
  end
  params[:files].each do |file|
    FastlaneCore::UI.message("Deleting #{file}")
    relative_path = archive.app_path(file)
    archive.delete(relative_path)
  end
end