Class: Fastlane::Actions::ClearDerivedDataAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/clear_derived_data.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject


50
51
52
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 50

def self.authors
  ["KrauseFx"]
end

.available_optionsObject


35
36
37
38
39
40
41
42
43
44
45
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 35

def self.available_options
  path = xcode_preferences ? xcode_preferences['IDECustomDerivedDataLocation'] : nil
  path ||= "~/Library/Developer/Xcode/DerivedData"
  [
    FastlaneCore::ConfigItem.new(key: :derived_data_path,
                                 env_name: "DERIVED_DATA_PATH",
                                 description: "Custom path for derivedData",
                                 default_value_dynamic: true,
                                 default_value: path)
  ]
end

.categoryObject


65
66
67
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 65

def self.category
  :building
end

.descriptionObject


27
28
29
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 27

def self.description
  "Deletes the Xcode Derived Data"
end

.detailsObject


31
32
33
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 31

def self.details
  "Deletes the Derived Data from path set on Xcode or a supplied path"
end

.example_codeObject


58
59
60
61
62
63
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 58

def self.example_code
  [
    'clear_derived_data',
    'clear_derived_data(derived_data_path: "/custom/")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:


54
55
56
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 54

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

.outputObject


47
48
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 47

def self.output
end

.run(options) ⇒ Object


6
7
8
9
10
11
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 6

def self.run(options)
  path = File.expand_path(options[:derived_data_path])
  UI.message("Derived Data path located at: #{path}")
  FileUtils.rm_rf(path) if File.directory?(path)
  UI.success("Successfully cleared Derived Data ♻️")
end

.xcode_preferencesObject

Helper Methods


14
15
16
17
18
19
20
21
# File 'fastlane/lib/fastlane/actions/clear_derived_data.rb', line 14

def self.xcode_preferences
  file = File.expand_path("~/Library/Preferences/com.apple.dt.Xcode.plist")
  if File.exist?(file)
    plist = CFPropertyList::List.new(file: file).value
    return CFPropertyList.native_types(plist) unless plist.nil?
  end
  return nil
end