danger-apple_swift_format 0.0.2 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ef06d222edf6945a8e98b8163f95a0d815ea55529ddacb20513a27ba5a94330
4
- data.tar.gz: 978a1a67f625aae479d3d0217e1569d2229f4c6b9a045b81c899e4eb3943773f
3
+ metadata.gz: 12f6813d86d9cd91182c4614e60c3501126bec35be44a9ba9a48fcde9b58cd55
4
+ data.tar.gz: ed3d2db8cb3bf73a8858ae4ff854fe90cd0d326ba328ba4b8415b70a09f46776
5
5
  SHA512:
6
- metadata.gz: c00be54edc36a103fd0b6ff8b5f7732a091a25aae24182ed24a176c12d6008167ce7ee32750efc9a692c5bcfceea4ca7926f8f4ca7f8635f4c3b8ff1a32990f8
7
- data.tar.gz: e82b7fdfb9c7fddd3a3c81267fa602e163dd007d26186a5ca19be24aa5ba59b7a9f9200404e1c265aff3b8cea405ba3e9feedf23bdebc15fea35f204365170a5
6
+ metadata.gz: e459f94dad96741abf74607b55e8134e31680acc3d8f9d97c9d67f00bcac9876df434ee36a381fcbe72c4ebbb394a81c52a11adfe76992b5889017977ccd4ab9
7
+ data.tar.gz: c62f534ef0fe819653d63e182b27743e4bccc66598ff4585b35331dbccdddd0213862955cc0d2aa8cdcd6129a425e308b54f6faea179cc642d749b9479d0e6ab
@@ -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.2)
4
+ danger-apple_swift_format (0.0.7)
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.2".freeze
2
+ VERSION = "0.0.7".freeze
3
3
  end
@@ -29,7 +29,10 @@ 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
37
  warn e
35
38
  end
@@ -37,12 +40,26 @@ module Danger
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
- warn 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 o
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.2
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaito watanabe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-14 00:00:00.000000000 Z
11
+ date: 2020-09-23 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
@@ -182,7 +183,7 @@ homepage: https://github.com/marumemomo/danger-swift_format
182
183
  licenses:
183
184
  - MIT
184
185
  metadata: {}
185
- post_install_message:
186
+ post_install_message:
186
187
  rdoc_options: []
187
188
  require_paths:
188
189
  - lib
@@ -198,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
199
  version: '0'
199
200
  requirements: []
200
201
  rubygems_version: 3.0.3
201
- signing_key:
202
+ signing_key:
202
203
  specification_version: 4
203
204
  summary: danger plugin for apple/swift-format.
204
205
  test_files: