fastlane_core 0.41.3 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3501dde8a99eaa2d37c5f5052a5835ff93a09384
4
- data.tar.gz: 9802e017e03259a343f54976ff928b936bdb482c
3
+ metadata.gz: 8756fcc16ab3e05e3429c167bfeec9f527ac2b7f
4
+ data.tar.gz: 363bab72d387aaf4555fdc69a518df68e0507e94
5
5
  SHA512:
6
- metadata.gz: 3da7e12d5a745ad709035348a8b2dd1d5b9d1b8e2b1bb76634283f891bd1f12a042a28ec0d75aaa6ec8126eca4e4a565b93a370fb2ee01bf9d98c72f46c42159
7
- data.tar.gz: b7b51581a819640271b43f15599ebb7121c7b10de4d1f8ffd13b8bffb2f5e2207d5eb7adaa365a2a69be72dc9d1497e60c523b41fbcaa287e37e3aa956b07412
6
+ metadata.gz: 7a0179679220b305704d16ad21169c4a7a974f078dc300b86e33fb1ea789caf66945116afb96603f19cefce864f484a4213195d8587228f1df1f8cd740a7afd2
7
+ data.tar.gz: 071d8d281c09e36ff9ba9135189485589b50357bae94125270d12a342c3106114ea53007b8c02a5314dec7e12e81fcdceba784ed50c9f0c56fce1968a0d7ad88
@@ -16,7 +16,7 @@ require 'fastlane_core/command_executor'
16
16
  require 'fastlane_core/ipa_upload_package_builder'
17
17
  require 'fastlane_core/print_table'
18
18
  require 'fastlane_core/project'
19
- require 'fastlane_core/simulator'
19
+ require 'fastlane_core/device_manager'
20
20
  require 'fastlane_core/crash_reporting/crash_reporting'
21
21
  require 'fastlane_core/ui/ui'
22
22
 
@@ -14,7 +14,8 @@ module FastlaneCore
14
14
  next if option.description.to_s.empty? # "private" options
15
15
 
16
16
  short_switch = option.short_option
17
- validate_short_switch(used_switches, short_switch)
17
+ key = option.key
18
+ validate_short_switch(used_switches, short_switch, key)
18
19
 
19
20
  type = option.data_type
20
21
 
@@ -55,7 +56,7 @@ module FastlaneCore
55
56
  # Passing a nil value to global_option has been shown to create problems with
56
57
  # option parsing!
57
58
  #
58
- # See: https://github.com/fastlane/fastlane/tree/master/fastlane_core
59
+ # See: https://github.com/fastlane/fastlane_core/pull/89
59
60
  #
60
61
  # If we don't have a data type for this option, we tell it to act like a String.
61
62
  # This allows us to get a reasonable value for boolean options that can be
@@ -67,13 +68,13 @@ module FastlaneCore
67
68
  end
68
69
  end
69
70
 
70
- def validate_short_switch(used_switches, short_switch)
71
+ def validate_short_switch(used_switches, short_switch, key)
71
72
  return if short_switch.nil?
72
73
 
73
- UI.user_error!("Short option #{short_switch} already taken for key #{option.key}") if used_switches.include?(short_switch)
74
- UI.user_error!("-v is already used for the version (key #{option.key})") if short_switch == "-v"
75
- UI.user_error!("-h is already used for the help screen (key #{option.key})") if short_switch == "-h"
76
- UI.user_error!("-t is already used for the trace screen (key #{option.key})") if short_switch == "-t"
74
+ UI.user_error!("Short option #{short_switch} already taken for key #{key}") if used_switches.include?(short_switch)
75
+ UI.user_error!("-v is already used for the version (key #{key})") if short_switch == "-v"
76
+ UI.user_error!("-h is already used for the help screen (key #{key})") if short_switch == "-h"
77
+ UI.user_error!("-t is already used for the trace screen (key #{key})") if short_switch == "-t"
77
78
 
78
79
  used_switches << short_switch
79
80
  end
@@ -28,10 +28,6 @@ module FastlaneCore
28
28
  UI.user_error!("Do not let descriptions end with a '.', since it's used for user inputs as well") if description[-1] == '.'
29
29
  end
30
30
 
