danger-SwiftInfo 0.0.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb2a40817c15ca49871d094a9d483c2cddab13e57ee5b569f7fa19f3221437d6
4
- data.tar.gz: 5f9fd067c9db5837addf0e0f1f1518418ad626a8ed8a6d5c2b9a4700e36f4256
3
+ metadata.gz: 5a2ed6c86189ac2e1f0a83d7e031167ed958c44d292b72a3bf3e5986f4ffb8f5
4
+ data.tar.gz: d9c2733f5360a8883a18d2187d05061198d1137887bdf720c3acad334e59402c
5
5
  SHA512:
6
- metadata.gz: 96fb96e3b1653250ae6d7cb95e4cd10eefb2aa578d28b0e869fdf9e47bf1e0dc4d43df5d2a59e912331d3b2a03f57a618a887d638404168bb686b42220a70611
7
- data.tar.gz: dbc0da9b9106ecb77e41a9b0ad981ff50f747331e5e7532dc69b4a467b1ff247ef9291a5b046164e85a5df901c26a36d6f7120628edb2da7ece97eaf7b8557d8
6
+ metadata.gz: 85b8afaf50ea64ebef9364a2220447f2502b49fb088c12556572e7683286a83c90cdc58e74b04385387770f7971ccaf685f35cd5f411460128126b40f0466898
7
+ data.tar.gz: 7da109982ad645dadc06bddc6b12426fbe10bd43aeaa163ab211956d1e64d53791124d9615916c7e79b908edeb18ab0540f8ad4e2e40c755c461c1e5e2c5dcbd
data/Gemfile.lock ADDED
@@ -0,0 +1,137 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-SwiftInfo (0.0.4)
5
+ danger-plugin-api (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.6.0)
11
+ public_suffix (>= 2.0.2, < 4.0)
12
+ ast (2.4.0)
13
+ claide (1.0.2)
14
+ claide-plugins (0.9.2)
15
+ cork
16
+ nap
17
+ open4 (~> 1.3)
18
+ coderay (1.1.2)
19
+ colored2 (3.1.2)
20
+ cork (0.3.0)
21
+ colored2 (~> 3.1)
22
+ danger (6.0.7)
23
+ claide (~> 1.0)
24
+ claide-plugins (>= 0.9.2)
25
+ colored2 (~> 3.1)
26
+ cork (~> 0.1)
27
+ faraday (~> 0.9)
28
+ faraday-http-cache (~> 2.0)
29
+ git (~> 1.5)
30
+ kramdown (~> 2.0)
31
+ kramdown-parser-gfm (~> 1.0)
32
+ no_proxy_fix
33
+ octokit (~> 4.7)
34
+ terminal-table (~> 1)
35
+ danger-plugin-api (1.0.0)
36
+ danger (> 2.0)
37
+ diff-lcs (1.3)
38
+ faraday (0.15.4)
39
+ multipart-post (>= 1.2, < 3)
40
+ faraday-http-cache (2.0.0)
41
+ faraday (~> 0.8)
42
+ ffi (1.11.0)
43
+ formatador (0.2.5)
44
+ git (1.5.0)
45
+ guard (2.15.0)
46
+ formatador (>= 0.2.4)
47
+ listen (>= 2.7, < 4.0)
48
+ lumberjack (>= 1.0.12, < 2.0)
49
+ nenv (~> 0.1)
50
+ notiffany (~> 0.0)
51
+ pry (>= 0.9.12)
52
+ shellany (~> 0.0)
53
+ thor (>= 0.18.1)
54
+ guard-compat (1.2.1)
55
+ guard-rspec (4.7.3)
56
+ guard (~> 2.1)
57
+ guard-compat (~> 1.1)
58
+ rspec (>= 2.99.0, < 4.0)
59
+ jaro_winkler (1.5.2)
60
+ kramdown (2.1.0)
61
+ kramdown-parser-gfm (1.0.1)
62
+ kramdown (~> 2.0)
63
+ listen (3.0.7)
64
+ rb-fsevent (>= 0.9.3)
65
+ rb-inotify (>= 0.9.7)
66
+ lumberjack (1.0.13)
67
+ method_source (0.9.2)
68
+ multipart-post (2.1.1)
69
+ nap (1.1.0)
70
+ nenv (0.3.0)
71
+ no_proxy_fix (0.1.2)
72
+ notiffany (0.1.1)
73
+ nenv (~> 0.1)
74
+ shellany (~> 0.0)
75
+ octokit (4.14.0)
76
+ sawyer (~> 0.8.0, >= 0.5.3)
77
+ open4 (1.3.4)
78
+ parallel (1.17.0)
79
+ parser (2.6.3.0)
80
+ ast (~> 2.4.0)
81
+ pry (0.12.2)
82
+ coderay (~> 1.1.0)
83
+ method_source (~> 0.9.0)
84
+ public_suffix (3.0.3)
85
+ rainbow (3.0.0)
86
+ rake (10.5.0)
87
+ rb-fsevent (0.10.3)
88
+ rb-inotify (0.10.0)
89
+ ffi (~> 1.0)
90
+ rspec (3.8.0)
91
+ rspec-core (~> 3.8.0)
92
+ rspec-expectations (~> 3.8.0)
93
+ rspec-mocks (~> 3.8.0)
94
+ rspec-core (3.8.0)
95
+ rspec-support (~> 3.8.0)
96
+ rspec-expectations (3.8.3)
97
+ diff-lcs (>= 1.2.0, < 2.0)
98
+ rspec-support (~> 3.8.0)
99
+ rspec-mocks (3.8.0)
100
+ diff-lcs (>= 1.2.0, < 2.0)
101
+ rspec-support (~> 3.8.0)
102
+ rspec-support (3.8.0)
103
+ rubocop (0.69.0)
104
+ jaro_winkler (~> 1.5.1)
105
+ parallel (~> 1.10)
106
+ parser (>= 2.6)
107
+ rainbow (>= 2.2.2, < 4.0)
108
+ ruby-progressbar (~> 1.7)
109
+ unicode-display_width (>= 1.4.0, < 1.7)
110
+ ruby-progressbar (1.10.0)
111
+ sawyer (0.8.2)
112
+ addressable (>= 2.3.5)
113
+ faraday (> 0.8, < 2.0)
114
+ shellany (0.0.1)
115
+ terminal-table (1.8.0)
116
+ unicode-display_width (~> 1.1, >= 1.1.1)
117
+ thor (0.20.3)
118
+ unicode-display_width (1.6.0)
119
+ yard (0.9.20)
120
+
121
+ PLATFORMS
122
+ ruby
123
+
124
+ DEPENDENCIES
125
+ bundler
126
+ danger-SwiftInfo!
127
+ guard (~> 2.14)
128
+ guard-rspec (~> 4.7)
129
+ listen (= 3.0.7)
130
+ pry
131
+ rake (~> 10.0)
132
+ rspec (~> 3.4)
133
+ rubocop
134
+ yard
135
+
136
+ BUNDLED WITH
137
+ 2.0.1
data/README.md CHANGED
@@ -1,17 +1,51 @@
1
1
  # danger-SwiftInfo
