scan 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cc2fe474c347a129830537ffce88fe76b0a2d4c
4
- data.tar.gz: 135a4581ccad9231202c43f4338dcb5fbea1eb82
3
+ metadata.gz: 3e80ce377dfea30070cc638147cb93688e8c3fd3
4
+ data.tar.gz: 59750c70db3b139fcb532a8840e6f5c342a363d2
5
5
  SHA512:
6
- metadata.gz: 819d84e29eb6c03e34edec3514f5a5bf8aa2b9e0f38e3a5bff2e6a1d4075b1178aef94f2c11e798cbb50e2f17b79b58a3c94adaad6491c2dd5b6647bde93494b
7
- data.tar.gz: bcf9bfe6456c0f8d8ed50d48760ab60aacf12e4e0e02dd88e15e63af85a722952007db9bd561bbbd560445c35b010f16a4778d7789c23d4d1c41c51174a0b1cc
6
+ metadata.gz: 200af6ecf87403148f386fb1f4ffdc72eef3728c18f3041c49bf24f14d52db24e7effa7b120120f39c17f66c04784bf6e46608d3de6d55841f8022da99057bde
7
+ data.tar.gz: 8ef71b1679533343d44c1dafacdaa38154dca06121faf67c8f5aff8680410b743acad96735dddad32339c722d5b23c3afa1b990e812d150800146590a72a8722
data/lib/scan.rb CHANGED
@@ -20,7 +20,7 @@ module Scan
20
20
 
21
21
  attr_accessor :cache
22
22
 
23
- attr_accessor :device
23
+ attr_accessor :devices
24
24
 
25
25
  def config=(value)
26
26
  @config = value
@@ -37,20 +37,30 @@ module Scan
37
37
  end
38
38
 
39
39
  def self.default_device_ios
40
- config = Scan.config
41
-
42
- if config[:device] # make sure it actually exists
43
- device = config[:device].to_s.strip.tr('()', '') # Remove parenthesis
44
-
45
- found = FastlaneCore::Simulator.all.find do |d|
46
- (d.name + " " + d.ios_version).include? device
40
+ devices = Scan.config[:devices] || Array(Scan.config[:device]) # important to use Array(nil) for when the value is nil
41
+ found_devices = []
42
+
43
+ if devices.any?
44
+ # Optionally, we only do this if the user specified a custom device or an array of devices
45
+ devices.each do |device|
46
+ lookup_device = device.to_s.strip.tr('()', '') # Remove parenthesis
47
+
48
+ found = FastlaneCore::Simulator.all.detect do |d|
49
+ (d.name + " " + d.ios_version).include? lookup_device
50
+ end
51
+
52
+ if found
53
+ found_devices.push(found)
54
+ else
55
+ UI.error("Ignoring '#{device}', couldn't find matching simulator")
56
+ end
47
57
  end
48
58
 
49
- if found
50
- Scan.device = found
59
+ if found_devices.any?
60
+ Scan.devices = found_devices
51
61
  return
52
62
  else
53
- UI.error("Couldn't find simulator '#{config[:device]}' - falling back to default simulator")
63
+ UI.error("Couldn't find any matching simulators for '#{devices}' - falling back to default simulator")
54
64
  end
55
65
  end
56
66
 
@@ -62,26 +72,38 @@ module Scan
62
72
  found = sims.detect { |d| d.name == "iPhone 5s" }
63
73
  found ||= sims.first # anything is better than nothing
64
74
 
65
- Scan.device = found
66
-
67
- UI.user_error!("No simulators found") unless Scan.device
75
+ if found
76
+ Scan.devices = [found]
77
+ else
78
+ UI.user_error!("No simulators found on local machine")
79
+ end
68
80
  end
69
81
 
70
82
  def self.default_device_tvos