31
- if type.to_s.length > 0 and short_option.to_s.length == 0
32
- UI.user_error!("Type '#{type}' for key '#{key}' requires a short option")
33
- end
34
-
35
31
  if conflicting_options
36
32
  conflicting_options.each do |conflicting_option_key|
37
33
  UI.user_error!("Conflicting option key must be a symbol") unless conflicting_option_key.kind_of? Symbol
@@ -1,14 +1,15 @@
1
1
  require 'open3'
2
+ require 'plist'
2
3
 
3
4
  module FastlaneCore
4
- class Simulator
5
+ class DeviceManager
5
6
  class << self
6
- def requested_os_type
7
- 'iOS'
7
+ def all(requested_os_type = "")
8
+ return connected_devices(requested_os_type) + simulators(requested_os_type)
8
9
  end
9
10
 
10
- def all
11
- UI.message("Fetching available devices") if $verbose
11
+ def simulators(requested_os_type = "")
12
+ UI.message("Fetching available simulator devices") if $verbose
12
13
 
13
14
  @devices = []
14
15
  os_type = 'unknown'
@@ -31,8 +32,8 @@ module FastlaneCore
31
32
  # iPad 2 (0EDE6AFC-3767-425A-9658-AAA30A60F212) (Shutdown)
32
33
  # iPad Air 2 (4F3B8059-03FD-4D72-99C0-6E9BBEE2A9CE) (Shutdown) (unavailable, device type profile not found)
