danger-swiftlint 0.24.5 → 0.25.0

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: a35b57008bbb1fa32b8b8c156bacc1b6610c0148c9c608287d6cf7f42d172792
4
- data.tar.gz: c430570ca1990bb89e90d8b6c9fcb38e557d40e3307b4e7dc331e173bc68d2ac
3
+ metadata.gz: 2acb2fde07b59fcb04f29d9e82eb3a9d195ab4af4116defcde1ea77c8ba1df26
4
+ data.tar.gz: 89ee290c7e49090017c7f74b2a618ffd970a41f57fe470682de55fd7ad39b2da
5
5
  SHA512:
6
- metadata.gz: a276e2b26378e2b8ac740e6af1afc7430d622a3e02fda4f25eff08875149d51ee38887d30b58ff03b1356a55b0563041af2dfb7211599876023b8a56d72ffd14
7
- data.tar.gz: 601e1a6e0b8ed52863740aef8aadda2427ac10a456a3c47b8472451b4c6d7ea9710148bfd2d63770c1f8637d09372875fcce04a7fa0b843d49ce26e8f03efb51
6
+ metadata.gz: e5460d0a048ea06577fffc36b312811a0e545fd661706b322fa7a0f9e35900388b975363d1e7b2d54175e8f333c84e1254f5d1ecc7b436ceb2e9491713af48ca
7
+ data.tar.gz: 5f6791e6f7a700c7a1be573b032615d8db75acb313d9c775296048e30a4e0aadec6e39c12533c7ccd1bb1d1d802b2a590c5ef2c005a6aa3a335177f3b3d497ba
@@ -8,14 +8,21 @@ class Swiftlint
8
8
 
9
9
  # Runs swiftlint
10
10
  def run(cmd = 'lint', additional_swiftlint_args = '', options = {}, env = nil)
11
- # change pwd before run swiftlint
12
- Dir.chdir options.delete(:pwd) if options.key? :pwd
11
+ # allow for temporary change to pwd before running swiftlint
12
+ pwd = options.delete(:pwd)
13
+ command = "#{swiftlint_path} #{cmd} #{swiftlint_arguments(options, additional_swiftlint_args)}"
13
14
 
14
15
  # Add `env` to environment
15
16
  update_env(env)
16
17
  begin
17
18
  # run swiftlint with provided options
18
- `#{swiftlint_path} #{cmd} #{swiftlint_arguments(options, additional_swiftlint_args)}`
19
+ if pwd
20
+ Dir.chdir(pwd) do
21
+ `#{command}`
22
+ end
23
+ else
24
+ `#{command}`
25
+ end
19
26
  ensure
20
27
  # Remove any ENV variables we might have added
21
28
  restore_env()
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DangerSwiftlint
4
- VERSION = '0.24.5'
4
+ VERSION = '0.25.0'
5
5
  SWIFTLINT_VERSION = '0.41.0'
6
6
  end
@@ -25,9 +25,23 @@ describe Swiftlint do
25
25
  end
26
26
  end
27
27
 
28
+ it 'changes directory when a pwd option is specified' do
29
+ expect(Dir).to receive(:chdir) do |*args, &block|
30
+ expect(args).to match_array([Dir.pwd])
31
+ expect(block).not_to be_nil
32
+ end
33
+ swiftlint.run('lint', '', pwd: Dir.pwd)
34
+ end
35
+
36
+ it 'does not change directory when no pwd option is specified' do
37
+ allow(swiftlint).to receive(:`)
38
+ expect(Dir).not_to receive(:chdir)
39
+ swiftlint.run('lint', '')
40
+ end
41
+
28
42
  it 'runs lint by default with options being optional' do
29
43
  expect(swiftlint).to receive(:`).with(including('swiftlint lint'))
30
- swiftlint.run
44
+ swiftlint.run('lint', '')
31
45
  end
32
46
 
33
47
  it 'runs accepting symbolized options' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-swiftlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.5
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Furrow
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-11-10 00:00:00.000000000 Z
15
+ date: 2021-03-30 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: danger
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
182
  requirements: []
183
- rubygems_version: 3.0.3
183
+ rubygems_version: 3.1.2
184
184
  signing_key:
185
185
  specification_version: 4
186
186
  summary: A Danger plugin for linting Swift with SwiftLint.