danger-iblinter 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +18 -15
- data/Guardfile +4 -2
- data/README.md +12 -1
- data/Rakefile +12 -10
- data/danger-iblinter.gemspec +20 -19
- data/lib/iblinter/gem_version.rb +1 -1
- data/lib/iblinter/iblinter.rb +5 -3
- data/lib/iblinter/plugin.rb +5 -2
- data/spec/iblinter_spec.rb +30 -6
- data/spec/plugin_spec.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1174cb7b79c9e8cf4f310c170b6cb6df7dc6c0ab7119ad0e10c0e0bf7035469
|
4
|
+
data.tar.gz: 6b9e62fc4fd59797506fc21e87f25d0a8be28f575486808971a15d4bd634e734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d54f31751a5846db9123bea9db564e2c918c133a0efdf3d661119f8f3cdc577539c0c4d3ca45cd6e3f9ed47251bdfde92b49bd8655f4e627286d9cb1eb22e3cc
|
7
|
+
data.tar.gz: 4ae081e70db6111c35523a8069c98ec9c33dc49e4a751433eef6f683ed557d10b2da97a9194d9673a874f68fb85deba57ca7fe6c13ba2762fbe13bf536f7a0f4
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-iblinter (0.0.
|
4
|
+
danger-iblinter (0.0.5)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
10
|
+
addressable (2.6.0)
|
11
11
|
public_suffix (>= 2.0.2, < 4.0)
|
12
12
|
ast (2.4.0)
|
13
13
|
claide (1.0.2)
|
@@ -19,15 +19,16 @@ GEM
|
|
19
19
|
colored2 (3.1.2)
|
20
20
|
cork (0.3.0)
|
21
21
|
colored2 (~> 3.1)
|
22
|
-
danger (
|
22
|
+
danger (6.0.9)
|
23
23
|
claide (~> 1.0)
|
24
24
|
claide-plugins (>= 0.9.2)
|
25
25
|
colored2 (~> 3.1)
|
26
26
|
cork (~> 0.1)
|
27
27
|
faraday (~> 0.9)
|
28
|
-
faraday-http-cache (~>
|
28
|
+
faraday-http-cache (~> 2.0)
|
29
29
|
git (~> 1.5)
|
30
|
-
kramdown (~>
|
30
|
+
kramdown (~> 2.0)
|
31
|
+
kramdown-parser-gfm (~> 1.0)
|
31
32
|
no_proxy_fix
|
32
33
|
octokit (~> 4.7)
|
33
34
|
terminal-table (~> 1)
|
@@ -36,7 +37,7 @@ GEM
|
|
36
37
|
diff-lcs (1.3)
|
37
38
|
faraday (0.15.4)
|
38
39
|
multipart-post (>= 1.2, < 3)
|
39
|
-
faraday-http-cache (
|
40
|
+
faraday-http-cache (2.0.0)
|
40
41
|
faraday (~> 0.8)
|
41
42
|
ffi (1.10.0)
|
42
43
|
formatador (0.2.5)
|
@@ -56,20 +57,22 @@ GEM
|
|
56
57
|
guard-compat (~> 1.1)
|
57
58
|
rspec (>= 2.99.0, < 4.0)
|
58
59
|
jaro_winkler (1.5.2)
|
59
|
-
kramdown (1.
|
60
|
+
kramdown (2.1.0)
|
61
|
+
kramdown-parser-gfm (1.1.0)
|
62
|
+
kramdown (~> 2.0)
|
60
63
|
listen (3.0.7)
|
61
64
|
rb-fsevent (>= 0.9.3)
|
62
65
|
rb-inotify (>= 0.9.7)
|
63
66
|
lumberjack (1.0.13)
|
64
67
|
method_source (0.9.2)
|
65
|
-
multipart-post (2.
|
68
|
+
multipart-post (2.1.1)
|
66
69
|
nap (1.1.0)
|
67
70
|
nenv (0.3.0)
|
68
71
|
no_proxy_fix (0.1.2)
|
69
72
|
notiffany (0.1.1)
|
70
73
|
nenv (~> 0.1)
|
71
74
|
shellany (~> 0.0)
|
72
|
-
octokit (4.
|
75
|
+
octokit (4.14.0)
|
73
76
|
sawyer (~> 0.8.0, >= 0.5.3)
|
74
77
|
open4 (1.3.4)
|
75
78
|
parallel (1.13.0)
|
@@ -79,7 +82,7 @@ GEM
|
|
79
82
|
pry (0.12.2)
|
80
83
|
coderay (~> 1.1.0)
|
81
84
|
method_source (~> 0.9.0)
|
82
|
-
public_suffix (3.
|
85
|
+
public_suffix (3.1.1)
|
83
86
|
rainbow (3.0.0)
|
84
87
|
rake (10.5.0)
|
85
88
|
rb-fsevent (0.10.3)
|
@@ -107,15 +110,15 @@ GEM
|
|
107
110
|
ruby-progressbar (~> 1.7)
|
108
111
|
unicode-display_width (~> 1.4.0)
|
109
112
|
ruby-progressbar (1.10.0)
|
110
|
-
sawyer (0.8.
|
111
|
-
addressable (>= 2.3.5
|
112
|
-
faraday (
|
113
|
+
sawyer (0.8.2)
|
114
|
+
addressable (>= 2.3.5)
|
115
|
+
faraday (> 0.8, < 2.0)
|
113
116
|
shellany (0.0.1)
|
114
117
|
terminal-table (1.8.0)
|
115
118
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
116
119
|
thor (0.20.3)
|
117
120
|
unicode-display_width (1.4.1)
|
118
|
-
yard (0.9.
|
121
|
+
yard (0.9.20)
|
119
122
|
|
120
123
|
PLATFORMS
|
121
124
|
ruby
|
@@ -133,4 +136,4 @@ DEPENDENCIES
|
|
133
136
|
yard
|
134
137
|
|
135
138
|
BUNDLED WITH
|
136
|
-
1.
|
139
|
+
1.17.2
|
data/Guardfile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# A guardfile for making Danger Plugins
|
2
4
|
# For more info see https://github.com/guard/guard#readme
|
3
5
|
|
4
6
|
# To run, use `bundle exec guard`.
|
5
7
|
|
6
|
-
guard :rspec, cmd:
|
7
|
-
require
|
8
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
9
|
+
require "guard/rspec/dsl"
|
8
10
|
dsl = Guard::RSpec::Dsl.new(self)
|
9
11
|
|
10
12
|
# RSpec files
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Danger IBLinter
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/IBDecodable/danger-ruby-iblinter.svg?branch=master)](https://travis-ci.org/IBDecodable/danger-ruby-iblinter)
|
3
|
+
[![Build Status](https://travis-ci.org/IBDecodable/danger-ruby-iblinter.svg?branch=master)](https://travis-ci.org/IBDecodable/danger-ruby-iblinter) [![Gem Version](https://badge.fury.io/rb/danger-iblinter.svg)](https://badge.fury.io/rb/danger-iblinter)
|
4
4
|
|
5
5
|
A danger plugin for IBLinter.
|
6
6
|
|
@@ -19,6 +19,17 @@ iblinter.binary_path = "./Pods/IBLinter/bin/iblinter"
|
|
19
19
|
iblinter.lint("./path/to/project", fail_on_warning: true, inline_mode: true)
|
20
20
|
```
|
21
21
|
|
22
|
+
```ruby
|
23
|
+
iblinter.execute_command = "swift run iblinter"
|
24
|
+
iblinter.lint("./path/to/project", fail_on_warning: true, inline_mode: true)
|
25
|
+
```
|
26
|
+
|
27
|
+
| parameter | default |
|
28
|
+
|:---------------:|:-------:|
|
29
|
+
| fail_on_warning | false |
|
30
|
+
| inline_mode | true |
|
31
|
+
|
32
|
+
|
22
33
|
## Development
|
23
34
|
|
24
35
|
1. Clone this repo
|
data/Rakefile
CHANGED
@@ -1,23 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "rubocop/rake_task"
|
4
6
|
|
5
7
|
RSpec::Core::RakeTask.new(:specs)
|
6
8
|
|
7
9
|
task default: :specs
|
8
10
|
|
9
11
|
task :spec do
|
10
|
-
Rake::Task[
|
11
|
-
Rake::Task[
|
12
|
-
Rake::Task[
|
12
|
+
Rake::Task["specs"].invoke
|
13
|
+
Rake::Task["rubocop"].invoke
|
14
|
+
Rake::Task["spec_docs"].invoke
|
13
15
|
end
|
14
16
|
|
15
|
-
desc
|
17
|
+
desc "Run RuboCop on the lib/specs directory"
|
16
18
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
17
|
-
task.patterns = [
|
19
|
+
task.patterns = ["lib/**/*.rb", "spec/**/*.rb"]
|
18
20
|
end
|
19
21
|
|
20
|
-
desc
|
22
|
+
desc "Ensure that the plugin passes `danger plugins lint`"
|
21
23
|
task :spec_docs do
|
22
|
-
sh
|
24
|
+
sh "bundle exec danger plugins lint"
|
23
25
|
end
|
data/danger-iblinter.gemspec
CHANGED
@@ -1,42 +1,43 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require "iblinter/gem_version.rb"
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = "danger-iblinter"
|
8
9
|
spec.version = Iblinter::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
10
|
+
spec.authors = ["Yuta Saito"]
|
11
|
+
spec.email = ["kateinoigakukun@gmail.com"]
|
12
|
+
spec.description = "A danger plugin for linting Interface Builder files with IBLinter."
|
13
|
+
spec.summary = "A danger plugin for linting Interface Builder files with IBLinter."
|
14
|
+
spec.homepage = "https://github.com/IBDecodable/danger-ruby-iblinter"
|
15
|
+
spec.license = "MIT"
|
15
16
|
|
16
17
|
spec.files = `git ls-files`.split($/)
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ["lib"]
|
20
21
|
|
21
|
-
spec.add_runtime_dependency
|
22
|
+
spec.add_runtime_dependency "danger-plugin-api", "~> 1.0"
|
22
23
|
|
23
24
|
# General ruby development
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
27
|
|
27
28
|
# Testing support
|
28
|
-
spec.add_development_dependency
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
29
30
|
|
30
31
|
# Linting code and docs
|
31
32
|
spec.add_development_dependency "rubocop"
|
32
33
|
spec.add_development_dependency "yard"
|
33
34
|
|
34
35
|
# Makes testing easy via `bundle exec guard`
|
35
|
-
spec.add_development_dependency
|
36
|
-
spec.add_development_dependency
|
36
|
+
spec.add_development_dependency "guard", "~> 2.14"
|
37
|
+
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
37
38
|
|
38
39
|
# If you want to work on older builds of ruby
|
39
|
-
spec.add_development_dependency
|
40
|
+
spec.add_development_dependency "listen", "3.0.7"
|
40
41
|
|
41
42
|
# This gives you the chance to run a REPL inside your tests
|
42
43
|
# via:
|
@@ -45,5 +46,5 @@ Gem::Specification.new do |spec|
|
|
45
46
|
# binding.pry
|
46
47
|
#
|
47
48
|
# This will stop test execution and let you inspect the results
|
48
|
-
spec.add_development_dependency
|
49
|
+
spec.add_development_dependency "pry"
|
49
50
|
end
|
data/lib/iblinter/gem_version.rb
CHANGED
data/lib/iblinter/iblinter.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class IBLinterRunner
|
4
|
-
def initialize(binary_path)
|
4
|
+
def initialize(binary_path, execute_command)
|
5
5
|
@binary_path = binary_path
|
6
|
+
@execute_command = execute_command
|
6
7
|
end
|
7
8
|
|
8
9
|
def run(command)
|
@@ -16,8 +17,9 @@ class IBLinterRunner
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def lint_command(options)
|
19
|
-
|
20
|
-
"
|
20
|
+
executable = @execute_command
|
21
|
+
executable ||= @binary_path.nil? ? "iblinter" : File.absolute_path(@binary_path)
|
22
|
+
"#{executable} lint #{arguments(options.merge(reporter: 'json'))}"
|
21
23
|
end
|
22
24
|
|
23
25
|
# Parse options into shell arguments.
|
data/lib/iblinter/plugin.rb
CHANGED
@@ -18,12 +18,15 @@ module Danger
|
|
18
18
|
# The path to IBLinter"s execution
|
19
19
|
# @return [void]
|
20
20
|
attr_accessor :binary_path
|
21
|
+
attr_accessor :execute_command
|
21
22
|
|
22
23
|
# Lints IB files. Will fail if `iblinter` cannot be installed correctly.
|
23
24
|
# @return [void]
|
24
25
|
#
|
25
26
|
def lint(path = Dir.pwd, fail_on_warning: false, inline_mode: true, options: {})
|
26
|
-
|
27
|
+
unless @execute_command || iblinter_installed?
|
28
|
+
raise "iblinter is not installed"
|
29
|
+
end
|
27
30
|
|
28
31
|
issues = iblinter.lint(path, options)
|
29
32
|
return if issues.empty?
|
@@ -51,7 +54,7 @@ module Danger
|
|
51
54
|
# Instantiate iblinter
|
52
55
|
# @return [IBLinterRunner]
|
53
56
|
def iblinter
|
54
|
-
IBLinterRunner.new(@binary_path)
|
57
|
+
IBLinterRunner.new(@binary_path, @execute_command)
|
55
58
|
end
|
56
59
|
|
57
60
|
private
|
data/spec/iblinter_spec.rb
CHANGED
@@ -4,11 +4,35 @@ require File.expand_path("spec_helper", __dir__)
|
|
4
4
|
require_relative "../lib/iblinter/iblinter"
|
5
5
|
|
6
6
|
describe IBLinterRunner do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
let(:options) { {} }
|
8
|
+
let(:cmd) { "swift run iblinter lint --reporter json" }
|
9
|
+
let(:binary_path) { nil }
|
10
|
+
let(:execute_command) { nil }
|
11
|
+
let(:iblinter) { IBLinterRunner.new(binary_path, execute_command) }
|
12
|
+
|
13
|
+
context "binary_path is passed" do
|
14
|
+
let(:binary_path) { File.absolute_path "path/to/binary" }
|
15
|
+
let(:cmd) { "#{binary_path} lint --reporter json" }
|
16
|
+
|
17
|
+
it "should return valid command" do
|
18
|
+
expect(iblinter.lint_command(options)).to eq cmd
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "execute_command is passed" do
|
23
|
+
let(:execute_command) { "swift run iblinter" }
|
24
|
+
|
25
|
+
it "should return valid command" do
|
26
|
+
expect(iblinter.lint_command(options)).to eq cmd
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "binary_path and execute_command are passed" do
|
31
|
+
let(:execute_command) { "swift run iblinter" }
|
32
|
+
let(:binary_path) { File.absolute_path "path/to/binary" }
|
33
|
+
|
34
|
+
it "should ignore binary_path" do
|
35
|
+
expect(iblinter.lint_command(options)).to eq cmd
|
36
|
+
end
|
13
37
|
end
|
14
38
|
end
|
data/spec/plugin_spec.rb
CHANGED
@@ -20,7 +20,7 @@ module Danger
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "inline comment works with relative path" do
|
23
|
-
linter = IBLinterRunner.new("/path/to/binary")
|
23
|
+
linter = IBLinterRunner.new("/path/to/binary", nil)
|
24
24
|
allow(linter).to receive(:lint) do
|
25
25
|
JSON.parse(File.read(File.dirname(__FILE__) + "/support/fixtures/iblinter.json"))
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-iblinter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuta Saito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -196,8 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
- !ruby/object:Gem::Version
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
|
-
|
200
|
-
rubygems_version: 2.7.5
|
199
|
+
rubygems_version: 3.0.1
|
201
200
|
signing_key:
|
202
201
|
specification_version: 4
|
203
202
|
summary: A danger plugin for linting Interface Builder files with IBLinter.
|