scan 0.5.2 → 0.6.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 +4 -4
- data/README.md +36 -36
- data/lib/scan/commands_generator.rb +3 -3
- data/lib/scan/detect_values.rb +8 -8
- data/lib/scan/error_handler.rb +3 -3
- data/lib/scan/options.rb +20 -9
- data/lib/scan/report_collector.rb +13 -6
- data/lib/scan/runner.rb +9 -4
- data/lib/scan/slack_poster.rb +9 -2
- data/lib/scan/test_command_generator.rb +5 -3
- data/lib/scan/test_result_parser.rb +1 -1
- data/lib/scan/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e3a58da282847da8eefa3e93ca6d62e8e3792fe
|
|
4
|
+
data.tar.gz: 270b1fff06f780483705fcadd5c1de5e45226052
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e90d79dbf59e8c027d88d1b6608bf8f205875ec40f7acc1b358ffd043679702d9367fef38a8b2ca244285d054701cf1144a8784708f59ae37b7ddfe9c1c85c44
|
|
7
|
+
data.tar.gz: 0a4cc906623c4eecbff1550be6beb86b4d1cc52f3885e63f6a64cc5f0a061345c9264dfd6f7ecdac08f325b1e55b829250fdf6e6352038217fba6bb1f2a33a20
|
data/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<h3 align="center">
|
|
2
|
-
<a href="https://github.com/fastlane/fastlane">
|
|
3
|
-
<img src="assets/fastlane.png" width="150" />
|
|
2
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/fastlane">
|
|
3
|
+
<img src="../fastlane/assets/fastlane.png" width="150" />
|
|
4
4
|
<br />
|
|
5
5
|
fastlane
|
|
6
6
|
</a>
|
|
7
7
|
</h3>
|
|
8
8
|
<p align="center">
|
|
9
|
-
<a href="https://github.com/fastlane/deliver">deliver</a> •
|
|
10
|
-
<a href="https://github.com/fastlane/snapshot">snapshot</a> •
|
|
11
|
-
<a href="https://github.com/fastlane/frameit">frameit</a> •
|
|
12
|
-
<a href="https://github.com/fastlane/pem">pem</a> •
|
|
13
|
-
<a href="https://github.com/fastlane/sigh">sigh</a> •
|
|
14
|
-
<a href="https://github.com/fastlane/produce">produce</a> •
|
|
15
|
-
<a href="https://github.com/fastlane/cert">cert</a> •
|
|
16
|
-
<a href="https://github.com/fastlane/spaceship">spaceship</a> •
|
|
17
|
-
<a href="https://github.com/fastlane/pilot">pilot</a> •
|
|
9
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/deliver">deliver</a> •
|
|
10
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/snapshot">snapshot</a> •
|
|
11
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/frameit">frameit</a> •
|
|
12
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/pem">pem</a> •
|
|
13
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/sigh">sigh</a> •
|
|
14
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/produce">produce</a> •
|
|
15
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/cert">cert</a> •
|
|
16
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/spaceship">spaceship</a> •
|
|
17
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/pilot">pilot</a> •
|
|
18
18
|
<a href="https://github.com/fastlane/boarding">boarding</a> •
|
|
19
|
-
<a href="https://github.com/fastlane/gym">gym</a> •
|
|
19
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/gym">gym</a> •
|
|
20
20
|
<b>scan</b> •
|
|
21
|
-
<a href="https://github.com/fastlane/match">match</a>
|
|
21
|
+
<a href="https://github.com/fastlane/fastlane/tree/master/match">match</a>
|
|
22
22
|
</p>
|
|
23
23
|
-------
|
|
24
24
|
|
|
@@ -30,9 +30,9 @@ scan
|
|
|
30
30
|
============
|
|
31
31
|
|
|
32
32
|
[](https://twitter.com/FastlaneTools)
|
|
33
|
-
[](https://github.com/fastlane/
|
|
33
|
+
[](https://github.com/fastlane/fastlane/blob/master/scan/LICENSE)
|
|
34
34
|
[](http://rubygems.org/gems/scan)
|
|
35
|
-
[](https://circleci.com/gh/fastlane/fastlane)
|
|
36
36
|
|
|
37
37
|
###### The easiest way to run tests of your iOS and Mac app
|
|
38
38
|
|
|
@@ -40,16 +40,16 @@ Get in contact with the developer on Twitter: [@FastlaneTools](https://twitter.c
|
|
|
40
40
|
|
|
41
41
|
-------
|
|
42
42
|
<p align="center">
|
|
43
|
-
<a href="#whats-scan">Features</a> •
|
|
44
|
-
<a href="#installation">Installation</a> •
|
|
45
|
-
<a href="#usage">Usage</a> •
|
|
46
|
-
<a href="#tips">Tips</a> •
|
|
43
|
+
<a href="#whats-scan">Features</a> •
|
|
44
|
+
<a href="#installation">Installation</a> •
|
|
45
|
+
<a href="#usage">Usage</a> •
|
|
46
|
+
<a href="#tips">Tips</a> •
|
|
47
47
|
<a href="#need-help">Need help?</a>
|
|
48
48
|
</p>
|
|
49
49
|
|
|
50
50
|
-------
|
|
51
51
|
|
|
52
|
-
<h5 align="center"><code>scan</code> is part of <a href="https://fastlane.tools">fastlane</a>:
|
|
52
|
+
<h5 align="center"><code>scan</code> is part of <a href="https://fastlane.tools">fastlane</a>: The easiest way to automate building and releasing your iOS and Android apps.</h5>
|
|
53
53
|
|
|
54
54
|
# What's scan?
|
|
55
55
|
|
|
@@ -112,7 +112,7 @@ scan
|
|
|
112
112
|
:bullettrain_side: | Don't remember any complicated build commands, just `scan`
|
|
113
113
|
:wrench: | Easy and dynamic configuration using parameters and environment variables
|
|
114
114
|
:loudspeaker: | Beautiful slack notifications of the test results
|
|
115
|
-
:floppy_disk: | Store common build settings in a `Scanfile`
|
|
115
|
+
:floppy_disk: | Store common build settings in a `Scanfile`
|
|
116
116
|
:outbox_tray: | The raw `xcodebuild` outputs are stored in `~/Library/Logs/scan`
|
|
117
117
|
:computer: | Supports both iOS and Mac applications
|
|
118
118
|
:man: | Automatically switches to the [travis formatter](https://github.com/kattrali/xcpretty-travis-formatter) when running on Travis
|
|
@@ -167,7 +167,7 @@ output_types "html"
|
|
|
167
167
|
|
|
168
168
|
# Automating the whole process
|
|
169
169
|
|
|
170
|
-
`scan` works great together with [fastlane](https://fastlane.tools), which connects all deployment tools into one streamlined workflow.
|
|
170
|
+
`scan` works great together with [fastlane](https://fastlane.tools), which connects all deployment tools into one streamlined workflow.
|
|
171
171
|
|
|
172
172
|
Using `fastlane` you can define a configuration like
|
|
173
173
|
|
|
@@ -177,24 +177,24 @@ lane :test do
|
|
|
177
177
|
end
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
For more information visit the [fastlane GitHub page](https://github.com/fastlane/fastlane).
|
|
180
|
+
For more information visit the [fastlane GitHub page](https://github.com/fastlane/fastlane/tree/master/fastlane).
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
# Tips
|
|
184
184
|
## [`fastlane`](https://fastlane.tools) Toolchain
|
|
185
185
|
|
|
186
|
-
- [`fastlane`](https://fastlane.tools):
|
|
187
|
-
- [`deliver`](https://github.com/fastlane/deliver): Upload screenshots, metadata and your app to the App Store
|
|
188
|
-
- [`snapshot`](https://github.com/fastlane/snapshot): Automate taking localized screenshots of your iOS app on every device
|
|
189
|
-
- [`frameit`](https://github.com/fastlane/frameit): Quickly put your screenshots into the right device frames
|
|
190
|
-
- [`pem`](https://github.com/fastlane/pem): Automatically generate and renew your push notification profiles
|
|
191
|
-
- [`produce`](https://github.com/fastlane/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
|
|
192
|
-
- [`cert`](https://github.com/fastlane/cert): Automatically create and maintain iOS code signing certificates
|
|
193
|
-
- [`spaceship`](https://github.com/fastlane/spaceship): Ruby library to access the Apple Dev Center and iTunes Connect
|
|
194
|
-
- [`pilot`](https://github.com/fastlane/pilot): The best way to manage your TestFlight testers and builds from your terminal
|
|
195
|
-
- [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
|
|
196
|
-
- [`gym`](https://github.com/fastlane/gym): Building your iOS apps has never been easier
|
|
197
|
-
- [`match`](https://github.com/fastlane/match): Easily sync your certificates and profiles across your team using git
|
|
186
|
+
- [`fastlane`](https://fastlane.tools): The easiest way to automate building and releasing your iOS and Android apps
|
|
187
|
+
- [`deliver`](https://github.com/fastlane/fastlane/tree/master/deliver): Upload screenshots, metadata and your app to the App Store
|
|
188
|
+
- [`snapshot`](https://github.com/fastlane/fastlane/tree/master/snapshot): Automate taking localized screenshots of your iOS app on every device
|
|
189
|
+
- [`frameit`](https://github.com/fastlane/fastlane/tree/master/frameit): Quickly put your screenshots into the right device frames
|
|
190
|
+
- [`pem`](https://github.com/fastlane/fastlane/tree/master/pem): Automatically generate and renew your push notification profiles
|
|
191
|
+
- [`produce`](https://github.com/fastlane/fastlane/tree/master/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
|
|
192
|
+
- [`cert`](https://github.com/fastlane/fastlane/tree/master/cert): Automatically create and maintain iOS code signing certificates
|
|
193
|
+
- [`spaceship`](https://github.com/fastlane/fastlane/tree/master/spaceship): Ruby library to access the Apple Dev Center and iTunes Connect
|
|
194
|
+
- [`pilot`](https://github.com/fastlane/fastlane/tree/master/pilot): The best way to manage your TestFlight testers and builds from your terminal
|
|
195
|
+
- [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
|
|
196
|
+
- [`gym`](https://github.com/fastlane/fastlane/tree/master/gym): Building your iOS apps has never been easier
|
|
197
|
+
- [`match`](https://github.com/fastlane/fastlane/tree/master/match): Easily sync your certificates and profiles across your team using git
|
|
198
198
|
|
|
199
199
|
##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
|
|
200
200
|
|
|
@@ -202,7 +202,7 @@ For more information visit the [fastlane GitHub page](https://github.com/fastlan
|
|
|
202
202
|
Please submit an issue on GitHub and provide information about your setup
|
|
203
203
|
|
|
204
204
|
# Code of Conduct
|
|
205
|
-
Help us keep `scan` open and inclusive. Please read and follow our [Code of Conduct](https://github.com/fastlane/
|
|
205
|
+
Help us keep `scan` open and inclusive. Please read and follow our [Code of Conduct](https://github.com/fastlane/fastlane/blob/master/CODE_OF_CONDUCT.md).
|
|
206
206
|
|
|
207
207
|
# License
|
|
208
208
|
This project is licensed under the terms of the MIT license. See the LICENSE file.
|
|
@@ -27,7 +27,7 @@ module Scan
|
|
|
27
27
|
program :description, Scan::DESCRIPTION
|
|
28
28
|
program :help, "Author", "Felix Krause <scan@krausefx.com>"
|
|
29
29
|
program :help, "Website", "https://fastlane.tools"
|
|
30
|
-
program :help, "GitHub", "https://github.com/fastlane/scan"
|
|
30
|
+
program :help, "GitHub", "https://github.com/fastlane/fastlane/tree/master/scan"
|
|
31
31
|
program :help_formatter, :compact
|
|
32
32
|
|
|
33
33
|
global_option("--verbose") { $verbose = true }
|
|
@@ -48,10 +48,10 @@ module Scan
|
|
|
48
48
|
c.action do |_args, options|
|
|
49
49
|
containing = (Helper.fastlane_enabled? ? 'fastlane' : '.')
|
|
50
50
|
path = File.join(containing, Scan.scanfile_name)
|
|
51
|
-
|
|
51
|
+
UI.user_error!("Scanfile already exists").yellow if File.exist?(path)
|
|
52
52
|
template = File.read("#{Helper.gem_path('scan')}/lib/assets/ScanfileTemplate")
|
|
53
53
|
File.write(path, template)
|
|
54
|
-
|
|
54
|
+
UI.success("Successfully created '#{path}'. Open the file using a code editor.")
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
data/lib/scan/detect_values.rb
CHANGED
|
@@ -50,7 +50,7 @@ module Scan
|
|
|
50
50
|
Scan.device = found
|
|
51
51
|
return
|
|
52
52
|
else
|
|
53
|
-
|
|
53
|
+
UI.error("Couldn't find simulator '#{config[:device]}' - falling back to default simulator")
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -64,7 +64,7 @@ module Scan
|
|
|
64
64
|
|
|
65
65
|
Scan.device = found
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
UI.user_error!("No simulators found") unless Scan.device
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def self.default_device_tvos
|
|
@@ -81,7 +81,7 @@ module Scan
|
|
|
81
81
|
Scan.device = found
|
|
82
82
|
return
|
|
83
83
|
else
|
|
84
|
-
|
|
84
|
+
UI.error("Couldn't find simulator '#{config[:device]}' - falling back to default simulator")
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -95,16 +95,16 @@ module Scan
|
|
|
95
95
|
|
|
96
96
|
Scan.device = found
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
UI.user_error!("No simulators found") unless Scan.device
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
# Is it an iOS device or a Mac?
|
|
102
102
|
def self.detect_destination
|
|
103
103
|
if Scan.config[:destination]
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
UI.important("It's not recommended to set the `destination` value directly")
|
|
105
|
+
UI.important("Instead use the other options available in `scan --help`")
|
|
106
|
+
UI.important("Using your value '#{Scan.config[:destination]}' for now")
|
|
107
|
+
UI.important("because I trust you know what you're doing...")
|
|
108
108
|
return
|
|
109
109
|
end
|
|
110
110
|
|
data/lib/scan/error_handler.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Scan
|
|
|
21
21
|
print "For more information visit this stackoverflow answer:"
|
|
22
22
|
print "https://stackoverflow.com/a/17031697/445598"
|
|
23
23
|
when /Testing failed/
|
|
24
|
-
|
|
24
|
+
UI.user_error!("Error building the application - see the log above")
|
|
25
25
|
when /Executed/
|
|
26
26
|
# this is *really* important:
|
|
27
27
|
# we don't want to raise an exception here
|
|
@@ -29,14 +29,14 @@ module Scan
|
|
|
29
29
|
# after parsing the actual test results
|
|
30
30
|
return
|
|
31
31
|
end
|
|
32
|
-
|
|
32
|
+
UI.user_error!("Error building/testing the application - see the log above")
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
37
|
# Just to make things easier
|
|
38
38
|
def print(text)
|
|
39
|
-
|
|
39
|
+
UI.error(text)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
data/lib/scan/options.rb
CHANGED
|
@@ -14,9 +14,9 @@ module Scan
|
|
|
14
14
|
description: "Path the workspace file",
|
|
15
15
|
verify_block: proc do |value|
|
|
16
16
|
v = File.expand_path(value.to_s)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
UI.user_error!("Workspace file not found at path '#{v}'") unless File.exist?(v)
|
|
18
|
+
UI.user_error!("Workspace file invalid") unless File.directory?(v)
|
|
19
|
+
UI.user_error!("Workspace file is not a workspace, must end with .xcworkspace") unless v.include?(".xcworkspace")
|
|
20
20
|
end),
|
|
21
21
|
FastlaneCore::ConfigItem.new(key: :project,
|
|
22
22
|
short_option: "-p",
|
|
@@ -25,9 +25,9 @@ module Scan
|
|
|
25
25
|
description: "Path the project file",
|
|
26
26
|
verify_block: proc do |value|
|
|
27
27
|
v = File.expand_path(value.to_s)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
UI.user_error!("Project file not found at path '#{v}'") unless File.exist?(v)
|
|
29
|
+
UI.user_error!("Project file invalid") unless File.directory?(v)
|
|
30
|
+
UI.user_error!("Project file is not a project file, must end with .xcodeproj") unless v.include?(".xcodeproj")
|
|
31
31
|
end),
|
|
32
32
|
FastlaneCore::ConfigItem.new(key: :device,
|
|
33
33
|
short_option: "-a",
|
|
@@ -53,6 +53,7 @@ module Scan
|
|
|
53
53
|
FastlaneCore::ConfigItem.new(key: :skip_build,
|
|
54
54
|
description: "Should skip debug build before test build?",
|
|
55
55
|
short_option: "-r",
|
|
56
|
+
env_name: "SCAN_SKIP_BUILD",
|
|
56
57
|
is_string: false,
|
|
57
58
|
default_value: false),
|
|
58
59
|
FastlaneCore::ConfigItem.new(key: :output_directory,
|
|
@@ -66,7 +67,7 @@ module Scan
|
|
|
66
67
|
description: "Define how the output should look like (standard, basic or rspec)",
|
|
67
68
|
optional: true,
|
|
68
69
|
verify_block: proc do |value|
|
|
69
|
-
|
|
70
|
+
UI.user_error!("Invalid output_style #{value}") unless ['standard', 'basic', "rspec"].include?(value)
|
|
70
71
|
end),
|
|
71
72
|
FastlaneCore::ConfigItem.new(key: :output_types,
|
|
72
73
|
short_option: "-f",
|
|
@@ -78,6 +79,11 @@ module Scan
|
|
|
78
79
|
env_name: "SCAN_BUILDLOG_PATH",
|
|
79
80
|
description: "The directory were to store the raw log",
|
|
80
81
|
default_value: "~/Library/Logs/scan"),
|
|
82
|
+
FastlaneCore::ConfigItem.new(key: :formatter,
|
|
83
|
+
short_option: "-n",
|
|
84
|
+
env_name: "SCAN_FORMATTER",
|
|
85
|
+
description: "A custom xcpretty formatter to use",
|
|
86
|
+
optional: true),
|
|
81
87
|
FastlaneCore::ConfigItem.new(key: :derived_data_path,
|
|
82
88
|
short_option: "-j",
|
|
83
89
|
env_name: "SCAN_DERIVED_DATA_PATH",
|
|
@@ -121,7 +127,7 @@ module Scan
|
|
|
121
127
|
description: "Use an extra XCCONFIG file to build your app",
|
|
122
128
|
optional: true,
|
|
123
129
|
verify_block: proc do |value|
|
|
124
|
-
|
|
130
|
+
UI.user_error!("File not found at path '#{File.expand_path(value)}'") unless File.exist?(value)
|
|
125
131
|
end),
|
|
126
132
|
FastlaneCore::ConfigItem.new(key: :slack_url,
|
|
127
133
|
short_option: "-i",
|
|
@@ -129,13 +135,18 @@ module Scan
|
|
|
129
135
|
description: "Create an Incoming WebHook for your Slack group to post results there",
|
|
130
136
|
optional: true,
|
|
131
137
|
verify_block: proc do |value|
|
|
132
|
-
|
|
138
|
+
UI.user_error!("Invalid URL, must start with https://") unless value.start_with? "https://"
|
|
133
139
|
end),
|
|
134
140
|
FastlaneCore::ConfigItem.new(key: :slack_channel,
|
|
135
141
|
short_option: "-e",
|
|
136
142
|
env_name: "SCAN_SLACK_CHANNEL",
|
|
137
143
|
description: "#channel or @username",
|
|
138
144
|
optional: true),
|
|
145
|
+
FastlaneCore::ConfigItem.new(key: :slack_message,
|
|
146
|
+
short_option: "-m",
|
|
147
|
+
env_name: "SCAN_SLACK_MESSAGE",
|
|
148
|
+
description: "The message included with each message posted to slack",
|
|
149
|
+
optional: true),
|
|
139
150
|
FastlaneCore::ConfigItem.new(key: :skip_slack,
|
|
140
151
|
description: "Don't publish to slack, even when an URL is given",
|
|
141
152
|
is_string: false,
|
|
@@ -2,15 +2,22 @@ module Scan
|
|
|
2
2
|
class ReportCollector
|
|
3
3
|
SUPPORTED = %w(html junit json-compilation-database)
|
|
4
4
|
|
|
5
|
+
# Intialize with values from Scan.config matching these param names
|
|
6
|
+
def initialize(open_report, output_types, output_directory)
|
|
7
|
+
@open_report = open_report
|
|
8
|
+
@output_types = output_types
|
|
9
|
+
@output_directory = output_directory
|
|
10
|
+
end
|
|
11
|
+
|
|
5
12
|
def parse_raw_file(path)
|
|
6
|
-
|
|
13
|
+
UI.user_error!("Couldn't find file at path '#{path}'") unless File.exist?(path)
|
|
7
14
|
|
|
8
15
|
commands = generate_commands(path)
|
|
9
16
|
commands.each do |output_path, command|
|
|
10
17
|
system(command)
|
|
11
|
-
|
|
18
|
+
UI.success("Successfully generated report at '#{output_path}'")
|
|
12
19
|
|
|
13
|
-
if
|
|
20
|
+
if @open_report and output_path.end_with?(".html")
|
|
14
21
|
# Open the HTML file
|
|
15
22
|
`open --hide '#{output_path}'`
|
|
16
23
|
end
|
|
@@ -19,7 +26,7 @@ module Scan
|
|
|
19
26
|
|
|
20
27
|
# Returns a hash containg the resulting path as key and the command as value
|
|
21
28
|
def generate_commands(path, types: nil, output_file_name: nil)
|
|
22
|
-
types ||=
|
|
29
|
+
types ||= @output_types
|
|
23
30
|
types = types.split(",") if types.kind_of?(String) # might already be an array when passed via fastlane
|
|
24
31
|
commands = {}
|
|
25
32
|
|
|
@@ -27,12 +34,12 @@ module Scan
|
|
|
27
34
|
type = raw.strip
|
|
28
35
|
|
|
29
36
|
unless SUPPORTED.include?(type)
|
|
30
|
-
|
|
37
|
+
UI.error("Couldn't find reporter '#{type}', available #{SUPPORTED.join(', ')}")
|
|
31
38
|
next
|
|
32
39
|
end
|
|
33
40
|
|
|
34
41
|
file_name = "report.#{type}"
|
|
35
|
-
output_path = output_file_name || File.join(File.expand_path(
|
|
42
|
+
output_path = output_file_name || File.join(File.expand_path(@output_directory), file_name)
|
|
36
43
|
parts = ["cat '#{path}' | "]
|
|
37
44
|
parts << "xcpretty"
|
|
38
45
|
parts << "--report #{type}"
|
data/lib/scan/runner.rb
CHANGED
|
@@ -43,9 +43,14 @@ module Scan
|
|
|
43
43
|
# First, generate a JUnit report to get the number of tests
|
|
44
44
|
require 'tempfile'
|
|
45
45
|
output_file = Tempfile.new("junit_report")
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
|
|
47
|
+
report_collector = ReportCollector.new(Scan.config[:open_report],
|
|
48
|
+
Scan.config[:output_types],
|
|
49
|
+
Scan.config[:output_directory])
|
|
50
|
+
|
|
51
|
+
cmd = report_collector.generate_commands(TestCommandGenerator.xcodebuild_log_path,
|
|
52
|
+
types: 'junit',
|
|
53
|
+
output_file_name: output_file.path).values.last
|
|
49
54
|
system(cmd)
|
|
50
55
|
|
|
51
56
|
result = TestResultParser.new.parse_result(output_file.read)
|
|
@@ -66,7 +71,7 @@ module Scan
|
|
|
66
71
|
})
|
|
67
72
|
puts ""
|
|
68
73
|
|
|
69
|
-
|
|
74
|
+
report_collector.parse_raw_file(TestCommandGenerator.xcodebuild_log_path)
|
|
70
75
|
|
|
71
76
|
UI.user_error!("Test execution failed. Exit status: #{tests_exit_status}") unless tests_exit_status == 0
|
|
72
77
|
UI.user_error!("Tests failed") unless result[:failures] == 0
|
data/lib/scan/slack_poster.rb
CHANGED
|
@@ -16,6 +16,13 @@ module Scan
|
|
|
16
16
|
|
|
17
17
|
attachments = []
|
|
18
18
|
|
|
19
|
+
if Scan.config[:slack_message]
|
|
20
|
+
attachments << {
|
|
21
|
+
text: Scan.config[:slack_message].to_s,
|
|
22
|
+
color: "good"
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
|
|
19
26
|
attachments << {
|
|
20
27
|
text: "Build Errors: #{results[:build_errors] || 0}",
|
|
21
28
|
color: results[:build_errors].to_i > 0 ? "danger" : "good",
|
|
@@ -43,9 +50,9 @@ module Scan
|
|
|
43
50
|
attachments: attachments
|
|
44
51
|
|
|
45
52
|
if result.code.to_i == 200
|
|
46
|
-
|
|
53
|
+
UI.success('Successfully sent Slack notification')
|
|
47
54
|
else
|
|
48
|
-
|
|
55
|
+
UI.error(result.to_s)
|
|
49
56
|
end
|
|
50
57
|
end
|
|
51
58
|
end
|
|
@@ -23,7 +23,7 @@ module Scan
|
|
|
23
23
|
def project_path_array
|
|
24
24
|
proj = Scan.project.xcodebuild_parameters
|
|
25
25
|
return proj if proj.count > 0
|
|
26
|
-
|
|
26
|
+
UI.user_error!("No project/workspace found")
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def options
|
|
@@ -63,9 +63,11 @@ module Scan
|
|
|
63
63
|
# During building we just show the output in the terminal
|
|
64
64
|
# Check out the ReportCollector class for more xcpretty things
|
|
65
65
|
formatter = []
|
|
66
|
-
if
|
|
66
|
+
if Scan.config[:formatter]
|
|
67
|
+
formatter << "-f `#{Scan.config[:formatter]}`"
|
|
68
|
+
elsif ENV.key?("TRAVIS")
|
|
67
69
|
formatter << "-f `xcpretty-travis-formatter`"
|
|
68
|
-
|
|
70
|
+
UI.success("Automatically switched to Travis formatter")
|
|
69
71
|
end
|
|
70
72
|
|
|
71
73
|
if Helper.colors_disabled?
|
data/lib/scan/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.6.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-
|
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fastlane_core
|
|
@@ -134,14 +134,14 @@ dependencies:
|
|
|
134
134
|
requirements:
|
|
135
135
|
- - "~>"
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: 0.
|
|
137
|
+
version: 0.38.0
|
|
138
138
|
type: :development
|
|
139
139
|
prerelease: false
|
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements:
|
|
142
142
|
- - "~>"
|
|
143
143
|
- !ruby/object:Gem::Version
|
|
144
|
-
version: 0.
|
|
144
|
+
version: 0.38.0
|
|
145
145
|
- !ruby/object:Gem::Dependency
|
|
146
146
|
name: rspec
|
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -156,6 +156,20 @@ dependencies:
|
|
|
156
156
|
- - "~>"
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
158
|
version: 3.1.0
|
|
159
|
+
- !ruby/object:Gem::Dependency
|
|
160
|
+
name: rspec_junit_formatter
|
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - "~>"
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: 0.2.3
|
|
166
|
+
type: :development
|
|
167
|
+
prerelease: false
|
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - "~>"
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: 0.2.3
|
|
159
173
|
- !ruby/object:Gem::Dependency
|
|
160
174
|
name: pry
|
|
161
175
|
requirement: !ruby/object:Gem::Requirement
|