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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0baf75368108ddea857f6488eb5ffe335684602d3b536b0c3a156ebf4e62684
4
- data.tar.gz: 9195b9a5dd0b940c822d7ff8814b5581685f8c75fe6ce243baa6d4eb8120d1fb
3
+ metadata.gz: aa96840e7a75d39b61f6752ecc22aae644507303a7d11e2e8947f29bef446c76
4
+ data.tar.gz: e806d6bd3b8f9e1d278ad78f538e01f9c643910575b1a2e06a7ed843a293029e
5
5
  SHA512:
6
- metadata.gz: 39b02ae54f23390ac9f1b16328a334c5b663c110157dfab486a6a2885ff4b4bd3fb417419e53c4f6406c493a99a65fb988da7e74b08cc28063dff380a785ab6c
7
- data.tar.gz: 58aa98104a0775d453c2f6242575e172b2266670cd5c6ea4c7975aeaa39c9f78697858dc3195ae92da8c689da79d753147526c865a951c4261c8459422b12f18
6
+ metadata.gz: cbf6b3764524e7a6db35f0536a20438d6bd437f5008d815dc907bdcaf974f413320104dc8f3ecead27cdfc06e97fbc51f10eb2acba5aaa48e9ec4ba677ffc3da
7
+ data.tar.gz: 01bd524e489a2f76b22894b2f65b5b8a243d3a081fef2ffe078326a5b8f2d46dcd61550b33dc0f0969ae695b160c1fad43f6214bb5b68a814c7476ec0edbed57
data/.travis.yml CHANGED
@@ -4,9 +4,7 @@ cache:
4
4
  - bundle
5
5
 
6
6
  rvm:
7
- - 2.0
8
- - 2.1.3
9
7
  - 2.3.1
10
8
 
11
9
  script:
12
- - bundle exec rake spec
10
+ - bundle exec rake spec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-iblinter (0.0.1)
4
+ danger-iblinter (0.0.2)
5
5
  danger-plugin-api (~> 1.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,11 +1,13 @@
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)
4
+
3
5
  A danger plugin for IBLinter.
4
6
 
5
7
  ## Installation
6
8
 
7
9
  ```ruby
8
- gem 'danger-swiftlint'
10
+ gem 'danger-iblinter'
9
11
  ```
10
12
 
11
13
  This plugin requires `iblinter` executable binary.
@@ -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 = IBLinter::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.}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module IBLinter
4
- VERSION = "0.0.1"
3
+ module Iblinter
4
+ VERSION = "0.0.2"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class IBLinter
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(lint_command(options)))
15
+ JSON.parse(run(command))
15
16
  end
16
17
 
17
18
  def lint_command(options)
@@ -14,7 +14,7 @@ module Danger
14
14
  # @see IBDecodable/IBLinter
15
15
  # @tags swift
16
16
  #
17
- class DangerIBLinter < Plugin
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 File.exist? @binary_path
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 [IBLinter]
52
+ # @return [IBLinterRunner]
53
53
  def iblinter
54
- IBLinter.new(@binary_path)
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
 
@@ -3,12 +3,12 @@
3
3
  require File.expand_path("spec_helper", __dir__)
4
4
  require_relative "../lib/iblinter/iblinter"
5
5
 
6
- describe IBLinter do
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 = IBLinter.new(binary_path)
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::DangerIBLinter do
6
+ describe Danger::DangerIblinter do
7
7
  it "should be a plugin" do
8
- expect(Danger::DangerIBLinter.new(nil)).to be_a Danger::Plugin
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 = IBLinter.new("/path/to/binary")
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-iblinter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuta Saito