71
- config = Scan.config
72
-
73
- if config[:device] # make sure it actually exists
74
- device = config[:device].to_s.strip.tr('()', '') # Remove parenthesis
75
-
76
- found = FastlaneCore::SimulatorTV.all.find do |d|
77
- (d.name + " " + d.tvos_version).include? device
83
+ devices = Scan.config[:devices] || Array(Scan.config[:device]) # important to use Array(nil) for when the value is nil
84
+ found_devices = []
85
+
86
+ if devices.any?
87
+ # Optionally, we only do this if the user specified a custom device or an array of devices
88
+ devices.each do |device|
89
+ lookup_device = device.to_s.strip.tr('()', '') # Remove parenthesis
90
+
91
+ found = FastlaneCore::SimulatorTV.all.detect do |d|
92
+ (d.name + " " + d.tvos_version).include? lookup_device
93
+ end
94
+
95
+ if found
96
+ found_devices.push(found)
97
+ else
98
+ UI.error("Ignoring '#{device}', couldn't find matching simulator")
99
+ end
78
100
  end
79
101
 
80
- if found
81
- Scan.device = found
102
+ if found_devices.any?
103
+ Scan.devices = found_devices
82
104
  return
83
105
  else
84
- UI.error("Couldn't find simulator '#{config[:device]}' - falling back to default simulator")
106
+ UI.error("Couldn't find any matching simulators for '#{devices}' - falling back to default simulator")
85
107
  end
86
108
  end
87
109
 
@@ -93,12 +115,14 @@ module Scan
93
115
  found = sims.detect { |d| d.name == "Apple TV 1080p" }
94
116
  found ||= sims.first # anything is better than nothing
95
117
 
96
- Scan.device = found
97
-
98
- UI.user_error!("No simulators found") unless Scan.device
118
+ if found
119
+ Scan.devices = [found]
120
+ else
121
+ UI.user_error!("No TV simulators found on the local machine")
122
+ end
99
123
  end
100
124
 
101
- # Is it an iOS device or a Mac?
125
+ # Is it an iOS, a tvOS or a MacOS device?
102
126
  def self.detect_destination
103
127
  if Scan.config[:destination]
104
128
  UI.important("It's not recommended to set the `destination` value directly")
@@ -110,11 +134,11 @@ module Scan
110
134
 
111
135
  # building up the destination now
112
136
  if Scan.project.ios?
113
- Scan.config[:destination] = "platform=iOS Simulator,id=#{Scan.device.udid}"
137
+ Scan.config[:destination] = Scan.devices.map { |d| "platform=iOS Simulator,id=#{d.udid}" }
114
138
  elsif Scan.project.tvos?
115
- Scan.config[:destination] = "platform=tvOS Simulator,id=#{Scan.device.udid}"
139
+ Scan.config[:destination] = Scan.devices.map { |d| "platform=tvOS Simulator,id=#{d.udid}" }
116
140
  else
117
- Scan.config[:destination] = "platform=OS X"
141
+ Scan.config[:destination] = ["platform=OS X"]
118
142
  end
119
143
  end
120
144
  end
data/lib/scan/options.rb CHANGED
@@ -34,7 +34,21 @@ module Scan
34
34
  optional: true,
35
35
  is_string: true,
36
36
  env_name: "SCAN_DEVICE",
37
- description: "The name of the simulator type you want to run tests on"),
37
+ description: "The name of the simulator type you want to run tests on (e.g. 'iPhone 6')",
38
+ conflicting_options: [:devices],
39
+ conflict_block: proc do |value|
40
+ UI.user_error!("You can't use 'device' and 'devices' options in one run")
41
+ end),
42
+ FastlaneCore::ConfigItem.new(key: :devices,
43
+ optional: true,
44
+ is_string: false,
45
+ env_name: "SCAN_DEVICES",
46
+ type: Array,
47
+ description: "Array of devices to run the tests on (e.g. ['iPhone 6', 'iPad Air'])",
48
+ conflicting_options: [:device],
49
+ conflict_block: proc do |value|
50
+ UI.user_error!("You can't use 'device' and 'devices' options in one run")
51
+ end),
38
52
  FastlaneCore::ConfigItem.new(key: :scheme,
39
53
  short_option: "-s",
40
54
  optional: true,
@@ -50,6 +64,10 @@ module Scan
50
64
  description: "Should generate code coverage (Xcode 7 only)?",
51
65
  is_string: false,
52
66
  default_value: false),
