Class: Fastlane::Actions::DeleteFilesAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



22
23
24
# File 'lib/fastlane/plugin/delete_files/actions/delete_files_action.rb', line 22

def self.authors
  ["Gary Johnson"]
end

.available_optionsObject



26
27
28
29
30
31
# File 'lib/fastlane/plugin/delete_files/actions/delete_files_action.rb', line 26

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :file_pattern,
                                 description: "Glob file pattern to search for files to delete")
  ]
end

.descriptionObject



18
19
20
# File 'lib/fastlane/plugin/delete_files/actions/delete_files_action.rb', line 18

def self.description
  "Deletes a file, folder or multiple files using shell glob pattern."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/fastlane/plugin/delete_files/actions/delete_files_action.rb', line 33

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/fastlane/plugin/delete_files/actions/delete_files_action.rb', line 7

def self.run(params)
  matching_files = Dir.glob(params[:file_pattern])
  unless matching_files.any? 
    UI.message "No files found matching pattern \"#{params[:file_pattern]}\""
    return
  end

  File.delete(*matching_files)
  UI.message "Deleted files: #{matching_files.join(", ")}"
end