danger-swiftlint 0.24.5 → 0.25.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/ext/swiftlint/swiftlint.rb +10 -3
- data/lib/version.rb +1 -1
- data/spec/swiftlint_spec.rb +15 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2acb2fde07b59fcb04f29d9e82eb3a9d195ab4af4116defcde1ea77c8ba1df26
|
4
|
+
data.tar.gz: 89ee290c7e49090017c7f74b2a618ffd970a41f57fe470682de55fd7ad39b2da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5460d0a048ea06577fffc36b312811a0e545fd661706b322fa7a0f9e35900388b975363d1e7b2d54175e8f333c84e1254f5d1ecc7b436ceb2e9491713af48ca
|
7
|
+
data.tar.gz: 5f6791e6f7a700c7a1be573b032615d8db75acb313d9c775296048e30a4e0aadec6e39c12533c7ccd1bb1d1d802b2a590c5ef2c005a6aa3a335177f3b3d497ba
|
data/ext/swiftlint/swiftlint.rb
CHANGED
@@ -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
|
12
|
-
|
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
|
-
|
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
data/spec/swiftlint_spec.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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.
|