67
+ FastlaneCore::ConfigItem.new(key: :address_sanitizer,
68
+ description: "Should turn on the address sanitizer?",
69
+ is_string: false,
70
+ default_value: false),
53
71
  FastlaneCore::ConfigItem.new(key: :skip_build,
54
72
  description: "Should skip debug build before test build?",
55
73
  short_option: "-r",
@@ -72,7 +90,7 @@ module Scan
72
90
  FastlaneCore::ConfigItem.new(key: :output_types,
73
91
  short_option: "-f",
74
92
  env_name: "SCAN_OUTPUT_TYPES",
75
- description: "Comma seperated list of the output types (e.g. html, junit)",
93
+ description: "Comma separated list of the output types (e.g. html, junit)",
76
94
  default_value: "html,junit"),
77
95
  FastlaneCore::ConfigItem.new(key: :buildlog_path,
78
96
  short_option: "-l",
@@ -115,6 +133,7 @@ module Scan
115
133
  short_option: "-d",
116
134
  env_name: "SCAN_DESTINATION",
117
135
  description: "Use only if you're a pro, use the other options instead",
136
+ is_string: false,
118
137
  optional: true),
119
138
  FastlaneCore::ConfigItem.new(key: :xcargs,
120
139
  short_option: "-x",
data/lib/scan/runner.rb CHANGED
@@ -10,7 +10,12 @@ module Scan
10
10
  end
11
11
 
12
12
  def test_app
13
- open_simulator_for_device(Scan.device)
13
+ # We call this method, to be sure that all other simulators are killed
14
+ # And a correct one is freshly launched. Switching between multiple simulator
15
+ # in case the user specified multiple targets works with no issues
16
+ # This way it's okay to just call it for the first simulator we're using for
17
+ # the first test run
18
+ open_simulator_for_device(Scan.devices.first)
14
19
 
15
20
  command = TestCommandGenerator.generate
16
21
  prefix_hash = [
@@ -33,10 +33,11 @@ module Scan
33
33
  options += project_path_array
34
34
  options << "-configuration '#{config[:configuration]}'" if config[:configuration]
35
35
  options << "-sdk '#{config[:sdk]}'" if config[:sdk]
36
- options << "-destination '#{config[:destination]}'" # generated in `detect_values`
36
+ options << destination # generated in `detect_values`
37
37
  options << "-derivedDataPath '#{config[:derived_data_path]}'" if config[:derived_data_path]
38
38
  options << "-resultBundlePath '#{result_bundle_path}'" if config[:result_bundle]
39
39
  options << "-enableCodeCoverage YES" if config[:code_coverage]
40
+ options << "-enableAddressSanitizer YES" if config[:address_sanitizer]
40
41
  options << "-xcconfig '#{config[:xcconfig]}'" if config[:xcconfig]
41
42
  options << config[:xcargs] if config[:xcargs]
42
43
 
@@ -94,6 +95,14 @@ module Scan
94
95
  return File.join(containing, file_name)
95
96
  end
96
97
 
98
+ # Generate destination parameters
99
+ def destination
100
+ unless Scan.cache[:destination]
101
+ Scan.cache[:destination] = [*Scan.config[:destination]].map { |dst| "-destination '#{dst}'" }.join(' ')
102
+ end
103
+ Scan.cache[:destination]
104
+ end
105
+
97
106
  # The path to set the Derived Data to
98
107
  def build_path
99
108
  unless Scan.cache[:build_path]
data/lib/scan/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Scan
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.0"
3
3
  DESCRIPTION = "The easiest way to run tests of your iOS and Mac app"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.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-05-09 00:00:00.000000000 Z
11
+ date: 2016-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  version: '0'
271
271
  requirements: []
272
272
  rubyforge_project:
273
- rubygems_version: 2.4.5.1
273
+ rubygems_version: 2.4.0
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: The easiest way to run tests of your iOS and Mac app