danger-clorox 1.1.0 → 2.0.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/Gemfile.lock +16 -25
- data/README.md +19 -4
- data/lib/danger_plugin.rb +33 -13
- data/lib/version.rb +1 -1
- data/spec/danger_plugin_spec.rb +7 -13
- 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: bcfffed4c624b73d0ec58add18053a632d824401
|
4
|
+
data.tar.gz: 97562affdde80593b4043a12890aa69fa30e8a48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6897dff5b4a63685f4683ba1aa2069e843741e2580f4efe035c96d7fe49afbcc14a908efe508d3f483e5d8227c3b54b0074e538f46c20552efe4c5d50a26ce2
|
7
|
+
data.tar.gz: 66d793d805aa96f2de1b8ce1c11d136617c5386ce0b1eda93d4d33cf2dd970a38a293feb1619043aea76ac07d0b82b8209525c4cd911f298d14380049390ce23
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-clorox (
|
4
|
+
danger-clorox (2.0.0)
|
5
5
|
danger
|
6
6
|
|
7
7
|
GEM
|
@@ -9,8 +9,8 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
addressable (2.4.0)
|
11
11
|
bacon (1.2.0)
|
12
|
-
claide (1.0.
|
13
|
-
claide-plugins (0.9.
|
12
|
+
claide (1.0.1)
|
13
|
+
claide-plugins (0.9.2)
|
14
14
|
cork
|
15
15
|
nap
|
16
16
|
open4 (~> 1.3)
|
@@ -18,15 +18,14 @@ GEM
|
|
18
18
|
colored (1.2)
|
19
19
|
cork (0.2.0)
|
20
20
|
colored (~> 1.2)
|
21
|
-
danger (
|
21
|
+
danger (4.0.0)
|
22
22
|
claide (~> 1.0)
|
23
|
-
claide-plugins (
|
23
|
+
claide-plugins (>= 0.9.2)
|
24
24
|
colored (~> 1.2)
|
25
25
|
cork (~> 0.1)
|
26
26
|
faraday (~> 0.9)
|
27
27
|
faraday-http-cache (~> 1.0)
|
28
28
|
git (~> 1)
|
29
|
-
gitlab (~> 3.7.0)
|
30
29
|
kramdown (~> 1.5)
|
31
30
|
octokit (~> 4.2)
|
32
31
|
terminal-table (~> 1)
|
@@ -35,12 +34,9 @@ GEM
|
|
35
34
|
multipart-post (>= 1.2, < 3)
|
36
35
|
faraday-http-cache (1.3.1)
|
37
36
|
faraday (~> 0.8)
|
38
|
-
ffi (1.9.
|
37
|
+
ffi (1.9.14)
|
39
38
|
formatador (0.2.5)
|
40
39
|
git (1.3.0)
|
41
|
-
gitlab (3.7.0)
|
42
|
-
httparty (~> 0.13.0)
|
43
|
-
terminal-table
|
44
40
|
guard (2.14.0)
|
45
41
|
formatador (>= 0.2.4)
|
46
42
|
listen (>= 2.7, < 4.0)
|
@@ -51,14 +47,10 @@ GEM
|
|
51
47
|
shellany (~> 0.0)
|
52
48
|
thor (>= 0.18.1)
|
53
49
|
guard-compat (1.2.1)
|
54
|
-
guard-rspec (4.7.
|
50
|
+
guard-rspec (4.7.3)
|
55
51
|
guard (~> 2.1)
|
56
52
|
guard-compat (~> 1.1)
|
57
53
|
rspec (>= 2.99.0, < 4.0)
|
58
|
-
httparty (0.13.7)
|
59
|
-
json (~> 1.8)
|
60
|
-
multi_xml (>= 0.5.2)
|
61
|
-
json (1.8.3)
|
62
54
|
kramdown (1.12.0)
|
63
55
|
listen (3.0.7)
|
64
56
|
rb-fsevent (>= 0.9.3)
|
@@ -66,35 +58,34 @@ GEM
|
|
66
58
|
lumberjack (1.0.10)
|
67
59
|
metaclass (0.0.4)
|
68
60
|
method_source (0.8.2)
|
69
|
-
mocha (1.1
|
61
|
+
mocha (1.2.1)
|
70
62
|
metaclass (~> 0.0.1)
|
71
63
|
mocha-on-bacon (0.2.2)
|
72
64
|
mocha (>= 0.13.0)
|
73
|
-
multi_xml (0.5.5)
|
74
65
|
multipart-post (2.0.0)
|
75
66
|
nap (1.1.0)
|
76
67
|
nenv (0.3.0)
|
77
|
-
notiffany (0.1.
|
68
|
+
notiffany (0.1.1)
|
78
69
|
nenv (~> 0.1)
|
79
70
|
shellany (~> 0.0)
|
80
|
-
octokit (4.
|
71
|
+
octokit (4.4.1)
|
81
72
|
sawyer (~> 0.7.0, >= 0.5.3)
|
82
73
|
open4 (1.3.4)
|
83
74
|
prettybacon (0.0.2)
|
84
75
|
bacon (~> 1.2)
|
85
|
-
pry (0.10.
|
76
|
+
pry (0.10.4)
|
86
77
|
coderay (~> 1.1.0)
|
87
78
|
method_source (~> 0.8.1)
|
88
79
|
slop (~> 3.4)
|
89
80
|
rake (10.5.0)
|
90
|
-
rb-fsevent (0.9.
|
81
|
+
rb-fsevent (0.9.8)
|
91
82
|
rb-inotify (0.9.7)
|
92
83
|
ffi (>= 0.5.0)
|
93
84
|
rspec (3.5.0)
|
94
85
|
rspec-core (~> 3.5.0)
|
95
86
|
rspec-expectations (~> 3.5.0)
|
96
87
|
rspec-mocks (~> 3.5.0)
|
97
|
-
rspec-core (3.5.
|
88
|
+
rspec-core (3.5.4)
|
98
89
|
rspec-support (~> 3.5.0)
|
99
90
|
rspec-expectations (3.5.0)
|
100
91
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -108,10 +99,10 @@ GEM
|
|
108
99
|
faraday (~> 0.8, < 0.10)
|
109
100
|
shellany (0.0.1)
|
110
101
|
slop (3.6.0)
|
111
|
-
terminal-table (1.7.
|
112
|
-
unicode-display_width (~> 1.1)
|
102
|
+
terminal-table (1.7.3)
|
103
|
+
unicode-display_width (~> 1.1.1)
|
113
104
|
thor (0.19.1)
|
114
|
-
unicode-display_width (1.1.
|
105
|
+
unicode-display_width (1.1.1)
|
115
106
|
|
116
107
|
PLATFORMS
|
117
108
|
ruby
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://circleci.com/gh/barbosa/danger-clorox)
|
2
|
+
|
1
3
|
# Danger Clorox
|
2
4
|
|
3
5
|
A [Danger](https://github.com/danger/danger) plugin for [Clorox](https://github.com/barbosa/clorox) that runs on macOS.
|
@@ -12,16 +14,29 @@ gem 'danger-clorox'
|
|
12
14
|
|
13
15
|
## Usage
|
14
16
|
|
15
|
-
|
17
|
+
### Basic
|
18
|
+
|
19
|
+
Add the following line to your Danger file to check files inside the current directory:
|
20
|
+
```rb
|
21
|
+
clorox.check
|
22
|
+
```
|
23
|
+
|
24
|
+
### Advanced
|
25
|
+
|
26
|
+
Specify the directories where you want to run the script:
|
27
|
+
```rb
|
28
|
+
clorox.check ["YourProject", "YourProjectNotificationExtension"]
|
29
|
+
```
|
16
30
|
|
31
|
+
Set the script level so it displays failures/warnings in the specific markdown table
|
17
32
|
```rb
|
18
|
-
clorox.
|
19
|
-
clorox.
|
33
|
+
clorox.level = "failure"
|
34
|
+
clorox.check ["YourProject", "YourProjectNotificationExtension"]
|
20
35
|
```
|
21
36
|
|
22
37
|
## Attribution
|
23
38
|
|
24
|
-
Original structure, sequence, and organization of repo taken from [danger-prose](https://github.com/dbgrandi/danger-prose) by [David Grandinetti](https://github.com/dbgrandi/).
|
39
|
+
Original structure, sequence, and organization of repo taken from [danger-prose](https://github.com/dbgrandi/danger-prose) by [David Grandinetti](https://github.com/dbgrandi/) and [danger-swiftlint](https://github.com/ashfurrow/danger-swiftlint) by [Ash Furrow](https://github.com/ashfurrow/).
|
25
40
|
|
26
41
|
## License
|
27
42
|
|
data/lib/danger_plugin.rb
CHANGED
@@ -1,20 +1,44 @@
|
|
1
1
|
module Danger
|
2
2
|
|
3
3
|
|
4
|
+
# Checks the presence of Xcode file headers.
|
5
|
+
# This is done using the [clorox](https://pypi.python.org/pypi/clorox) python egg.
|
6
|
+
# Results are passed out as a list in markdown.
|
7
|
+
#
|
8
|
+
# @example Running clorox from current directory
|
9
|
+
#
|
10
|
+
# # clorox.check_files
|
11
|
+
#
|
12
|
+
# @example Running clorox from specific directories
|
13
|
+
#
|
14
|
+
# clorox.directories = ["MyApp", "MyAppTests", "MyAppExtension"]
|
15
|
+
# clorox.check_files
|
16
|
+
#
|
17
|
+
# @see barbosa/danger-clorox
|
18
|
+
# @tags xcode, clorox, comments
|
19
|
+
#
|
4
20
|
class DangerClorox < Plugin
|
5
21
|
|
6
22
|
ROOT_DIR = "/tmp/danger_clorox"
|
7
23
|
EXECUTABLE = "#{ROOT_DIR}/clorox/clorox.py"
|
8
24
|
|
9
|
-
|
10
|
-
|
25
|
+
LEVEL_WARNING = "warning"
|
26
|
+
LEVEL_FAILURE = "failure"
|
27
|
+
|
28
|
+
# Allows you to set a level to the checker
|
29
|
+
# Possible values are "warning" and "failure"
|
30
|
+
# defaults to "warning"
|
31
|
+
#
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :level
|
11
34
|
|
12
35
|
# Checks presence of file header comments. Will fail if `clorox` cannot be installed correctly.
|
13
36
|
# Generates a `markdown` list of dirty Objective-C and Swift files
|
14
37
|
#
|
15
|
-
# @
|
38
|
+
# @param directories [Array<String>] Directories from where clorox will be run. Defaults to current dir.
|
39
|
+
# @return [void]
|
16
40
|
#
|
17
|
-
def
|
41
|
+
def check(directories=["."])
|
18
42
|
# Installs clorox if needed
|
19
43
|
system "pip install --target #{ROOT_DIR} clorox" unless clorox_installed?
|
20
44
|
|
@@ -30,16 +54,12 @@ module Danger
|
|
30
54
|
clorox_command += "--report json"
|
31
55
|
|
32
56
|
require 'json'
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
message << "Please, remove the header from the files below (those comments on the top of your file):\n\n"
|
39
|
-
result_json['files'].each do |r|
|
40
|
-
message << "- #{r}\n"
|
57
|
+
result = JSON.parse(`#{clorox_command}`)
|
58
|
+
if result['status'] == 'dirty'
|
59
|
+
result['files'].each do |file|
|
60
|
+
message = "#{file} contains Xcode's file header"
|
61
|
+
level == LEVEL_FAILURE ? fail(message) : warn(message)
|
41
62
|
end
|
42
|
-
markdown message
|
43
63
|
end
|
44
64
|
end
|
45
65
|
|
data/lib/version.rb
CHANGED
data/spec/danger_plugin_spec.rb
CHANGED
@@ -28,8 +28,7 @@ module Danger
|
|
28
28
|
@clorox_response = '{"status": "dirty", "files": ["some/path/FileA.swift", "some/path/FileB.m"]}'
|
29
29
|
allow(@clorox).to receive(:`).with("python #{Danger::DangerClorox::EXECUTABLE} --path some/dir --inspection --report json").and_return(@clorox_response)
|
30
30
|
|
31
|
-
@clorox.
|
32
|
-
@clorox.check_files
|
31
|
+
@clorox.check ["some/dir"]
|
33
32
|
end
|
34
33
|
|
35
34
|
it "handles multiple directories" do
|
@@ -38,8 +37,7 @@ module Danger
|
|
38
37
|
@clorox_response = '{"status": "dirty", "files": ["some/path/FileA.swift", "some/path/FileB.m"]}'
|
39
38
|
allow(@clorox).to receive(:`).with("python #{Danger::DangerClorox::EXECUTABLE} --path some/dir some/path --inspection --report json").and_return(@clorox_response)
|
40
39
|
|
41
|
-
@clorox.
|
42
|
-
@clorox.check_files
|
40
|
+
@clorox.check ["some/dir", "some/path"]
|
43
41
|
end
|
44
42
|
|
45
43
|
describe :check_files do
|
@@ -51,22 +49,18 @@ module Danger
|
|
51
49
|
@clorox_response = '{"status": "dirty", "files": ["some/path/FileA.swift", "some/path/FileB.m"]}'
|
52
50
|
allow(@clorox).to receive(:`).with("python #{Danger::DangerClorox::EXECUTABLE} --path some/dir --inspection --report json").and_return(@clorox_response)
|
53
51
|
|
54
|
-
@clorox.
|
55
|
-
@clorox.check_files
|
52
|
+
@clorox.check ["some/dir"]
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
expect(
|
60
|
-
expect(output).to include("- some/path/FileA.swift")
|
61
|
-
expect(output).to include("- some/path/FileB.m")
|
54
|
+
warnings = @clorox.status_report[:warnings]
|
55
|
+
expect(warnings).to include("some/path/FileA.swift contains Xcode's file header")
|
56
|
+
expect(warnings).to include("some/path/FileB.m contains Xcode's file header")
|
62
57
|
end
|
63
58
|
|
64
59
|
it 'handles a clean clorox report' do
|
65
60
|
@clorox_response = '{"status": "clean", "files": []}'
|
66
61
|
allow(@clorox).to receive(:`).with("python #{Danger::DangerClorox::EXECUTABLE} --path some/dir --inspection --report json").and_return(@clorox_response)
|
67
62
|
|
68
|
-
@clorox.
|
69
|
-
@clorox.check_files
|
63
|
+
@clorox.check ["some/dir"]
|
70
64
|
|
71
65
|
expect(@clorox.status_report[:markdowns].first).to be_nil
|
72
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-clorox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Barbosa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger
|