pronto-textlint 0.1.0 → 0.1.5

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
- SHA1:
3
- metadata.gz: cafd58952c20097242fe9ef1af90b8476789d0da
4
- data.tar.gz: 58f713ff788d6e0259f060c6c5c64c10a141af35
2
+ SHA256:
3
+ metadata.gz: 6c134d08ea1da3fde45db94d11b933ace3322b0e5ad9c9549a7f7c0498380b6d
4
+ data.tar.gz: 382a45c252e3fac24043e93c7ce27e6f24be2f0015fcb109f15e7297c050386b
5
5
  SHA512:
6
- metadata.gz: f3d757d27137b03c37ea3b00afdd3399b813570f35078dc58943fbd06c5650d4000b5b7bad19e7d32592f7d8d8c50fa8bb1c5f639910c4308dc90c8987ab6613
7
- data.tar.gz: 9cab67e0a79d364beabf9d0906060da5961dc76339fbb5de3b632ae3dc70cebc5cbf447e5478e18b01b66c6e7391bdda5cfc37c42ba1e5d6bb1d0f56b1e86b76
6
+ metadata.gz: eac58bb51fa17b7d66760faf88ea72ee9f31eb8818df16af788e64cfd12e6149217cf3b7a5b72eea62a68914a6364c94b026a5b46a7b905b4899384ac47d6631
7
+ data.tar.gz: 6cb3b9ed59d7cb047d8e3d0fb6896ba35543e51909b8abf999035466df752647c42d96f5f9c54b3500b2f7d98f5f92791f441dcdc8c0b9e2743defc6a187f2c0
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.0
3
+ - 2.3.1
4
4
  before_install: gem install bundler -v 1.11.2
