danger-apple_swift_format 0.0.2 → 0.0.3
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/Dangerfile +1 -1
- data/Gemfile.lock +4 -4
- data/lib/swift_format/gem_version.rb +1 -1
- data/lib/swift_format/plugin.rb +14 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 494d23e2c6ae28b259433709e1fdcea4030dc310f5f9825fc3beeabb93b91db6
|
|
4
|
+
data.tar.gz: ca2e3a6cadcf6eaceaa8aea8e1f31f8f31a3594ec58a3cceffe7e49229973725
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bdf198c8c6c896ae75ed41e04ff7d577edebe329fda3b8c69702ad800576210486dd74ce2c9aecd31ab579070cdfcb982519c65f35368d3812da70cd9e52b1ca
|
|
7
|
+
data.tar.gz: 8df1be375aac78caaf4e3c5597ca2339b897cee9a568d23bf482d40e0c8f04da1b750fe223a354e31ac2327761ec245f45ca44aac84fd6a8df3a45e50ea6ebaf
|
data/Dangerfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
danger-apple_swift_format (0.0.
|
|
4
|
+
danger-apple_swift_format (0.0.3)
|
|
5
5
|
danger-plugin-api (~> 1.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -19,7 +19,7 @@ GEM
|
|
|
19
19
|
colored2 (3.1.2)
|
|
20
20
|
cork (0.3.0)
|
|
21
21
|
colored2 (~> 3.1)
|
|
22
|
-
danger (8.0.
|
|
22
|
+
danger (8.0.5)
|
|
23
23
|
claide (~> 1.0)
|
|
24
24
|
claide-plugins (>= 0.9.2)
|
|
25
25
|
colored2 (~> 3.1)
|
|
@@ -27,7 +27,7 @@ GEM
|
|
|
27
27
|
faraday (>= 0.9.0, < 2.0)
|
|
28
28
|
faraday-http-cache (~> 2.0)
|
|
29
29
|
git (~> 1.7)
|
|
30
|
-
kramdown (~> 2.
|
|
30
|
+
kramdown (~> 2.3)
|
|
31
31
|
kramdown-parser-gfm (~> 1.0)
|
|
32
32
|
no_proxy_fix
|
|
33
33
|
octokit (~> 4.7)
|
|
@@ -83,7 +83,7 @@ GEM
|
|
|
83
83
|
pry (0.13.1)
|
|
84
84
|
coderay (~> 1.1)
|
|
85
85
|
method_source (~> 1.0)
|
|
86
|
-
public_suffix (4.0.
|
|
86
|
+
public_suffix (4.0.6)
|
|
87
87
|
rainbow (3.0.0)
|
|
88
88
|
rake (10.5.0)
|
|
89
89
|
rb-fsevent (0.10.4)
|
data/lib/swift_format/plugin.rb
CHANGED
|
@@ -29,7 +29,7 @@ module Danger
|
|
|
29
29
|
# @return [Array<String>]
|
|
30
30
|
#
|
|
31
31
|
def lint(files)
|
|
32
|
-
o, e, s = Open3.capture3("#{binary_path} lint -r --configuration #{configuration} #{files}")
|
|
32
|
+
o, e, s = Open3.capture3("#{binary_path} lint -r --configuration #{configuration} #{target_file(files)}")
|
|
33
33
|
return if e == ''
|
|
34
34
|
warn e
|
|
35
35
|
end
|
|
@@ -40,9 +40,21 @@ module Danger
|
|
|
40
40
|
def format(files, in_place = false)
|
|
41
41
|
in_place_option = "-i"
|
|
42
42
|
in_place_option = '' if !in_place
|
|
43
|
-
o, e, s = Open3.capture3("#{binary_path} format -r #{in_place_option} --configuration #{configuration} #{files}")
|
|
43
|
+
o, e, s = Open3.capture3("#{binary_path} format -r #{in_place_option} --configuration #{configuration} #{target_file(files)}")
|
|
44
44
|
return if e == ''
|
|
45
45
|
warn e
|
|
46
46
|
end
|
|
47
|
+
|
|
48
|
+
def target_file(files)
|
|
49
|
+
target_files = []
|
|
50
|
+
|
|
51
|
+
if files.instance_of?(Array)
|
|
52
|
+
target_files = files
|
|
53
|
+
elsif files.instance_of?(String)
|
|
54
|
+
target_files = files.split(' ')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
target_files.select { |f| f.include? '.swift' } .join(' ')
|
|
58
|
+
end
|
|
47
59
|
end
|
|
48
60
|
end
|