pronto-spell 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/pronto/spell.rb +14 -11
- data/lib/pronto/spell/version.rb +1 -1
- data/pronto-spell.gemspec +5 -4
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30fc7a9b7901c64d7406fdeedd2b868837f72fdd
|
4
|
+
data.tar.gz: 61c331d95672195dd274e4e520f2852668d08a13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 501ebce54992da0b63934f268f0e1d6adacd026301d4f901e3669ca9dd7b64233dd4355eee1bed9cc5aef80131d5e450ff35f6c234b9155d16fac6c92bf99b7d
|
7
|
+
data.tar.gz: f3b2fe277ab7aae01d4822bea8061701a3c45b9b9edf48463b3e001128a681fc0deb8eb7b4e8f4e613407bf8564baddd1ed025b38d0cc95bbdc3b9ab512d3c5a
|
data/LICENSE
CHANGED
data/lib/pronto/spell.rb
CHANGED
@@ -3,15 +3,10 @@ require 'ffi/aspell'
|
|
3
3
|
|
4
4
|
module Pronto
|
5
5
|
class Spell < Runner
|
6
|
-
def
|
7
|
-
|
8
|
-
@speller.suggestion_mode = 'fast'
|
9
|
-
end
|
10
|
-
|
11
|
-
def run(patches, _)
|
12
|
-
return [] unless patches
|
6
|
+
def run
|
7
|
+
return [] unless @patches
|
13
8
|
|
14
|
-
patches.select { |patch| patch.additions > 0 }
|
9
|
+
@patches.select { |patch| patch.additions > 0 }
|
15
10
|
.map { |patch| inspect(patch) }
|
16
11
|
.flatten.compact
|
17
12
|
end
|
@@ -21,7 +16,7 @@ module Pronto
|
|
21
16
|
words = line.content.scan(/[0-9a-zA-Z]+/)
|
22
17
|
words.select { |word| word.length > 4 }
|
23
18
|
.uniq
|
24
|
-
.select { |word|
|
19
|
+
.select { |word| !speller.correct?(word) }
|
25
20
|
.map { |word| new_message(word, line) }
|
26
21
|
end
|
27
22
|
end
|
@@ -30,10 +25,18 @@ module Pronto
|
|
30
25
|
path = line.patch.delta.new_file[:path]
|
31
26
|
level = :warning
|
32
27
|
|
33
|
-
suggestions =
|
28
|
+
suggestions = speller.suggestions(word)
|
34
29
|
msg = "#{word} might not be spelled correctly. Spelling suggestions: #{suggestions}"
|
35
30
|
|
36
|
-
Message.new(path, line, level, msg)
|
31
|
+
Message.new(path, line, level, msg, nil, self.class)
|
32
|
+
end
|
33
|
+
|
34
|
+
def speller
|
35
|
+
@speller ||= begin
|
36
|
+
result = FFI::Aspell::Speller.new('en_US')
|
37
|
+
result.suggestion_mode = 'fast'
|
38
|
+
result
|
39
|
+
end
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
data/lib/pronto/spell/version.rb
CHANGED
data/pronto-spell.gemspec
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
2
|
|
3
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
4
|
+
require 'English'
|
4
5
|
require 'pronto/spell/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
@@ -31,9 +32,9 @@ Gem::Specification.new do |s|
|
|
31
32
|
s.extra_rdoc_files = ['LICENSE', 'README.md']
|
32
33
|
s.require_paths = ['lib']
|
33
34
|
|
34
|
-
s.add_dependency('pronto', '~> 0.
|
35
|
+
s.add_dependency('pronto', '~> 0.6.0')
|
35
36
|
s.add_dependency('ffi-aspell', '~> 1.1.0')
|
36
|
-
s.add_development_dependency('rake', '~>
|
37
|
-
s.add_development_dependency('rspec', '~> 3.
|
37
|
+
s.add_development_dependency('rake', '~> 11.0')
|
38
|
+
s.add_development_dependency('rspec', '~> 3.4')
|
38
39
|
s.add_development_dependency('rspec-its', '~> 1.2')
|
39
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-spell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindaugas Mozūras
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pronto
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.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.
|
26
|
+
version: 0.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ffi-aspell
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '11.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '11.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.4'
|
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: '3.
|
68
|
+
version: '3.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec-its
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|