danger-pronto 0.2.1 → 0.3.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 +4 -4
- data/README.md +5 -6
- data/lib/danger_pronto/gem_version.rb +1 -1
- data/lib/danger_pronto/plugin.rb +10 -34
- 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: de661477eafe79f51a9b06ec0ad7b89337624606
|
4
|
+
data.tar.gz: d69d88f8bc211fba154640b07378a93af78fd5b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88c82a97f3e5db4a5bc4a73deaf7b6df9e54eefda73ada373cb46b86f81c6478774932339bb6ff74c7a1f7a3c1f9361b3cb08de5d86d7667394be69d5cea82c3
|
7
|
+
data.tar.gz: 857269cbfce5421a0c3e36711f6d4b5b14e558c33e617160dbc8f9aeda6f13dfab1cd08d4fe3652d70d0a97c89688b828f5f435f3645f5812e1c79542edbe461
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ gem 'pronto-scss'
|
|
25
25
|
|
26
26
|
## Usage
|
27
27
|
|
28
|
-
|
28
|
+
Pronto runs the checks on a diff between the current HEAD and the provided commit-ish (default is master).
|
29
29
|
Results are passed out as a table in markdown.
|
30
30
|
|
31
31
|
|
@@ -34,18 +34,17 @@ Specifying custom config file.
|
|
34
34
|
pronto.lint
|
35
35
|
```
|
36
36
|
|
37
|
-
|
37
|
+
Run checks on a diff between the current HEAD and a specified commit
|
38
38
|
```ruby
|
39
|
-
|
40
|
-
pronto.lint public_files
|
39
|
+
pronto.lint("e757913")
|
41
40
|
```
|
42
41
|
|
43
42
|
#### Methods
|
44
43
|
|
45
44
|
|
46
|
-
`lint(
|
45
|
+
`lint(commit: String)`
|
47
46
|
|
48
|
-
Runs
|
47
|
+
Runs checks on a diff between the current HEAD and the provided commit-ish (default is master). Generates a `markdown` list of warnings.
|
49
48
|
|
50
49
|
|
51
50
|
|
data/lib/danger_pronto/plugin.rb
CHANGED
@@ -14,41 +14,26 @@ module Danger
|
|
14
14
|
class DangerPronto < Plugin
|
15
15
|
|
16
16
|
# Runs files through Pronto. Generates a `markdown` list of warnings.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# run though, defaults to nil. If nil, modified and added files from
|
21
|
-
# the diff will be used.
|
22
|
-
# @return [void]
|
23
|
-
#
|
24
|
-
def lint(files = nil)
|
25
|
-
files_to_lint = fetch_files_to_lint(files)
|
17
|
+
def lint(commit = nil)
|
18
|
+
files = pronto(commit)
|
19
|
+
return if files.empty?
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
markdown offenses_message(offending_files)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Gets the offending files from pronto
|
33
|
-
# @return [Array<Object>] Array of pronto warnings
|
34
|
-
def offending_files(files = nil)
|
35
|
-
files_to_lint = fetch_files_to_lint(files)
|
36
|
-
pronto(files_to_lint)
|
21
|
+
markdown offenses_message(files)
|
37
22
|
end
|
38
23
|
|
39
24
|
private
|
40
25
|
|
41
26
|
# Executes pronto command
|
42
|
-
#
|
43
|
-
# @param [Array<String>] files_to_lint
|
27
|
+
# @param commit [String] hash/branch/tag
|
44
28
|
# @return [Hash] Converted hash from pronto json output
|
45
|
-
|
46
|
-
|
47
|
-
|
29
|
+
def pronto(specified_commit = nil)
|
30
|
+
commit = "origin/master"
|
31
|
+
commit = specified_commit if specified_commit.present?
|
32
|
+
pronto_output = `#{'bundle exec ' if File.exists?('Gemfile')}pronto run -f json -c #{commit}`
|
48
33
|
JSON.parse(pronto_output)
|
49
34
|
end
|
50
35
|
|
51
|
-
# Builds the
|
36
|
+
# Builds the message
|
52
37
|
def offenses_message(offending_files)
|
53
38
|
require 'terminal-table'
|
54
39
|
|
@@ -62,14 +47,5 @@ module Danger
|
|
62
47
|
).to_s
|
63
48
|
message + table.split("\n")[1..-2].join("\n")
|
64
49
|
end
|
65
|
-
|
66
|
-
# Sets default files to modified and added files per commit
|
67
|
-
# @param [Array<String>] files Optional specific files to lint
|
68
|
-
#
|
69
|
-
# @return [Array<String>] Final files to lint
|
70
|
-
#
|
71
|
-
def fetch_files_to_lint(files = nil)
|
72
|
-
@files_to_lint ||= (files ? Dir.glob(files) : (git.modified_files + git.added_files))
|
73
|
-
end
|
74
50
|
end
|
75
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-pronto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RestlessThinker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|