Class: Fastlane::Actions::ResetSimulatorContentsAction

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

Constant Summary

Constants inherited from Fastlane::Action

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

Class Method Summary collapse

Methods inherited from Fastlane::Action

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

Class Method Details

.aliasesObject



60
61
62
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 60

def self.aliases
  ["reset_simulators"]
end

.authorsObject



72
73
74
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 72

def self.authors
  ["danramteke"]
end

.available_optionsObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 40

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :ios,
                                 deprecated: "Use `:os_versions` instead",
                                 short_option: "-i",
                                 env_name: "FASTLANE_RESET_SIMULATOR_VERSIONS",
                                 description: "Which OS versions of Simulators you want to reset content and settings, this does not remove/recreate the simulators",
                                 is_string: false,
                                 optional: true,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :os_versions,
                                 short_option: "-v",
                                 env_name: "FASTLANE_RESET_SIMULATOR_OS_VERSIONS",
                                 description: "Which OS versions of Simulators you want to reset content and settings, this does not remove/recreate the simulators",
                                 is_string: false,
                                 optional: true,
                                 type: Array)
  ]
end

.categoryObject



87
88
89
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 87

def self.category
  :misc
end

.descriptionObject



36
37
38
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 36

def self.description
  "Shutdown and reset running simulators"
end

.example_codeObject



80
81
82
83
84
85
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 80

def self.example_code
  [
    'reset_simulator_contents',
    'reset_simulator_contents(os_versions: ["10.3.1","12.2"])'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



76
77
78
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 76

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

.outputObject



64
65
66
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 64

def self.output
  nil
end

.reset_allObject



30
31
32
33
34
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 30

def self.reset_all
  FastlaneCore::Simulator.reset_all
  FastlaneCore::SimulatorTV.reset_all
  FastlaneCore::SimulatorWatch.reset_all
end

.reset_all_by_version(os_version) ⇒ Object



24
25
26
27
28
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 24

def self.reset_all_by_version(os_version)
  FastlaneCore::Simulator.reset_all_by_version(os_version: os_version)
  FastlaneCore::SimulatorTV.reset_all_by_version(os_version: os_version)
  FastlaneCore::SimulatorWatch.reset_all_by_version(os_version: os_version)
end

.reset_simulators(os_versions) ⇒ Object



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

def self.reset_simulators(os_versions)
  UI.verbose("Resetting simulator contents")

  if os_versions
    os_versions.each do |os_version|
      reset_all_by_version(os_version)
    end
  else
    reset_all
  end

  UI.success('Simulators reset done')
end

.return_valueObject



68
69
70
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 68

def self.return_value
  nil
end

.run(params) ⇒ Object



4
5
6
7
8
# File 'fastlane/lib/fastlane/actions/reset_simulator_contents.rb', line 4

def self.run(params)
  os_versions = params[:os_versions] || params[:ios]

  reset_simulators(os_versions)
end