Class: Fastlane::Actions::ResetsimsAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



21
22
23
# File 'lib/fastlane/plugin/resetsims/actions/resetsims_action.rb', line 21

def self.authors
  ["Luís Esteves"]
end

.available_optionsObject



34
35
36
37
38
39
40
41
# File 'lib/fastlane/plugin/resetsims/actions/resetsims_action.rb', line 34

def self.available_options
  [
      FastlaneCore::ConfigItem.new(key: :devices_regexp,
                                   description: "regexp indicating the target devices",
                                   optional: true,
                                   default_value: "")
  ]
end

.descriptionObject



17
18
19
# File 'lib/fastlane/plugin/resetsims/actions/resetsims_action.rb', line 17

def self.description
  "Makes an reset on xcode simulators"
end

.detailsObject



29
30
31
32
# File 'lib/fastlane/plugin/resetsims/actions/resetsims_action.rb', line 29

def self.details
  # Optional:
  "Makes an reset on xcode simulators"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/fastlane/plugin/resetsims/actions/resetsims_action.rb', line 43

def self.is_supported?(platform)
  platform == :ios
end

.return_valueObject



25
26
27
# File 'lib/fastlane/plugin/resetsims/actions/resetsims_action.rb', line 25

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fastlane/plugin/resetsims/actions/resetsims_action.rb', line 4

def self.run(options)
  if options[:devices_regexp].empty?
    device_list_grep = ""
  else
    device_list_grep = " | grep '#{options[:devices_regexp]}'"
  end  

  Actions.sh "instruments -s devices #{device_list_grep} | grep \"(\\d*.\\d)\\|(\\d*.\\d.\\d)\" | grep -o \"[0-9A-F]\\{8\\}-[0-9A-F]\\{4\\}-[0-9A-F]\\{4\\}-[0-9A-F]\\{4\\}-[0-9A-F]\\{12\\}\" | while read -r line ; do
      echo \"Resetting Simulator with UDID: $line\"
      xcrun simctl erase $line
      done"
end