danger-xcodebuild 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/xcodebuild/gem_version.rb +1 -1
- data/lib/xcodebuild/plugin.rb +21 -4
- data/spec/xcodebuild_spec.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e64658c29cf07253dd9cc5b037582d59a75155ab
|
4
|
+
data.tar.gz: 81da85368c2827f9a75b2bd254c89523f52ac57f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ace20c3da72cff0ef7a271993745ddf019e9d216b89367e10fe6502e9bbf9543a976ad3b9ab27ef108ae45d2d6eccc0f09a7836263c72f5173370884f7e08d88
|
7
|
+
data.tar.gz: 2111c49a248ed3ad9919259c71ef4e2344b925a66ba3c52960a209dedd4e4f31ee11d7dae98d8ce3f3a052dd829e015b8fab470bf7146294696ce37d63e41748
|
data/Gemfile.lock
CHANGED
data/lib/xcodebuild/plugin.rb
CHANGED
@@ -23,6 +23,11 @@ module Danger
|
|
23
23
|
@xcodebuild_json = nil
|
24
24
|
end
|
25
25
|
|
26
|
+
# Allows you to specify a build title to prefix all the reported messages.
|
27
|
+
# @return [String]
|
28
|
+
#
|
29
|
+
attr_accessor :build_title
|
30
|
+
|
26
31
|
# Allows you to specify an xcodebuild JSON file location to parse.
|
27
32
|
attr_reader :json_file
|
28
33
|
|
@@ -43,7 +48,10 @@ module Danger
|
|
43
48
|
@warning_count = @warning_count + @xcodebuild_json["compile_warnings"].count
|
44
49
|
if @warning_count > 0
|
45
50
|
warning_string = @warning_count == 1 ? "warning" : "warnings"
|
46
|
-
|
51
|
+
message = Array.new
|
52
|
+
message.push (@build_title) unless @build_title.nil?
|
53
|
+
message.push("Please fix **#{@warning_count}** #{warning_string} 😒")
|
54
|
+
warn(message.reject(&:empty?).join(" "))
|
47
55
|
end
|
48
56
|
return @warning_count
|
49
57
|
end
|
@@ -59,7 +67,10 @@ module Danger
|
|
59
67
|
errors += @xcodebuild_json["duplicate_symbols_errors"].map {|x| "`#{x["message"]}`"}
|
60
68
|
if errors.count > 0
|
61
69
|
error_string = errors.count == 1 ? "error" : "errors"
|
62
|
-
|
70
|
+
message = Array.new
|
71
|
+
message.push (@build_title) unless @build_title.nil?
|
72
|
+
message.push("Build failed with **#{errors.count}** #{error_string} 🚨")
|
73
|
+
fail(message.reject(&:empty?).join(" "))
|
63
74
|
errors.each do |error|
|
64
75
|
fail(error)
|
65
76
|
end
|
@@ -79,7 +90,10 @@ module Danger
|
|
79
90
|
|
80
91
|
if test_failures.count > 0
|
81
92
|
test_string = test_failures.count == 1 ? "error" : "errors"
|
82
|
-
|
93
|
+
message = Array.new
|
94
|
+
message.push (@build_title) unless @build_title.nil?
|
95
|
+
message.push("Test execution failed with **#{test_failures.count}** #{test_string} 🚨")
|
96
|
+
fail(message.reject(&:empty?).join(" "))
|
83
97
|
test_failures.each do |test_failure|
|
84
98
|
fail(test_failure)
|
85
99
|
end
|
@@ -93,7 +107,10 @@ module Danger
|
|
93
107
|
#
|
94
108
|
def perfect_build
|
95
109
|
is_perfect_build = @warning_count == 0 && @error_count == 0 && @test_failures_count == 0
|
96
|
-
message
|
110
|
+
message = Array.new
|
111
|
+
message.push (@build_title) unless @build_title.nil?
|
112
|
+
message.push ("Perfect build 👍🏻")
|
113
|
+
message(message.reject(&:empty?).join(" ")) if is_perfect_build
|
97
114
|
return is_perfect_build
|
98
115
|
end
|
99
116
|
|
data/spec/xcodebuild_spec.rb
CHANGED
@@ -23,6 +23,13 @@ module Danger
|
|
23
23
|
expect(@dangerfile.status_report[:markdowns]).to be_empty
|
24
24
|
end
|
25
25
|
|
26
|
+
it "has to add build_title as prefix" do
|
27
|
+
@xcodebuild.build_title = "Title"
|
28
|
+
@xcodebuild.perfect_build
|
29
|
+
|
30
|
+
expect(@dangerfile.status_report[:messages].first).to eq("Title Perfect build 👍🏻")
|
31
|
+
end
|
32
|
+
|
26
33
|
describe 'with warnings' do
|
27
34
|
|
28
35
|
before do
|
@@ -47,6 +54,12 @@ module Danger
|
|
47
54
|
expect(@dangerfile.status_report[:markdowns]).to be_empty
|
48
55
|
end
|
49
56
|
|
57
|
+
it "has to add build_title as prefix" do
|
58
|
+
@xcodebuild.build_title = "Title"
|
59
|
+
@xcodebuild.parse_warnings
|
60
|
+
expect(@dangerfile.status_report[:warnings].first).to eq("Title Please fix **4** warnings 😒")
|
61
|
+
end
|
62
|
+
|
50
63
|
end
|
51
64
|
|
52
65
|
describe 'with errors' do
|
@@ -82,6 +95,12 @@ module Danger
|
|
82
95
|
expect(@dangerfile.status_report[:markdowns]).to be_empty
|
83
96
|
end
|
84
97
|
|
98
|
+
it "has to add build_title as prefix" do
|
99
|
+
@xcodebuild.build_title = "Title"
|
100
|
+
@xcodebuild.parse_errors
|
101
|
+
expect(@dangerfile.status_report[:errors].first).to eq("Title Build failed with **8** errors 🚨")
|
102
|
+
end
|
103
|
+
|
85
104
|
end
|
86
105
|
|
87
106
|
describe 'with tests failures' do
|
@@ -110,6 +129,12 @@ module Danger
|
|
110
129
|
expect(@dangerfile.status_report[:markdowns]).to be_empty
|
111
130
|
end
|
112
131
|
|
132
|
+
it "has to add build_title as prefix" do
|
133
|
+
@xcodebuild.build_title = "Title"
|
134
|
+
@xcodebuild.parse_tests
|
135
|
+
expect(@dangerfile.status_report[:errors].first).to eq("Title Test execution failed with **2** errors 🚨")
|
136
|
+
end
|
137
|
+
|
113
138
|
end
|
114
139
|
|
115
140
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-xcodebuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valerio Mazzeo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger
|