danger-xcodebuild 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +113 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +22 -0
- data/Rakefile +16 -0
- data/danger-xcodebuild.gemspec +46 -0
- data/lib/danger_plugin.rb +1 -0
- data/lib/danger_xcodebuild.rb +1 -0
- data/lib/xcodebuild/gem_version.rb +3 -0
- data/lib/xcodebuild/plugin.rb +104 -0
- data/spec/spec_helper.rb +59 -0
- data/spec/xcodebuild_spec.rb +117 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d4f12c211166ef123909ae5e5c45f9a65c7a1075
|
4
|
+
data.tar.gz: 91a611ec692f317ab0b5574a3172641a2c6cb374
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e96afe3ad1d8ce83ed34716b20092a2688d4d21b7cbaa6b996b017e2870d0508a3f8f87401eae8a0840132f684d9dbca3f1b7d08238bc87d39e8f67485ab856a
|
7
|
+
data.tar.gz: 9580b492ded25f56519108b42ae06932180b1c8913671a045fcf119fb602fa6e71be6f15ea01b2748fc427e202ab0d1affd6944d846e3ed3f1bec652828ba27c
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
danger-xcodebuild (0.0.1)
|
5
|
+
danger (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.4.0)
|
11
|
+
claide (1.0.0)
|
12
|
+
claide-plugins (0.9.1)
|
13
|
+
cork
|
14
|
+
nap
|
15
|
+
open4 (~> 1.3)
|
16
|
+
coderay (1.1.1)
|
17
|
+
colored (1.2)
|
18
|
+
cork (0.1.0)
|
19
|
+
colored (~> 1.2)
|
20
|
+
danger (2.1.1)
|
21
|
+
claide (~> 1.0)
|
22
|
+
claide-plugins (> 0.9.0)
|
23
|
+
colored (~> 1.2)
|
24
|
+
cork (~> 0.1)
|
25
|
+
faraday (~> 0)
|
26
|
+
faraday-http-cache (~> 1.0)
|
27
|
+
git (~> 1)
|
28
|
+
kramdown (~> 1.5)
|
29
|
+
octokit (~> 4.2)
|
30
|
+
terminal-table (~> 1)
|
31
|
+
diff-lcs (1.2.5)
|
32
|
+
faraday (0.9.2)
|
33
|
+
multipart-post (>= 1.2, < 3)
|
34
|
+
faraday-http-cache (1.3.0)
|
35
|
+
faraday (~> 0.8)
|
36
|
+
ffi (1.9.14)
|
37
|
+
formatador (0.2.5)
|
38
|
+
git (1.3.0)
|
39
|
+
guard (2.14.0)
|
40
|
+
formatador (>= 0.2.4)
|
41
|
+
listen (>= 2.7, < 4.0)
|
42
|
+
lumberjack (~> 1.0)
|
43
|
+
nenv (~> 0.1)
|
44
|
+
notiffany (~> 0.0)
|
45
|
+
pry (>= 0.9.12)
|
46
|
+
shellany (~> 0.0)
|
47
|
+
thor (>= 0.18.1)
|
48
|
+
guard-compat (1.2.1)
|
49
|
+
guard-rspec (4.7.3)
|
50
|
+
guard (~> 2.1)
|
51
|
+
guard-compat (~> 1.1)
|
52
|
+
rspec (>= 2.99.0, < 4.0)
|
53
|
+
kramdown (1.11.1)
|
54
|
+
listen (3.0.7)
|
55
|
+
rb-fsevent (>= 0.9.3)
|
56
|
+
rb-inotify (>= 0.9.7)
|
57
|
+
lumberjack (1.0.10)
|
58
|
+
method_source (0.8.2)
|
59
|
+
multipart-post (2.0.0)
|
60
|
+
nap (1.1.0)
|
61
|
+
nenv (0.3.0)
|
62
|
+
notiffany (0.1.1)
|
63
|
+
nenv (~> 0.1)
|
64
|
+
shellany (~> 0.0)
|
65
|
+
octokit (4.3.0)
|
66
|
+
sawyer (~> 0.7.0, >= 0.5.3)
|
67
|
+
open4 (1.3.4)
|
68
|
+
pry (0.10.4)
|
69
|
+
coderay (~> 1.1.0)
|
70
|
+
method_source (~> 0.8.1)
|
71
|
+
slop (~> 3.4)
|
72
|
+
rake (10.5.0)
|
73
|
+
rb-fsevent (0.9.7)
|
74
|
+
rb-inotify (0.9.7)
|
75
|
+
ffi (>= 0.5.0)
|
76
|
+
rspec (3.5.0)
|
77
|
+
rspec-core (~> 3.5.0)
|
78
|
+
rspec-expectations (~> 3.5.0)
|
79
|
+
rspec-mocks (~> 3.5.0)
|
80
|
+
rspec-core (3.5.2)
|
81
|
+
rspec-support (~> 3.5.0)
|
82
|
+
rspec-expectations (3.5.0)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.5.0)
|
85
|
+
rspec-mocks (3.5.0)
|
86
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
+
rspec-support (~> 3.5.0)
|
88
|
+
rspec-support (3.5.0)
|
89
|
+
sawyer (0.7.0)
|
90
|
+
addressable (>= 2.3.5, < 2.5)
|
91
|
+
faraday (~> 0.8, < 0.10)
|
92
|
+
shellany (0.0.1)
|
93
|
+
slop (3.6.0)
|
94
|
+
terminal-table (1.6.0)
|
95
|
+
thor (0.19.1)
|
96
|
+
yard (0.9.5)
|
97
|
+
|
98
|
+
PLATFORMS
|
99
|
+
ruby
|
100
|
+
|
101
|
+
DEPENDENCIES
|
102
|
+
bundler (~> 1.3)
|
103
|
+
danger-xcodebuild!
|
104
|
+
guard (~> 2.14)
|
105
|
+
guard-rspec (~> 4.7)
|
106
|
+
listen (= 3.0.7)
|
107
|
+
pry
|
108
|
+
rake (~> 10.0)
|
109
|
+
rspec (~> 3.4)
|
110
|
+
yard (~> 0.8)
|
111
|
+
|
112
|
+
BUNDLED WITH
|
113
|
+
1.12.5
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A guardfile for making Danger Plugins
|
2
|
+
# For more info see https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# To run, use `bundle exec guard`.
|
5
|
+
|
6
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
7
|
+
require 'guard/rspec/dsl'
|
8
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
9
|
+
|
10
|
+
# RSpec files
|
11
|
+
rspec = dsl.rspec
|
12
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
13
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
14
|
+
watch(rspec.spec_files)
|
15
|
+
|
16
|
+
# Ruby files
|
17
|
+
ruby = dsl.ruby
|
18
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
19
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Valerio Mazzeo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# danger-xcodebuild
|
2
|
+
|
3
|
+
Exposes warnings, errors and test results. It requires a JSON generated using [xcpretty-json-formatter](https://github.com/marcelofabri/xcpretty-json-formatter), to be passed as an argument for it to work.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install danger-xcodebuild
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
xcodebuild.parse_warnings
|
12
|
+
xcodebuild.parse_errors
|
13
|
+
xcodebuild.parse_tests
|
14
|
+
xcodebuild.perfect_build
|
15
|
+
|
16
|
+
## Development
|
17
|
+
|
18
|
+
1. Clone this repo
|
19
|
+
2. Run `bundle install` to setup dependencies.
|
20
|
+
3. Run `bundle exec rake spec` to run the tests.
|
21
|
+
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
22
|
+
5. Make your changes.
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:specs)
|
5
|
+
|
6
|
+
task default: :specs
|
7
|
+
|
8
|
+
task :spec do
|
9
|
+
Rake::Task['specs'].invoke
|
10
|
+
Rake::Task['spec_docs'].invoke
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'Ensure that the plugin passes `danger plugins lint`'
|
14
|
+
task :spec_docs do
|
15
|
+
sh 'bundle exec danger plugins lint'
|
16
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'xcodebuild/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'danger-xcodebuild'
|
8
|
+
spec.version = Xcodebuild::VERSION
|
9
|
+
spec.authors = ['Valerio Mazzeo']
|
10
|
+
spec.email = ['valerio.mazzeo@gmail.com']
|
11
|
+
spec.description = %q{Exposes warnings, errors and test results.}
|
12
|
+
spec.summary = %q{Exposes warnings, errors and test results. It requires a JSON generated using xcpretty-json-formatter to be passed as an argument for it to work.}
|
13
|
+
spec.homepage = 'https://github.com/valeriomazzeo/danger-xcodebuild'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'danger', '~>2.0'
|
22
|
+
|
23
|
+
# General ruby development
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
|
27
|
+
# Testing support
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
29
|
+
|
30
|
+
# Linting code and docs
|
31
|
+
spec.add_development_dependency "yard", "~> 0.8"
|
32
|
+
|
33
|
+
# Makes testing easy via `bundle exec guard`
|
34
|
+
spec.add_development_dependency 'guard', '~> 2.14'
|
35
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
36
|
+
|
37
|
+
# If you want to work on older builds of ruby
|
38
|
+
spec.add_development_dependency 'listen', '3.0.7'
|
39
|
+
|
40
|
+
# This gives you the chance to run a REPL inside your test
|
41
|
+
# via
|
42
|
+
# require 'pry'
|
43
|
+
# binding.pry
|
44
|
+
# This will stop test execution and let you inspect the results
|
45
|
+
spec.add_development_dependency 'pry'
|
46
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'xcodebuild/plugin'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'xcodebuild/gem_version'
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module Danger
|
2
|
+
# Exposes warnings, errors and test results.
|
3
|
+
# It requires a JSON generated using [xcpretty-json-formatter](https://github.com/marcelofabri/xcpretty-json-formatter),
|
4
|
+
# to be passed as an argument for it to work.
|
5
|
+
#
|
6
|
+
# @example Ensure the project compiles without warnings, errors and all tests are executed correctly
|
7
|
+
#
|
8
|
+
# xcodebuild.parse_warnings
|
9
|
+
# xcodebuild.parse_errors
|
10
|
+
# xcodebuild.parse_tests
|
11
|
+
# xcodebuild.perfect_build
|
12
|
+
#
|
13
|
+
# @see valeriomazzeo/danger-xcodebuild
|
14
|
+
# @tags xcode, xcodebuild, errors, warnings, tests, xcpretty-json-formatter
|
15
|
+
#
|
16
|
+
class DangerXcodebuild < Plugin
|
17
|
+
|
18
|
+
def initialize(arg)
|
19
|
+
super
|
20
|
+
@warning_count = 0
|
21
|
+
@error_count = 0
|
22
|
+
@test_failures_count = 0
|
23
|
+
@xcodebuild_json = nil
|
24
|
+
end
|
25
|
+
|
26
|
+
# Allows you to specify an xcodebuild JSON file location to parse.
|
27
|
+
attr_reader :json_file
|
28
|
+
|
29
|
+
# Allows you to specify an xcodebuild JSON file location to parse.
|
30
|
+
# @return [void]
|
31
|
+
#
|
32
|
+
def json_file=(value)
|
33
|
+
@json_file = value
|
34
|
+
@xcodebuild_json = JSON.parse(File.open(value, 'r').read)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Parses and exposes eventual warnings.
|
38
|
+
# @return [warning_count]
|
39
|
+
#
|
40
|
+
def parse_warnings
|
41
|
+
@warning_count = @xcodebuild_json["warnings"].count
|
42
|
+
@warning_count = @warning_count + @xcodebuild_json["ld_warnings"].count
|
43
|
+
@warning_count = @warning_count + @xcodebuild_json["compile_warnings"].count
|
44
|
+
if @warning_count > 0
|
45
|
+
warning_string = @warning_count == 1 ? "warning" : "warnings"
|
46
|
+
warn("Please fix **#{@warning_count}** #{warning_string} 😒")
|
47
|
+
end
|
48
|
+
return @warning_count
|
49
|
+
end
|
50
|
+
|
51
|
+
# Parses and expose eventual errors.
|
52
|
+
# @return [error_count]
|
53
|
+
#
|
54
|
+
def parse_errors
|
55
|
+
errors = @xcodebuild_json["errors"].map {|x| "`#{x}`"}
|
56
|
+
errors += @xcodebuild_json["compile_errors"].map {|x| "`[#{x["file_path"].split("/").last}] #{x["reason"]}`"}
|
57
|
+
errors += @xcodebuild_json["file_missing_errors"].map {|x| "`[#{x["file_path"].split("/").last}] #{x["reason"]}`"}
|
58
|
+
errors += @xcodebuild_json["undefined_symbols_errors"].map {|x| "`#{x["message"]}`"}
|
59
|
+
errors += @xcodebuild_json["duplicate_symbols_errors"].map {|x| "`#{x["message"]}`"}
|
60
|
+
if errors.count > 0
|
61
|
+
error_string = errors.count == 1 ? "error" : "errors"
|
62
|
+
fail("Build failed with **#{errors.count}** #{error_string} 🚨")
|
63
|
+
errors.each do |error|
|
64
|
+
fail(error)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
@error_count = errors.count
|
68
|
+
return @error_count
|
69
|
+
end
|
70
|
+
|
71
|
+
# Parses and exposes eventual test failures.
|
72
|
+
# @return [test_failures]
|
73
|
+
#
|
74
|
+
def parse_tests
|
75
|
+
test_failures = Array.new
|
76
|
+
@xcodebuild_json["tests_failures"].each do |key, value|
|
77
|
+
test_failures += value.map {|x| "`[#{x["file_path"].split("/").last}] [#{x["test_case"]}] #{x["reason"]}`"}
|
78
|
+
end
|
79
|
+
|
80
|
+
if test_failures.count > 0
|
81
|
+
test_string = test_failures.count == 1 ? "error" : "errors"
|
82
|
+
fail("Test execution failed with **#{test_failures.count}** #{test_string} 🚨")
|
83
|
+
test_failures.each do |test_failure|
|
84
|
+
fail(test_failure)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
@test_failures_count = test_failures.count
|
88
|
+
return @test_failures_count
|
89
|
+
end
|
90
|
+
|
91
|
+
# Prints "Perfect build 👍🏻" if everything is ok after parsing.
|
92
|
+
# @return [is_perfect_build]
|
93
|
+
#
|
94
|
+
def perfect_build
|
95
|
+
is_perfect_build = @warning_count == 0 && @error_count == 0 && @test_failures_count == 0
|
96
|
+
message("Perfect build 👍🏻") if is_perfect_build
|
97
|
+
return is_perfect_build
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.instance_name
|
101
|
+
to_s.gsub("Danger", "").danger_underscore.split("/").last
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$:.unshift((ROOT + 'lib').to_s)
|
4
|
+
$:.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'pry'
|
8
|
+
|
9
|
+
require 'rspec'
|
10
|
+
require 'danger'
|
11
|
+
|
12
|
+
# Use coloured output, it's the best.
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.filter_gems_from_backtrace "bundler"
|
15
|
+
config.color = true
|
16
|
+
config.tty = true
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'danger_plugin'
|
20
|
+
|
21
|
+
# These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
|
22
|
+
# If you are expanding these files, see if it's already been done ^.
|
23
|
+
|
24
|
+
# A silent version of the user interface,
|
25
|
+
# it comes with an extra function `.string` which will
|
26
|
+
# strip all ANSI colours from the string.
|
27
|
+
|
28
|
+
# rubocop:disable Lint/NestedMethodDefinition
|
29
|
+
def testing_ui
|
30
|
+
@output = StringIO.new
|
31
|
+
def @output.winsize
|
32
|
+
[20, 9999]
|
33
|
+
end
|
34
|
+
|
35
|
+
cork = Cork::Board.new(out: @output)
|
36
|
+
def cork.string
|
37
|
+
out.string.gsub(/\e\[([;\d]+)?m/, "")
|
38
|
+
end
|
39
|
+
cork
|
40
|
+
end
|
41
|
+
# rubocop:enable Lint/NestedMethodDefinition
|
42
|
+
|
43
|
+
# Example environment (ENV) that would come from
|
44
|
+
# running a PR on TravisCI
|
45
|
+
def testing_env
|
46
|
+
{
|
47
|
+
'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
|
48
|
+
'TRAVIS_PULL_REQUEST' => '800',
|
49
|
+
'TRAVIS_REPO_SLUG' => 'artsy/eigen',
|
50
|
+
'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
|
51
|
+
'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# A stubbed out Dangerfile for use in tests
|
56
|
+
def testing_dangerfile
|
57
|
+
env = Danger::EnvironmentManager.new(testing_env)
|
58
|
+
Danger::Dangerfile.new(env, testing_ui)
|
59
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Danger
|
4
|
+
describe Danger::DangerXcodebuild do
|
5
|
+
it 'should be a plugin' do
|
6
|
+
expect(Danger::DangerXcodebuild.new(nil)).to be_a Danger::Plugin
|
7
|
+
end
|
8
|
+
|
9
|
+
#
|
10
|
+
# You should test your custom attributes and methods here
|
11
|
+
#
|
12
|
+
describe 'with Dangerfile' do
|
13
|
+
before do
|
14
|
+
@dangerfile = testing_dangerfile
|
15
|
+
@xcodebuild = @dangerfile.xcodebuild
|
16
|
+
end
|
17
|
+
|
18
|
+
it "is a perfect build" do
|
19
|
+
expect(@xcodebuild.perfect_build).to be true
|
20
|
+
expect(@dangerfile.status_report[:messages].first).to eq("Perfect build 👍🏻")
|
21
|
+
expect(@dangerfile.status_report[:errors]).to be_empty
|
22
|
+
expect(@dangerfile.status_report[:warnings]).to be_empty
|
23
|
+
expect(@dangerfile.status_report[:markdowns]).to be_empty
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'with warnings' do
|
27
|
+
|
28
|
+
before do
|
29
|
+
data = {
|
30
|
+
:warnings => ['warning1', 'warning2'],
|
31
|
+
:ld_warnings => ['ld_warnings'],
|
32
|
+
:compile_warnings => ['compile_warnings']
|
33
|
+
}.to_json
|
34
|
+
|
35
|
+
filename = 'xcodebuild_warnings.json'
|
36
|
+
allow(File).to receive(:open).with(filename, 'r').and_return(StringIO.new(data))
|
37
|
+
|
38
|
+
@xcodebuild.json_file = filename
|
39
|
+
end
|
40
|
+
|
41
|
+
it "has to report warnings" do
|
42
|
+
expect(@xcodebuild.parse_warnings).to eq(4)
|
43
|
+
expect(@xcodebuild.perfect_build).to be false
|
44
|
+
expect(@dangerfile.status_report[:warnings].first).to eq("Please fix **4** warnings 😒")
|
45
|
+
expect(@dangerfile.status_report[:errors]).to be_empty
|
46
|
+
expect(@dangerfile.status_report[:messages]).to be_empty
|
47
|
+
expect(@dangerfile.status_report[:markdowns]).to be_empty
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'with errors' do
|
53
|
+
|
54
|
+
before do
|
55
|
+
data = {
|
56
|
+
:errors => ['error1', 'error2'],
|
57
|
+
:compile_errors => [
|
58
|
+
{ :file_path => '/tmp/file1.m', :reason => 'reason1' },
|
59
|
+
{ :file_path => '/tmp/file2.m', :reason => 'reason2' }
|
60
|
+
],
|
61
|
+
:file_missing_errors => [
|
62
|
+
{ :file_path => '/tmp/missing_file1.m', :reason => 'reason1' },
|
63
|
+
{ :file_path => '/tmp/missing_file2.m', :reason => 'reason2' }
|
64
|
+
],
|
65
|
+
:undefined_symbols_errors => [{ :message => 'undefined_symbols' }],
|
66
|
+
:duplicate_symbols_errors => [{ :message => 'duplicate_symbols' }]
|
67
|
+
}.to_json
|
68
|
+
|
69
|
+
filename = 'xcodebuild_errors.json'
|
70
|
+
allow(File).to receive(:open).with(filename, 'r').and_return(StringIO.new(data))
|
71
|
+
|
72
|
+
@xcodebuild.json_file = filename
|
73
|
+
end
|
74
|
+
|
75
|
+
it "has to report errors" do
|
76
|
+
expect(@xcodebuild.parse_errors).to eq(8)
|
77
|
+
expect(@xcodebuild.perfect_build).to be false
|
78
|
+
expect(@dangerfile.status_report[:errors].count).to eq(8+1)
|
79
|
+
expect(@dangerfile.status_report[:errors].first).to eq("Build failed with **8** errors 🚨")
|
80
|
+
expect(@dangerfile.status_report[:warnings]).to be_empty
|
81
|
+
expect(@dangerfile.status_report[:messages]).to be_empty
|
82
|
+
expect(@dangerfile.status_report[:markdowns]).to be_empty
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
describe 'with tests failures' do
|
88
|
+
|
89
|
+
before do
|
90
|
+
data = {
|
91
|
+
:tests_failures => {
|
92
|
+
:suite1 => [{ :file_path => '/tmp/file1.m', :test_case => "testCase1", :reason => 'reason1' }],
|
93
|
+
:suite2 => [{ :file_path => '/tmp/file2.m', :test_case => "testCase2", :reason => 'reason2' }]
|
94
|
+
}
|
95
|
+
}.to_json
|
96
|
+
|
97
|
+
filename = 'xcodebuild_tests.json'
|
98
|
+
allow(File).to receive(:open).with(filename, 'r').and_return(StringIO.new(data))
|
99
|
+
|
100
|
+
@xcodebuild.json_file = filename
|
101
|
+
end
|
102
|
+
|
103
|
+
it "has to report tests failures" do
|
104
|
+
expect(@xcodebuild.parse_tests).to eq(2)
|
105
|
+
expect(@xcodebuild.perfect_build).to be false
|
106
|
+
expect(@dangerfile.status_report[:errors].count).to eq(2+1)
|
107
|
+
expect(@dangerfile.status_report[:errors].first).to eq("Test execution failed with **2** errors 🚨")
|
108
|
+
expect(@dangerfile.status_report[:warnings]).to be_empty
|
109
|
+
expect(@dangerfile.status_report[:messages]).to be_empty
|
110
|
+
expect(@dangerfile.status_report[:markdowns]).to be_empty
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
metadata
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: danger-xcodebuild
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Valerio Mazzeo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: danger
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.14'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.14'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.7'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.7'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: listen
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.0.7
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.0.7
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Exposes warnings, errors and test results.
|
140
|
+
email:
|
141
|
+
- valerio.mazzeo@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".travis.yml"
|
148
|
+
- Gemfile
|
149
|
+
- Gemfile.lock
|
150
|
+
- Guardfile
|
151
|
+
- LICENSE.txt
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- danger-xcodebuild.gemspec
|
155
|
+
- lib/danger_plugin.rb
|
156
|
+
- lib/danger_xcodebuild.rb
|
157
|
+
- lib/xcodebuild/gem_version.rb
|
158
|
+
- lib/xcodebuild/plugin.rb
|
159
|
+
- spec/spec_helper.rb
|
160
|
+
- spec/xcodebuild_spec.rb
|
161
|
+
homepage: https://github.com/valeriomazzeo/danger-xcodebuild
|
162
|
+
licenses:
|
163
|
+
- MIT
|
164
|
+
metadata: {}
|
165
|
+
post_install_message:
|
166
|
+
rdoc_options: []
|
167
|
+
require_paths:
|
168
|
+
- lib
|
169
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
requirements: []
|
180
|
+
rubyforge_project:
|
181
|
+
rubygems_version: 2.5.1
|
182
|
+
signing_key:
|
183
|
+
specification_version: 4
|
184
|
+
summary: Exposes warnings, errors and test results. It requires a JSON generated using
|
185
|
+
xcpretty-json-formatter to be passed as an argument for it to work.
|
186
|
+
test_files:
|
187
|
+
- spec/spec_helper.rb
|
188
|
+
- spec/xcodebuild_spec.rb
|