data/README.md CHANGED
@@ -1,8 +1,22 @@
1
1
  # Pronto::Textlint
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pronto/textlint`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Gem Version](https://badge.fury.io/rb/pronto-textlint.svg)](http://badge.fury.io/rb/pronto-textlint)
4
+ [![Build Status](https://travis-ci.org/seikichi/pronto-textlint.svg?branch=master)](https://travis-ci.org/seikichi/pronto-textlint)
5
+ [![Coverage Status](https://coveralls.io/repos/seikichi/pronto-textlint/badge.svg?branch=master&service=github)](https://coveralls.io/github/seikichi/pronto-textlint?branch=master)
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ [Pronto](https://github.com/mmozuras/pronto) runner for [textlint](https://github.com/textlint/textlint).
8
+
9
+ `textlint` is needed to be installed for this runner to work.
10
+
11
+ ## Configuration
12
+
13
+ Configuring textlint via `.textlintrc` will work just fine with `pronto-textlint`.
14
+
15
+ You can explicitly specify location of textlint runner by passing `PRONTO_TEXTLINT_PATH` env variable e.g:
16
+
17
+ ```bash
18
+ PRONTO_TEXTLINT_PATH=/usr/very/hidden/bin/textlint PRONTO_TEXTLINT_CONFIG_PATH=/path/to/.textlintrc pronto run --index
19
+ ```
6
20
 
7
21
  ## Installation
8
22
 
@@ -20,22 +34,18 @@ Or install it yourself as:
20
34
 
21
35
  $ gem install pronto-textlint
22
36
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
37
  ## Development
28
38
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+ After checking out the repo, run `bundle` to install dependencies. Then, run `rake test` to run the tests.
30
40
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
41
+ To install this gem onto your local machine, run `bundle exec rake install`.
42
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
43
+ which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
44
 
33
45
  ## Contributing
34
46
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pronto-textlint.
36
-
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/seikichi/pronto-textlint.
37
48
 
38
49
  ## License
39
50
 
40
51
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -1,65 +1,2 @@
1
- require 'pronto'
2
-
3
- require 'open3'
4
- require 'shellwords'
5
-
6
- module Pronto
7
- class Textlint < Runner
8
- def run
9
- return [] unless @patches
10
-
11
- @patches.select(&method(:valid_patch?))
12
- .flat_map(&method(:inspect))
13
- .compact
14
- end
15
-
16
- private
17
-
18
- def textlint_path
19
- ENV['PRONTO_TEXTLINT_PATH'] || 'textlint'
20
- end
21
-
22
- def config_path
23
- ENV['PRONTO_TEXTLINT_CONFIG_PATH'] || '.textlintrc'
24
- end
25
-
26
- def valid_patch?(patch)
27
- patch.additions > 0
28
- end
29
-
30
- def inspect(patch)
31
- output = run_textlint(patch)
32
- offences = clean_up_textlint_output(output)
33
-
34
- offences.flat_map do |offence|
35
- patch.added_lines
36
- .select { |line| line.new_lineno == offence['line'] }
37
- .map { |line| new_message(offence, line) }
38
- end
39
- end
40
-
41
- def run_textlint(patch)
42
- Dir.chdir(patch.repo.path) do
43
- path = patch.new_file_full_path.to_s
44
- command = "#{textlint_path.shellescape} -f json -c #{config_path} #{path.shellescape}"
45
- stdout, stderr, = Open3.capture3(command)
46
- puts "WARN: pronto-textlint: #{stderr}" if stderr && !stderr.empty?
47
-
48
- return [] if stdout.nil?
49
- JSON.parse(stdout)
50
- end
51
- end
52
-
53
- def new_message(offence, line)
54
- Message.new(offence['path'], line, :warning, offence['message'], nil, self.class)
55
- end
56
-
57
- def clean_up_textlint_output(output)
58
- output.flat_map do |offence|
59
- offence['messages'].map do |message|
60
- message.merge('path' => offence['filePath'])
61
- end
62
- end
63
- end
64
- end
65
- end
1
+ require_relative 'textlint/version'
2
+ require_relative 'textlint/runner'
@@ -0,0 +1,68 @@
1
+ require 'pronto'
2
+
3
+ require 'open3'
4
+ require 'shellwords'
5
+
6
+ module Pronto
7
+ module Textlint
8
+ class Runner < Pronto::Runner
9
+ def run
10
+ return [] unless @patches
11
+
12
+ @patches.select(&method(:valid_patch?))
13
+ .flat_map(&method(:inspect))
14
+ .compact
15
+ end
16
+
17
+ private
18
+
19
+ def textlint_path
20
+ ENV['PRONTO_TEXTLINT_PATH'] || 'textlint'
21
+ end
22
+
23
+ def config_path
24
+ ENV['PRONTO_TEXTLINT_CONFIG_PATH'] || '.textlintrc'
25
+ end
26
+
27
+ def valid_patch?(patch)
28
+ patch.additions > 0
29
+ end
30
+
31
+ def inspect(patch)
32
+ output = run_textlint(patch)
33
+ offences = clean_up_textlint_output(output)
34
+
35
+ offences.flat_map do |offence|
36
+ patch.added_lines
37
+ .select { |line| line.new_lineno == offence['line'] }
38
+ .map { |line| new_message(offence, line) }
39
+ end
40
+ end
41
+
42
+ def run_textlint(patch)
43
+ Dir.chdir(patch.repo.path) do
44
+ path = patch.new_file_full_path.to_s
45
+ command = "#{textlint_path.shellescape} -f json -c #{config_path} #{path.shellescape}"
46
+ stdout, stderr, = Open3.capture3(command)
47
+ puts "WARN: pronto-textlint: #{stderr}" if stderr && !stderr.empty?
48
+
49
+ return [] if stdout.nil?
50
+ JSON.parse(stdout)
51
+ end
52
+ end
53
+
54
+ def new_message(offence, line)
55
+ path = line.patch.delta.new_file[:path]
56
+ Message.new(path, line, :warning, offence['message'], nil, self.class)
57
+ end
58
+
59
+ def clean_up_textlint_output(output)
60
+ output.flat_map do |offence|
61
+ offence['messages'].map do |message|
62
+ message.merge('path' => offence['filePath'])
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -1,7 +1,5 @@
1
- require 'pronto'
2
-
3
1
  module Pronto
4
- class Textlint < Runner
5
- VERSION = '0.1.0'
2
+ module Textlint
3
+ VERSION = '0.1.5'
6
4
  end
7
5
  end
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_runtime_dependency 'pronto', '~> 0.7.1'
27
- spec.add_development_dependency 'bundler', '~> 1.11'
26
+ spec.add_runtime_dependency 'pronto', '>= 0.10.0'
27
+ spec.add_development_dependency 'bundler', '~> 2.0'
28
28
  spec.add_development_dependency 'coveralls'
29
- spec.add_development_dependency 'rake', '~> 10.0'
30
- spec.add_development_dependency 'rubocop', '~> 0.40'
31
- spec.add_development_dependency 'simplecov', '~> 0.10.0'
29
+ spec.add_development_dependency 'rake', '>= 12.3.3'
30
+ spec.add_development_dependency 'rubocop', '>= 0.49.0'
31
+ spec.add_development_dependency 'simplecov'
32
32
  spec.add_development_dependency 'test-unit', '~> 3.0'
33
33
  spec.add_development_dependency 'test-unit-rr', '~> 1.0'
34
34
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-textlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seiichi KONDO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-13 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pronto
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.1
19
+ version: 0.10.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.7.1
26
+ version: 0.10.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.11'
33
+ version: '2.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.11'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,44 +56,44 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: 12.3.3
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: 12.3.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0.40'
75
+ version: 0.49.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0.40'
82
+ version: 0.49.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.10.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.10.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: test-unit
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +142,7 @@ files:
142
142
  - bin/console
143
143
  - bin/setup
144
144
  - lib/pronto/textlint.rb
145
+ - lib/pronto/textlint/runner.rb
145
146
  - lib/pronto/textlint/version.rb
146
147
  - pronto-textlint.gemspec
147
148
  homepage: https://github.com/seikichi/pronto-luacheck
@@ -164,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  version: '0'
165
166
  requirements: []
166
167
  rubyforge_project:
167
- rubygems_version: 2.5.1
168
+ rubygems_version: 2.7.6
168
169
  signing_key:
169
170
  specification_version: 4
170
171
  summary: Pronto runner for textlint.