danger-podliblint 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ffca707d4b79ddd2ea28df37e049a407206c1912
4
+ data.tar.gz: 5fcbf0781a8cd209f3b75a6bb5eae1b9a9795638
5
+ SHA512:
6
+ metadata.gz: fa68b65dd16d111162b58872ece4a1ec4ebb4ecbda6b72560aed1f8b11f7c572845806e3c6257cad3647df40483ff8759505770d35314278b626345ed10cdf74
7
+ data.tar.gz: cf15cfa1fd15fc0e5ea6d1ed56b0d368be3e71b41179c8b9fe1343ad973aacb3813f7c668b44dc3b8f8ff3e82b0121a445324287067ab9825ef1fac661260cf2
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ cache:
3
+ directories:
4
+ - bundle
5
+
6
+ rvm:
7
+ - 2.3.1
8
+
9
+ script:
10
+ - bundle exec rake spec
11
+
12
+ notifications:
13
+ email: false
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in danger-podliblint.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,171 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-podliblint (0.0.1)
5
+ cocoapods
6
+ danger (~> 2.0)
7
+ nokogiri
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (5.0.0)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (~> 0.7)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ addressable (2.4.0)
18
+ claide (1.0.0)
19
+ claide-plugins (0.9.1)
20
+ cork
21
+ nap
22
+ open4 (~> 1.3)
23
+ cocoapods (1.0.1)
24
+ activesupport (>= 4.0.2)
25
+ claide (>= 1.0.0, < 2.0)
26
+ cocoapods-core (= 1.0.1)
27
+ cocoapods-deintegrate (>= 1.0.0, < 2.0)
28
+ cocoapods-downloader (>= 1.0.0, < 2.0)
29
+ cocoapods-plugins (>= 1.0.0, < 2.0)
30
+ cocoapods-search (>= 1.0.0, < 2.0)
31
+ cocoapods-stats (>= 1.0.0, < 2.0)
32
+ cocoapods-trunk (>= 1.0.0, < 2.0)
33
+ cocoapods-try (>= 1.0.0, < 2.0)
34
+ colored (~> 1.2)
35
+ escape (~> 0.0.4)
36
+ fourflusher (~> 0.3.0)
37
+ molinillo (~> 0.4.5)
38
+ nap (~> 1.0)
39
+ xcodeproj (>= 1.1.0, < 2.0)
40
+ cocoapods-core (1.0.1)
41
+ activesupport (>= 4.0.2)
42
+ fuzzy_match (~> 2.0.4)
43
+ nap (~> 1.0)
44
+ cocoapods-deintegrate (1.0.0)
45
+ cocoapods-downloader (1.1.0)
46
+ cocoapods-plugins (1.0.0)
47
+ nap
48
+ cocoapods-search (1.0.0)
49
+ cocoapods-stats (1.0.0)
50
+ cocoapods-trunk (1.0.0)
51
+ nap (>= 0.8, < 2.0)
52
+ netrc (= 0.7.8)
53
+ cocoapods-try (1.1.0)
54
+ coderay (1.1.1)
55
+ colored (1.2)
56
+ concurrent-ruby (1.0.2)
57
+ cork (0.1.0)
58
+ colored (~> 1.2)
59
+ danger (2.1.1)
60
+ claide (~> 1.0)
61
+ claide-plugins (> 0.9.0)
62
+ colored (~> 1.2)
63
+ cork (~> 0.1)
64
+ faraday (~> 0)
65
+ faraday-http-cache (~> 1.0)
66
+ git (~> 1)
67
+ kramdown (~> 1.5)
68
+ octokit (~> 4.2)
69
+ terminal-table (~> 1)
70
+ diff-lcs (1.2.5)
71
+ escape (0.0.4)
72
+ faraday (0.9.2)
73
+ multipart-post (>= 1.2, < 3)
74
+ faraday-http-cache (1.3.0)
75
+ faraday (~> 0.8)
76
+ ffi (1.9.14)
77
+ formatador (0.2.5)
78
+ fourflusher (0.3.2)
79
+ fuzzy_match (2.0.4)
80
+ git (1.3.0)
81
+ guard (2.14.0)
82
+ formatador (>= 0.2.4)
83
+ listen (>= 2.7, < 4.0)
84
+ lumberjack (~> 1.0)
85
+ nenv (~> 0.1)
86
+ notiffany (~> 0.0)
87
+ pry (>= 0.9.12)
88
+ shellany (~> 0.0)
89
+ thor (>= 0.18.1)
90
+ guard-compat (1.2.1)
91
+ guard-rspec (4.7.3)
92
+ guard (~> 2.1)
93
+ guard-compat (~> 1.1)
94
+ rspec (>= 2.99.0, < 4.0)
95
+ i18n (0.7.0)
96
+ kramdown (1.11.1)
97
+ listen (3.0.7)
98
+ rb-fsevent (>= 0.9.3)
99
+ rb-inotify (>= 0.9.7)
100
+ lumberjack (1.0.10)
101
+ method_source (0.8.2)
102
+ mini_portile2 (2.1.0)
103
+ minitest (5.9.0)
104
+ molinillo (0.4.5)
105
+ multipart-post (2.0.0)
106
+ nap (1.1.0)
107
+ nenv (0.3.0)
108
+ netrc (0.7.8)
109
+ nokogiri (1.6.8)
110
+ mini_portile2 (~> 2.1.0)
111
+ pkg-config (~> 1.1.7)
112
+ notiffany (0.1.1)
113
+ nenv (~> 0.1)
114
+ shellany (~> 0.0)
115
+ octokit (4.3.0)
116
+ sawyer (~> 0.7.0, >= 0.5.3)
117
+ open4 (1.3.4)
118
+ pkg-config (1.1.7)
119
+ pry (0.10.4)
120
+ coderay (~> 1.1.0)
121
+ method_source (~> 0.8.1)
122
+ slop (~> 3.4)
123
+ rake (10.5.0)
124
+ rb-fsevent (0.9.7)
125
+ rb-inotify (0.9.7)
126
+ ffi (>= 0.5.0)
127
+ rspec (3.5.0)
128
+ rspec-core (~> 3.5.0)
129
+ rspec-expectations (~> 3.5.0)
130
+ rspec-mocks (~> 3.5.0)
131
+ rspec-core (3.5.2)
132
+ rspec-support (~> 3.5.0)
133
+ rspec-expectations (3.5.0)
134
+ diff-lcs (>= 1.2.0, < 2.0)
135
+ rspec-support (~> 3.5.0)
136
+ rspec-mocks (3.5.0)
137
+ diff-lcs (>= 1.2.0, < 2.0)
138
+ rspec-support (~> 3.5.0)
139
+ rspec-support (3.5.0)
140
+ sawyer (0.7.0)
141
+ addressable (>= 2.3.5, < 2.5)
142
+ faraday (~> 0.8, < 0.10)
143
+ shellany (0.0.1)
144
+ slop (3.6.0)
145
+ terminal-table (1.6.0)
146
+ thor (0.19.1)
147
+ thread_safe (0.3.5)
148
+ tzinfo (1.2.2)
149
+ thread_safe (~> 0.1)
150
+ xcodeproj (1.2.0)
151
+ activesupport (>= 3)
152
+ claide (>= 1.0.0, < 2.0)
153
+ colored (~> 1.2)
154
+ yard (0.9.5)
155
+
156
+ PLATFORMS
157
+ ruby
158
+
159
+ DEPENDENCIES
160
+ bundler (~> 1.3)
161
+ danger-podliblint!
162
+ guard (~> 2.14)
163
+ guard-rspec (~> 4.7)
164
+ listen (= 3.0.7)
165
+ pry
166
+ rake (~> 10.0)
167
+ rspec (~> 3.4)
168
+ yard (~> 0.8)
169
+
170
+ BUNDLED WITH
171
+ 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,52 @@
1
+ # danger-podliblint
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/danger-podliblint.svg)](https://badge.fury.io/rb/danger-podliblint) [![Build Status](https://travis-ci.org/valeriomazzeo/danger-podliblint.svg?branch=master)](https://travis-ci.org/valeriomazzeo/danger-podliblint)
4
+
5
+ A Danger plugin for Pod lib lint.
6
+
7
+ ## Installation
8
+
9
+ $ gem install danger-podliblint
10
+
11
+ ## Usage
12
+
13
+ ### Log file
14
+
15
+ If a log file is specified `lint` will parse it, otherwise it will execute `pod lib lint` and parse the output.
16
+
17
+ # Optionally specify a log file:
18
+ podliblint.log_file = "/tmp/podliblint.log"
19
+
20
+ # Lint
21
+ podliblint.lint
22
+
23
+ ### Fastlane Report
24
+
25
+ If `pod lib lint` is executed as part of [Fastlane](https://fastlane.tools) is possible to parse the `JUnit` report instead:
26
+
27
+ # Specify the fastlane report file:
28
+ podliblint.log_file = "/fastlane/report.xml"
29
+ podliblint.is_fastlane_report = true
30
+
31
+ # Lint
32
+ podliblint.lint
33
+
34
+ ### Options
35
+
36
+ Additional `pod lib lint` options can be specified through the `options` variable:
37
+
38
+ # Specify custom options
39
+ podliblint.options = "--allow-warnings --private"
40
+
41
+ # Lint
42
+ podliblint.lint
43
+
44
+ **Note:** options are ignored when `log_file` is set.
45
+
46
+ ## Development
47
+
48
+ 1. Clone this repo
49
+ 2. Run `bundle install` to setup dependencies.
50
+ 3. Run `bundle exec rake spec` to run the tests.
51
+ 4. Use `bundle exec guard` to automatically have tests run as you make changes.
52
+ 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,48 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'podliblint/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'danger-podliblint'
8
+ spec.version = Podliblint::VERSION
9
+ spec.authors = ['Valerio Mazzeo']
10
+ spec.email = ['valerio.mazzeo@gmail.com']
11
+ spec.description = %q{A Danger plugin for Pod lib lint.}
12
+ spec.summary = %q{A Danger plugin for Pod lib lint.}
13
+ spec.homepage = 'https://github.com/valeriomazzeo/danger-podliblint'
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
+ spec.add_runtime_dependency 'cocoapods'
23
+ spec.add_runtime_dependency 'nokogiri'
24
+
25
+ # General ruby development
26
+ spec.add_development_dependency 'bundler', '~> 1.3'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+
29
+ # Testing support
30
+ spec.add_development_dependency 'rspec', '~> 3.4'
31
+
32
+ # Linting code and docs
33
+ spec.add_development_dependency "yard", "~> 0.8"
34
+
35
+ # Makes testing easy via `bundle exec guard`
36
+ spec.add_development_dependency 'guard', '~> 2.14'
37
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
38
+
39
+ # If you want to work on older builds of ruby
40
+ spec.add_development_dependency 'listen', '3.0.7'
41
+
42
+ # This gives you the chance to run a REPL inside your test
43
+ # via
44
+ # require 'pry'
45
+ # binding.pry
46
+ # This will stop test execution and let you inspect the results
47
+ spec.add_development_dependency 'pry'
48
+ end
@@ -0,0 +1 @@
1
+ require 'podliblint/plugin'
@@ -0,0 +1 @@
1
+ require 'podliblint/gem_version'
@@ -0,0 +1,3 @@
1
+ module Podliblint
2
+ VERSION = "0.0.1".freeze
3
+ end
@@ -0,0 +1,103 @@
1
+ module Danger
2
+ # A Danger plugin for Pod lib lint.
3
+ #
4
+ # @example Ensure pod lib lint executes correctly
5
+ #
6
+ # If a log file is specified `lint` will parse it,
7
+ # otherwise it will execute `pod lib lint` and parse the output.
8
+ #
9
+ # # Optionally specify a log file:
10
+ # podliblint.log_file = "/tmp/podliblint.log"
11
+ #
12
+ # # Lint
13
+ # podliblint.lint
14
+ #
15
+ # @example Ensure pod lib lint executes correctly as part of Fastlane
16
+ #
17
+ # If `pod lib lint` is executed as part of [Fastlane](https://fastlane.tools)
18
+ # is possible to parse the `JUnit` report instead:
19
+ #
20
+ # # Specify a Fastlane report file:
21
+ # podliblint.log_file = "/fastlane/report.xml"
22
+ # podliblint.is_fastlane_report = true
23
+ #
24
+ # # Lint
25
+ # podliblint.lint
26
+ #
27
+ # @example Ensure pod lib lint executes correctly with custom options
28
+ #
29
+ # Additional `pod lib lint` options can be specified through the `options` variable:
30
+ #
31
+ # # Specify custom options
32
+ # podliblint.options = "--allow-warnings --private"
33
+ #
34
+ # # Lint
35
+ # podliblint.lint
36
+ #
37
+ # @see valeriomazzeo/danger-podliblint
38
+ # @tags pod, lib, lint, cocoapods
39
+ #
40
+ class DangerPodliblint < Plugin
41
+
42
+ # Allows you to specify a pod lib lint log file location to parse.
43
+ # @return [String]
44
+ #
45
+ attr_accessor :log_file
46
+
47
+ # Allows you to specify if the pod lib lint log has been generated from fastlane.
48
+ # @return [Bool]
49
+ #
50
+ attr_accessor :is_fastlane_report
51
+
52
+ # Allows you to specify the pod lib lint options.
53
+ # see pod lib lint --help for more information.
54
+ # @return [String]
55
+ #
56
+ attr_accessor :options
57
+
58
+ # Parses and exposes eventual warnings, errors.
59
+ # @return [failures]
60
+ #
61
+ def lint
62
+
63
+ data = nil
64
+
65
+ if @log_file != nil
66
+ if @is_fastlane_report
67
+ require 'nokogiri'
68
+ @doc = Nokogiri::XML(File.open(@log_file))
69
+ data = @doc.at_xpath('//testcase[contains(@name, "pod_lib_lint")]/failure/@message').to_s
70
+ else
71
+ data = File.open(@log_file, 'r').read
72
+ end
73
+ else
74
+ podliblint_command = "pod lib lint"
75
+ podliblint_command += " #{@options}" if @options
76
+
77
+ require 'cocoapods'
78
+ data = `#{podliblint_command}`
79
+ end
80
+
81
+ # Looking for something like:
82
+ # [!] MyProject did not pass validation, due to 1 error and 1 warning.
83
+ lint_summary = data[/(?<=\[!\]\s).*/i]
84
+
85
+ if lint_summary
86
+ fail("Pod lib lint: #{lint_summary} 🚨")
87
+ failures = data.scan(/(?<=ERROR\s\|\s).*|(?<=-\s)(?!NOTE|WARN|ERROR).*/i)
88
+ failures.each do |failure|
89
+ fail("`" << ((failure.strip! || failure).gsub!(/`/,"") || failure).to_s << "`")
90
+ end
91
+ else
92
+ message("Pod lib lint passed validation 🎊")
93
+ end
94
+
95
+ return failures
96
+ end
97
+
98
+ def self.instance_name
99
+ to_s.gsub("Danger", "").danger_underscore.split("/").last
100
+ end
101
+
102
+ end
103
+ end
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuites>
3
+ <testsuite name="fastlane.lanes">
4
+
5
+
6
+ <testcase classname="fastlane.lanes" name="0: Verifying required fastlane version" time="0.000455">
7
+
8
+ </testcase>
9
+
10
+
11
+ <testcase classname="fastlane.lanes" name="1: default_platform" time="0.000183">
12
+
13
+ </testcase>
14
+
15
+ <testcase classname="fastlane.lanes" name="2: pod_lib_lint" time="0.000183">
16
+ <failure message="-> MyProject&#10; -> MyProject (0.1.0)&#10;&#10; - WARN | url: The URL (https://github.com/myProject/MyProject) is not reachable.&#10;&#10; - ERROR | [iOS] unknown: Encountered an unknown error (Unable to satisfy the following requirements:&#10;&#10; - `SSZipArchive (= 1.2)` required by `MyProject/FileImportExport (0.1.0)`&#10;&#10;&#10;&#10; None of your spec sources contain a spec satisfying the dependency: `SSZipArchive (= 1.2)`.&#10;&#10;&#10; You have either:&#10; * out-of-date source repos which you can update with `pod repo update`.&#10;&#10; * mistyped the name or version.&#10;&#10; * not added the source repo that hosts the Podspec to your Podfile.&#10;&#10;&#10;&#10; Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.) during validation.&#10;&#10;&#10; [!] MyProject did not pass validation, due to 1 error and 1 warning.&#10;&#10; Note"></failure>
17
+ </testcase>
18
+
19
+ </testsuite>
20
+ </testsuites>
@@ -0,0 +1,34 @@
1
+ -> MyProject
2
+ -> MyProject (0.1.0)
3
+
4
+ - WARN | url: The URL (https://github.com/myProject/MyProject) is not reachable.
5
+
6
+ - ERROR | [iOS] unknown: Encountered an unknown error (Unable to satisfy the following requirements:
7
+
8
+
9
+
10
+ - `SSZipArchive (= 1.2)` required by `MyProject/FileImportExport (0.1.0)`
11
+
12
+
13
+
14
+ None of your spec sources contain a spec satisfying the dependency: `SSZipArchive (= 1.2)`.
15
+
16
+
17
+
18
+ You have either:
19
+
20
+ * out-of-date source repos which you can update with `pod repo update`.
21
+
22
+ * mistyped the name or version.
23
+
24
+ * not added the source repo that hosts the Podspec to your Podfile.
25
+
26
+
27
+
28
+ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.) during validation.
29
+
30
+
31
+
32
+ [!] MyProject did not pass validation, due to 1 error and 1 warning.
33
+
34
+ You can use the `--no-clean` option to inspect any issue.
@@ -0,0 +1,4 @@
1
+ -> MyProject (0.1.0)
2
+ - WARN | url: The URL (https://github.com/myProject/myProject) is not reachable.
3
+
4
+ MyProject passed validation.
@@ -0,0 +1,65 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ module Danger
4
+ describe Danger::DangerPodliblint do
5
+ it 'should be a plugin' do
6
+ expect(Danger::DangerPodliblint.new(nil)).to be_a Danger::Plugin
7
+ end
8
+
9
+ describe 'with Dangerfile' do
10
+ before do
11
+ @dangerfile = testing_dangerfile
12
+ @podliblint = @dangerfile.podliblint
13
+ end
14
+
15
+ describe 'with no log_file' do
16
+
17
+ it "parses data" do
18
+ expect(@podliblint.lint).not_to be_nil
19
+ expect(@dangerfile.status_report[:errors].first).to eq("Pod lib lint: Unable to find a podspec in the working directory 🚨")
20
+ expect(@dangerfile.status_report[:messages]).to be_empty
21
+ expect(@dangerfile.status_report[:warnings]).to be_empty
22
+ expect(@dangerfile.status_report[:markdowns]).to be_empty
23
+ end
24
+ end
25
+
26
+ describe 'with log_file' do
27
+
28
+ it "parses data" do
29
+ @podliblint.log_file = "./spec/fixtures/podliblint-error.log"
30
+ expect(@podliblint.lint).not_to be_nil
31
+ expect(@dangerfile.status_report[:errors].first).to eq("Pod lib lint: MyProject did not pass validation, due to 1 error and 1 warning. 🚨")
32
+ expect(@dangerfile.status_report[:errors][1]).to eq("`[iOS] unknown: Encountered an unknown error (Unable to satisfy the following requirements:`")
33
+ expect(@dangerfile.status_report[:errors][2]).to eq("`SSZipArchive (= 1.2) required by MyProject/FileImportExport (0.1.0)`")
34
+ expect(@dangerfile.status_report[:messages]).to be_empty
35
+ expect(@dangerfile.status_report[:warnings]).to be_empty
36
+ expect(@dangerfile.status_report[:markdowns]).to be_empty
37
+ end
38
+
39
+ it "succeeds" do
40
+ @podliblint.log_file = "./spec/fixtures/podliblint.log"
41
+ expect(@podliblint.lint).to be_nil
42
+ expect(@dangerfile.status_report[:messages].first).to eq("Pod lib lint passed validation 🎊")
43
+ expect(@dangerfile.status_report[:errors]).to be_empty
44
+ expect(@dangerfile.status_report[:warnings]).to be_empty
45
+ expect(@dangerfile.status_report[:markdowns]).to be_empty
46
+ end
47
+
48
+ describe 'with fastlane log_file' do
49
+ it "parses data" do
50
+ @podliblint.log_file = "./spec/fixtures/podliblint-error-fastlane.xml"
51
+ @podliblint.is_fastlane_report = true
52
+ expect(@podliblint.lint).not_to be_nil
53
+ expect(@dangerfile.status_report[:errors].first).to eq("Pod lib lint: MyProject did not pass validation, due to 1 error and 1 warning. 🚨")
54
+ expect(@dangerfile.status_report[:errors][1]).to eq("`[iOS] unknown: Encountered an unknown error (Unable to satisfy the following requirements:`")
55
+ expect(@dangerfile.status_report[:errors][2]).to eq("`SSZipArchive (= 1.2) required by MyProject/FileImportExport (0.1.0)`")
56
+ expect(@dangerfile.status_report[:messages]).to be_empty
57
+ expect(@dangerfile.status_report[:warnings]).to be_empty
58
+ expect(@dangerfile.status_report[:markdowns]).to be_empty
59
+ end
60
+ end
61
+ end
62
+
63
+ end
64
+ end
65
+ end
@@ -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
metadata ADDED
@@ -0,0 +1,221 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danger-podliblint
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-02 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: cocoapods
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.4'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.4'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.8'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.8'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.14'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.14'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.7'
139
+ - !ruby/object:Gem::Dependency
140
+ name: listen
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 3.0.7
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 3.0.7
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: A Danger plugin for Pod lib lint.
168
+ email:
169
+ - valerio.mazzeo@gmail.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - ".gitignore"
175
+ - ".travis.yml"
176
+ - Gemfile
177
+ - Gemfile.lock
178
+ - Guardfile
179
+ - LICENSE.txt
180
+ - README.md
181
+ - Rakefile
182
+ - danger-podliblint.gemspec
183
+ - lib/danger_plugin.rb
184
+ - lib/danger_podliblint.rb
185
+ - lib/podliblint/gem_version.rb
186
+ - lib/podliblint/plugin.rb
187
+ - spec/fixtures/podliblint-error-fastlane.xml
188
+ - spec/fixtures/podliblint-error.log
189
+ - spec/fixtures/podliblint.log
190
+ - spec/podliblint_spec.rb
191
+ - spec/spec_helper.rb
192
+ homepage: https://github.com/valeriomazzeo/danger-podliblint
193
+ licenses:
194
+ - MIT
195
+ metadata: {}
196
+ post_install_message:
197
+ rdoc_options: []
198
+ require_paths:
199
+ - lib
200
+ required_ruby_version: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ requirements: []
211
+ rubyforge_project:
212
+ rubygems_version: 2.5.1
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: A Danger plugin for Pod lib lint.
216
+ test_files:
217
+ - spec/fixtures/podliblint-error-fastlane.xml
218
+ - spec/fixtures/podliblint-error.log
219
+ - spec/fixtures/podliblint.log
220
+ - spec/podliblint_spec.rb
221
+ - spec/spec_helper.rb