danger-apple_swift_format 0.0.1 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 561e8ad0a49cf464e7f6bbbf4531cc35b983e326ea44d21644cdc30b8fed22a1
4
- data.tar.gz: 6214431e91381f66b10e61c041ccb30c8dff1a5336fd6dcb445a51833bbf9811
3
+ metadata.gz: e638987182669cca87e56b05f1d075d3e215948bd45da2c1eeffcda15df7afc6
4
+ data.tar.gz: 83a3d1dfb4dd397b3d4280bd4d48b7e7d57d16b11f7db834912bc0f8303722cb
5
5
  SHA512:
6
- metadata.gz: dd3a2a932bd63b910270e01b7148f647e5e329038988d9a7062e75f7da0688d0b8db0cc91c47be27a5805fd0fdbd14343d34d84f06ba63086fab6462edaad198
7
- data.tar.gz: e062c88f29d444afd6cf0b3fac04d4cded5eadd2524072d1b16f2f342bffebee952cd3dee2ec62b0523f1ce4b9cfc31920e44e3b8b329345fb1838d1085df72d
6
+ metadata.gz: f57e5696aa25c269ca849f5ba795bbe07c2708a3407eff0d072ae3cc2bb38224a225131505b9202daf29f8f0f4b8ca84da45c3d485d77000a1e27c24248c9d0a
7
+ data.tar.gz: 48ece3cdd17cb8e83bee7a63b5e1bcf5fa3852509cd6eed2af6c2588175373c8e87ef497190eb8f76eb39c8d67f4a0a18af953ce0f12503c6dfae581b1021ca8
@@ -0,0 +1 @@
1
+ 2.6.6
data/Dangerfile CHANGED
@@ -1,3 +1,4 @@
1
1
  swift_format.binary_path = ".build/x86_64-apple-macosx/release/swift-format"
2
2
  swift_format.configuration = "swift-format.json"
3
- swift_format.lint("example/example.swift")
3
+ swift_format.lint(["example/example.swift", "Dangerfile"])
4
+ swift_format.format(["example/example.swift", "Dangerfile"])
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-apple_swift_format (0.0.1)
4
+ danger-apple_swift_format (0.0.6)
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.4)
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.0)
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.5)
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)
@@ -1,3 +1,3 @@
1
1
  module SwiftFormat
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.0.6".freeze
3
3
  end
@@ -29,20 +29,37 @@ 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
+ target = target_file(files)
33
+ return if target.empty?
34
+
35
+ o, e, s = Open3.capture3("#{binary_path} lint -r --configuration #{configuration} #{target}")
33
36
  return if e == ''
34
- markdown e
37
+ warn e
35
38
  end
36
39
 
37
40
  # run swift-format format
38
41
  # @return [Array<String>]
39
42
  #
40
- def format(files, in_place = false)
41
- in_place_option = "-i"
42
- in_place_option = '' if !in_place
43
- o, e, s = Open3.capture3("#{binary_path} format -r #{in_place_option} --configuration #{configuration} #{files}")
44
- return if e == ''
45
- markdown e
43
+ def format(files)
44
+ target = target_file(files)
45
+ return if target.empty?
46
+
47
+ `#{binary_path} format -r -i --configuration #{configuration} #{target}`
48
+ o, e, s = Open3.capture3("git diff #{target}")
49
+ return if o == ''
50
+ warn "```\n#{o}\n```"
51
+ end
52
+
53
+ def target_file(files)
54
+ target_files = []
55
+
56
+ if files.instance_of?(String)
57
+ target_files = files.split(' ')
58
+ else
59
+ target_files = files
60
+ end
61
+
62
+ target_files.select { |f| f.include? '.swift' } .join(' ')
46
63
  end
47
64
  end
48
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-apple_swift_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaito watanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-03 00:00:00.000000000 Z
11
+ date: 2020-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api
@@ -159,6 +159,7 @@ extra_rdoc_files: []
159
159
  files:
160
160
  - ".gitignore"
161
161
  - ".rubocop.yml"
162
+ - ".ruby-version"
162
163
  - ".travis.yml"
163
164
  - Dangerfile
164
165
  - Gemfile