2
2
 
3
- A description of danger-SwiftInfo.
3
+ A [Danger](http://danger.systems/) plugin that runs and prints [SwiftInfo](https://github.com/rockbruno/SwiftInfo) results to pull requests.
4
4
 
5
- ## Installation
5
+ Requires SwiftInfo 2.3.1 or newer.
6
6
 
7
- $ gem install danger-SwiftInfo
7
+ ### How does it look?
8
8
 
9
- ## Usage
9
+ <img src="https://i.imgur.com/8kvEx5O.png">
10
10
 
11
- Methods and attributes from this plugin are available in
12
- your `Dangerfile` under the `SwiftInfo` namespace.
11
+ ### Installation
13
12
 
14
- ## Development
13
+ Just add the gem to your Gemfile:
14
+
15
+ ```ruby
16
+ gem 'danger-SwiftInfo'
17
+ ```
18
+
19
+ ### Usage
20
+
21
+ To use this plugin, you need to modify both your Dangerfile and your SwiftInfo's Infofile.
22
+
23
+ #### Dangerfile
24
+
25
+ Call `swiftinfo.run` with the path to your SwiftInfo binary as an argument. (inside `Pods` if CocoaPods was used or just `swiftinfo` if Homebrew was used)
26
+
27
+ ```ruby
28
+ swiftinfo.run './Pods/SwiftInfo/bin/swiftinfo'
29
+ ```
30
+
31
+ #### Infofile
32
+
33
+ To print the final output to Danger, call `api.print(output)` from your Infofile.
34
+
35
+ Note that when ran from this plugin, SwiftInfo will be executed with the `-pullRequest -s` arguments which can be inspected and used as a condition. This logic is abstracted under the `isInPullRequestMode` boolean, which you can use to extract different providers in Danger runs and prevent saving the output, for example.
36
+
37
+ ```swift
38
+ if isInPullRequestMode {
39
+ // The specific Danger flow
40
+ api.print(output: output)
41
+ } else {
42
+ // The regular release flow
43
+ api.sendToSlack(output: output, webhookUrl: url)
44
+ api.save(output: output)
45
+ }
46
+ ```
47
+
48
+ ### Development
15
49
 
16
50
  1. Clone this repo
17
51
  2. Run `bundle install` to setup dependencies.
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'SwiftInfo/gem_version.rb'
4
+ require 'danger_SwiftInfo.rb'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'danger-SwiftInfo'
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
22
22
 
23
23
  # General ruby development
24
- spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'bundler'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
 
27
27
  # Testing support
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
30
30
  # Linting code and docs
31
31
  spec.add_development_dependency "rubocop"
32
32
  spec.add_development_dependency "yard"
33
- spec.add_development_dependency "open3"
34
33
 
35
34
  # Makes testing easy via `bundle exec guard`
36
35
  spec.add_development_dependency 'guard', '~> 2.14'
@@ -1 +1,3 @@
1
- require "SwiftInfo/gem_version"
1
+ module SwiftInfo
2
+ VERSION = "0.1.0".freeze
3
+ end
data/lib/danger_plugin.rb CHANGED
@@ -1 +1,33 @@
1
- require "SwiftInfo/plugin"
1
+ require "open3"
2
+
3
+ module Danger
4
+ # Runs SwiftInfo and prints the results to the pull request.
5
+ # You must have [SwiftInfo](https://github.com/rockbruno/SwiftInfo) installed
6
+ # somewhere in your project.
7
+ # You can detect that SwiftInfo is running specifically for Danger
8
+ # by adding a `if isInPullRequestMode` condition in your Infofile.
9
+ # You can use this condition to extract different rules and prevent saving the new output.
10
+ # @example Run SwiftInfo
11
+ #
12
+ # swiftinfo.run './Pods/SwiftInfo/bin/swiftinfo'
13
+ #
14
+ # @see rockbruno/danger-SwiftInfo
15
+ # @tags swift, xcode, swiftinfo, ios
16
+ #
17
+ class DangerSwiftInfo < Plugin
18
+ # Run SwiftInfo and print the results to the PR.
19
+ # @param [String] path Path to the SwiftInfo binary.
20
+ # @return [void]
21
+ #
22
+ def run(path)
23
+ binPath = path + " -s --pullRequest"
24
+ output = `#{binPath}`
25
+ html = output.sub("\n", "<br>")
26
+ message(output)
27
+ end
28
+
29
+ def self.instance_name
30
+ "swiftinfo"
31
+ end
32
+ end
33
+ end
@@ -1,9 +1,9 @@
1
1
  require File.expand_path("../spec_helper", __FILE__)
2
2
 
3
3
  module Danger
4
- describe Danger::DangerSwiftinfo do
4
+ describe Danger::DangerSwiftInfo do
5
5
  it "should be a plugin" do
6
- expect(Danger::DangerSwiftinfo.new(nil)).to be_a Danger::Plugin
6
+ expect(Danger::DangerSwiftInfo.new(nil)).to be_a Danger::Plugin
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-SwiftInfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Rocha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-19 00:00:00.000000000 Z
11
+ date: 2021-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: open3
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: guard
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -175,13 +161,12 @@ files:
175
161
  - ".rubocop.yml"
176
162
  - ".travis.yml"
177
163
  - Gemfile
164
+ - Gemfile.lock
178
165
  - Guardfile
179
166
  - LICENSE.txt
180
167
  - README.md
181
168
  - Rakefile
182
169
  - danger-SwiftInfo.gemspec
183
- - lib/SwiftInfo/gem_version.rb
184
- - lib/SwiftInfo/plugin.rb
185
170
  - lib/danger_SwiftInfo.rb
186
171
  - lib/danger_plugin.rb
187
172
  - spec/SwiftInfo_spec.rb
@@ -1,3 +0,0 @@
1
- module SwiftInfo
2
- VERSION = "0.0.1".freeze
3
- end
@@ -1,27 +0,0 @@
1
- require "open3"
2
-
3
- module Danger
4
- # Runs SwiftInfo and prints the results to the pull request.
5
- # You must have [SwiftInfo](https://github.com/rockbruno/SwiftInfo) installed
6
- # somewhere in your project.
7
- # You can detect that SwiftInfo is running specifically for Danger
8
- # by adding a `if isInPullRequestMode` condition in your Infofile.
9
- # You can use it to extract different rules and prevent saving the new output.
10
- # @example Run SwiftInfo
11
- #
12
- # SwiftInfo.run './Pods/SwiftInfo/bin/swiftinfo'
13
- #
14
- # @see Bruno Rocha/danger-SwiftInfo
15
- # @tags swift, xcode, swiftinfo, ios
16
- #
17
- class DangerSwiftInfo < Plugin
18
- # Run SwiftInfo and print the results to the PR.
19
- # @param [String] path Path to the SwiftInfo binary.
20
- # @return [void]
21
- #
22
- def run(path)
23
- stdout, stderr, status = Open3.capture3(path + " -pullRequest -s")
24
- message(stdout)
25
- end
26
- end
27
- end