33
34
  match = line.match(/\s+([^\(]+) \(([-0-9A-F]+)\) \(([^\(]+)\)(.*unavailable.*)?/)
34
- if match && !match[4] && os_type == requested_os_type
35
- @devices << Device.new(name: match[1], os_version: os_version, udid: match[2], state: match[3])
35
+ if match && !match[4] && (os_type == requested_os_type || requested_os_type == "")
36
+ @devices << Device.new(name: match[1], os_version: os_version, udid: match[2], state: match[3], is_simulator: true)
36
37
  end
37
38
  end
38
39
  end
@@ -40,20 +41,56 @@ module FastlaneCore
40
41
  return @devices
41
42
  end
42
43
 
43
- def clear_cache
44
- @devices = nil
45
- end
44
+ def connected_devices(requested_os_type)
45
+ Helper.log.info "Fetching available connected devices" if $verbose
46
46
 
47
- # Reset all simulators of this type
48
- def reset_all
49
- all.each(&:reset)
50
- end
47
+ device_types = if requested_os_type == "tvOS"
48
+ ["AppleTV"]
49
+ elsif requested_os_type == "iOS"
50
+ ["iPhone", "iPad", "iPod"]
51
+ else
52
+ []
53
+ end
51
54
 
52
- # Reset simulator by UDID or name and OS version
53
- # Latter is useful when combined with -destination option of xcodebuild
54
- def reset(udid: nil, name: nil, os_version: nil)
55
- match = all.detect { |device| device.udid == udid || device.name == name && device.os_version == os_version }
56
- match.reset if match
55
+ devices = [] # Return early if no supported devices are being searched for
56
+ if device_types.count == 0
57
+ return devices
58
+ end
59
+
60
+ usb_devices_output = ''
61
+ Open3.popen3("system_profiler SPUSBDataType -xml") do |stdin, stdout, stderr, wait_thr|
62
+ usb_devices_output = stdout.read
63
+ end
64
+
65
+ device_uuids = []
66
+ result = Plist.parse_xml(usb_devices_output)
67
+ result[0]['_items'].each do |host_controller| # loop just incase the host system has more then 1 controller
68
+ host_controller['_items'].each do |usb_device|
69
+ is_supported_device = device_types.any? { |device_type| usb_device['_name'] == device_type }
70
+ if is_supported_device && usb_device['serial_num'].length == 40
71
+ device_uuids.push(usb_device['serial_num'])
72
+ end
73
+ end
74
+ end
75
+
76
+ if device_uuids.count > 0 # instruments takes a little while to return so skip it if we have no devices
77
+ instruments_devices_output = ''
78
+ Open3.popen3("instruments -s devices") do |stdin, stdout, stderr, wait_thr|
79
+ instruments_devices_output = stdout.read
80
+ end
81
+
82
+ instruments_devices_output.split(/\n/).each do |instruments_device|
83
+ device_uuids.each do |device_uuid|
84
+ match = instruments_device.match(/(.+) \(([0-9.]+)\) \[([0-9a-f]+)\]?/)
85
+ if match && match[3] == device_uuid
86
+ devices << Device.new(name: match[1], udid: match[3], os_version: match[2], state: "Booted", is_simulator: false)
87
+ Helper.log.info "USB Device Found - \"" + match[1] + "\" (" + match[2] + ") UUID:" + match[3] if $verbose
88
+ end
89
+ end
90
+ end
91
+ end
92
+
93
+ return devices
57
94
  end
58
95
 
59
96
  # The code below works from Xcode 7 on
@@ -104,13 +141,15 @@ module FastlaneCore
104
141
  attr_accessor :os_version
105
142
  attr_accessor :ios_version # Preserved for backwards compatibility
106
143
  attr_accessor :state
144
+ attr_accessor :is_simulator
107
145
 
108
- def initialize(name: nil, udid: nil, os_version: nil, state: nil)
146
+ def initialize(name: nil, udid: nil, os_version: nil, state: nil, is_simulator: nil)
109
147
  self.name = name
110
148
  self.udid = udid
111
149
  self.os_version = os_version
112
150
  self.ios_version = os_version
113
151
  self.state = state
152
+ self.is_simulator = is_simulator
114
153
  end
115
154
 
116
155
  def to_s
@@ -126,18 +165,42 @@ module FastlaneCore
126
165
  end
127
166
  end
128
167
 
168
+ class Simulator
169
+ class << self
170
+ def all
171
+ return DeviceManager.simulators('iOS')
172
+ end
173
+
174
+ # Reset all simulators of this type
175
+ def reset_all
176
+ all.each(&:reset)
177
+ end
178
+
179
+ # Reset simulator by UDID or name and OS version
180
+ # Latter is useful when combined with -destination option of xcodebuild
181
+ def reset(udid: nil, name: nil, os_version: nil)
182
+ match = all.detect { |device| device.udid == udid || device.name == name && device.os_version == os_version }
183
+ match.reset if match
184
+ end
185
+
186
+ def clear_cache
187
+ @devices = nil
188
+ end
189
+ end
190
+ end
191
+
129
192
  class SimulatorTV < Simulator
130
193
  class << self
131
- def requested_os_type
132
- 'tvOS'
194
+ def all
195
+ return DeviceManager.simulators('tvOS')
133
196
  end
134
197
  end
135
198
  end
136
199
 
137
200
  class SimulatorWatch < Simulator
138
201
  class << self
139
- def requested_os_type
140
- 'watchOS'
202
+ def all
203
+ return DeviceManager.simulators('watchOS')
141
204
  end
142
205
  end
143
206
  end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.41.3".freeze
2
+ VERSION = "0.42.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.3
4
+ version: 0.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -357,6 +357,7 @@ files:
357
357
  - lib/fastlane_core/configuration/configuration_file.rb
358
358
  - lib/fastlane_core/crash_reporting/clean_stack_trace.rb
359
359
  - lib/fastlane_core/crash_reporting/crash_reporting.rb
360
+ - lib/fastlane_core/device_manager.rb
360
361
  - lib/fastlane_core/helper.rb
361
362
  - lib/fastlane_core/ipa_file_analyser.rb
362
363
  - lib/fastlane_core/ipa_upload_package_builder.rb
@@ -368,7 +369,6 @@ files:
368
369
  - lib/fastlane_core/print_table.rb
369
370
  - lib/fastlane_core/project.rb
370
371
  - lib/fastlane_core/provisioning_profile.rb
371
- - lib/fastlane_core/simulator.rb
372
372
  - lib/fastlane_core/string_filters.rb
373
373
  - lib/fastlane_core/ui/disable_colors.rb
374
374
  - lib/fastlane_core/ui/fastlane_runner.rb
@@ -399,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
399
  version: '0'
400
400
  requirements: []
401
401
  rubyforge_project:
402
- rubygems_version: 2.4.5.1
402
+ rubygems_version: 2.2.2
403
403
  signing_key:
404
404
  specification_version: 4
405
405
  summary: Contains all shared code/dependencies of the fastlane.tools