danger-iblinter 0.0.1 → 0.0.2
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/.travis.yml +1 -3
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/danger-iblinter.gemspec +1 -1
- data/lib/iblinter/gem_version.rb +2 -2
- data/lib/iblinter/iblinter.rb +3 -2
- data/lib/iblinter/plugin.rb +12 -4
- data/spec/iblinter_spec.rb +2 -2
- data/spec/plugin_spec.rb +3 -3
- 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: aa96840e7a75d39b61f6752ecc22aae644507303a7d11e2e8947f29bef446c76
|
4
|
+
data.tar.gz: e806d6bd3b8f9e1d278ad78f538e01f9c643910575b1a2e06a7ed843a293029e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf6b3764524e7a6db35f0536a20438d6bd437f5008d815dc907bdcaf974f413320104dc8f3ecead27cdfc06e97fbc51f10eb2acba5aaa48e9ec4ba677ffc3da
|
7
|
+
data.tar.gz: 01bd524e489a2f76b22894b2f65b5b8a243d3a081fef2ffe078326a5b8f2d46dcd61550b33dc0f0969ae695b160c1fad43f6214bb5b68a814c7476ec0edbed57
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# Danger IBLinter
|
2
2
|
|
3
|
+
[](https://travis-ci.org/IBDecodable/danger-ruby-iblinter)
|
4
|
+
|
3
5
|
A danger plugin for IBLinter.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
```ruby
|
8
|
-
gem 'danger-
|
10
|
+
gem 'danger-iblinter'
|
9
11
|
```
|
10
12
|
|
11
13
|
This plugin requires `iblinter` executable binary.
|
data/danger-iblinter.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'iblinter/gem_version.rb'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'danger-iblinter'
|
8
|
-
spec.version =
|
8
|
+
spec.version = Iblinter::VERSION
|
9
9
|
spec.authors = ['Yuta Saito']
|
10
10
|
spec.email = ['kateinoigakukun@gmail.com']
|
11
11
|
spec.description = %q{A danger plugin for linting Interface Builder files with IBLinter.}
|
data/lib/iblinter/gem_version.rb
CHANGED
data/lib/iblinter/iblinter.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class
|
3
|
+
class IBLinterRunner
|
4
4
|
def initialize(binary_path)
|
5
5
|
@binary_path = binary_path
|
6
6
|
end
|
@@ -10,8 +10,9 @@ class IBLinter
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def lint(path, options)
|
13
|
+
command = lint_command(options)
|
13
14
|
Dir.chdir path
|
14
|
-
JSON.parse(run(
|
15
|
+
JSON.parse(run(command))
|
15
16
|
end
|
16
17
|
|
17
18
|
def lint_command(options)
|
data/lib/iblinter/plugin.rb
CHANGED
@@ -14,7 +14,7 @@ module Danger
|
|
14
14
|
# @see IBDecodable/IBLinter
|
15
15
|
# @tags swift
|
16
16
|
#
|
17
|
-
class
|
17
|
+
class DangerIblinter < Plugin
|
18
18
|
# The path to IBLinter"s execution
|
19
19
|
# @return [void]
|
20
20
|
attr_accessor :binary_path
|
@@ -23,7 +23,7 @@ module Danger
|
|
23
23
|
# @return [void]
|
24
24
|
#
|
25
25
|
def lint(path = Dir.pwd, fail_on_warning: false, inline_mode: true, options: {})
|
26
|
-
raise "iblinter is not installed" unless
|
26
|
+
raise "iblinter is not installed" unless iblinter_installed?
|
27
27
|
|
28
28
|
issues = iblinter.lint(path, options)
|
29
29
|
return if issues.empty?
|
@@ -49,13 +49,21 @@ module Danger
|
|
49
49
|
end
|
50
50
|
|
51
51
|
# Instantiate iblinter
|
52
|
-
# @return [
|
52
|
+
# @return [IBLinterRunner]
|
53
53
|
def iblinter
|
54
|
-
|
54
|
+
IBLinterRunner.new(@binary_path)
|
55
55
|
end
|
56
56
|
|
57
57
|
private
|
58
58
|
|
59
|
+
def iblinter_installed?
|
60
|
+
if !@binary_path.nil? && File.exist?(@binary_path)
|
61
|
+
return true
|
62
|
+
end
|
63
|
+
|
64
|
+
!`which iblinter`.empty?
|
65
|
+
end
|
66
|
+
|
59
67
|
def markdown_issues(results, heading, emoji)
|
60
68
|
message = "#### #{heading}\n\n"
|
61
69
|
|
data/spec/iblinter_spec.rb
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
require File.expand_path("spec_helper", __dir__)
|
4
4
|
require_relative "../lib/iblinter/iblinter"
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe IBLinterRunner do
|
7
7
|
it "command arguments works" do
|
8
8
|
binary_path = File.absolute_path "path/to/binary"
|
9
9
|
options = {}
|
10
10
|
cmd = "#{binary_path} lint --reporter json"
|
11
|
-
iblinter =
|
11
|
+
iblinter = IBLinterRunner.new(binary_path)
|
12
12
|
expect(iblinter.lint_command(options)).to eq cmd
|
13
13
|
end
|
14
14
|
end
|
data/spec/plugin_spec.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
require File.expand_path("spec_helper", __dir__)
|
4
4
|
|
5
5
|
module Danger
|
6
|
-
describe Danger::
|
6
|
+
describe Danger::DangerIblinter do
|
7
7
|
it "should be a plugin" do
|
8
|
-
expect(Danger::
|
8
|
+
expect(Danger::DangerIblinter.new(nil)).to be_a Danger::Plugin
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "with Dangerfile" do
|
@@ -20,7 +20,7 @@ module Danger
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "inline comment works with relative path" do
|
23
|
-
linter =
|
23
|
+
linter = IBLinterRunner.new("/path/to/binary")
|
24
24
|
allow(linter).to receive(:lint) do
|
25
25
|
JSON.parse(File.read(File.dirname(__FILE__) + "/support/fixtures/iblinter.json"))
|
26
26
|
end
|