danger-SwiftInfo 0.0.3 → 0.0.4
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/Gemfile.lock +1 -1
- data/README.md +41 -7
- data/lib/danger_SwiftInfo.rb +1 -1
- data/lib/danger_plugin.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad09bccb0604f6885f6263b62e68e8321766f3d9855ea875692913acc67e5c01
|
4
|
+
data.tar.gz: '09b97e63b9180bdf6731542a36819d13ca72c0533a04b8bc5815ce5351b5d14a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f20e40f9a0ee0772d8f9b2a029359f2fa3ca90e1aeff83ab6508476f078a36dc3e9826457b8d3b3e1538a6a883c3e8adf3ef58e97f00b9ba00a337b2254de3c
|
7
|
+
data.tar.gz: e6ccc788b68450fff44b0996e95c4ceb98b92eb69538f0b4511d09df7b974aca90192e3b743e4de5c4e5a46221faf5b77416fdbdc23e276efd721caeffaa653a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,17 +1,51 @@
|
|
1
1
|
# danger-SwiftInfo
|
2
2
|
|
3
|
-
A
|
3
|
+
A [Danger](http://danger.systems/) plugin that runs and prints [SwiftInfo](https://github.com/rockbruno/SwiftInfo) results to pull requests.
|
4
4
|
|
5
|
-
|
5
|
+
Requires SwiftInfo 2.3.1 or newer.
|
6
6
|
|
7
|
-
|
7
|
+
### How does it look?
|
8
8
|
|
9
|
-
|
9
|
+
<img src="https://i.imgur.com/8kvEx5O.png">
|
10
10
|
|
11
|
-
|
12
|
-
your `Dangerfile` under the `SwiftInfo` namespace.
|
11
|
+
### Installation
|
13
12
|
|
14
|
-
|
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.
|
data/lib/danger_SwiftInfo.rb
CHANGED
data/lib/danger_plugin.rb
CHANGED
@@ -6,12 +6,12 @@ module Danger
|
|
6
6
|
# somewhere in your project.
|
7
7
|
# You can detect that SwiftInfo is running specifically for Danger
|
8
8
|
# by adding a `if isInPullRequestMode` condition in your Infofile.
|
9
|
-
# You can use
|
9
|
+
# You can use this condition to extract different rules and prevent saving the new output.
|
10
10
|
# @example Run SwiftInfo
|
11
11
|
#
|
12
|
-
#
|
12
|
+
# swiftinfo.run './Pods/SwiftInfo/bin/swiftinfo'
|
13
13
|
#
|
14
|
-
# @see
|
14
|
+
# @see rockbruno/danger-SwiftInfo
|
15
15
|
# @tags swift, xcode, swiftinfo, ios
|
16
16
|
#
|
17
17
|
class DangerSwiftInfo < Plugin
|
@@ -20,8 +20,10 @@ module Danger
|
|
20
20
|
# @return [void]
|
21
21
|
#
|
22
22
|
def run(path)
|
23
|
-
|
24
|
-
|
23
|
+
binPath = path
|
24
|
+
output = `#{binPath} -pullRequest -s`
|
25
|
+
html = output.sub("\n", "<br>")
|
26
|
+
message(output)
|
25
27
|
end
|
26
28
|
|
27
29
|
def self.instance_name
|
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.
|
4
|
+
version: 0.0.4
|
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-
|
11
|
+
date: 2019-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|