yast-rake 0.2.5 → 0.2.6
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/VERSION +1 -1
- data/data/targets.yml +1 -1
- data/lib/tasks/spellcheck_task.rb +26 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 602cb3ffa09897e935c19856b481fee257028d6c
|
4
|
+
data.tar.gz: 38d79c6e7e3d89f1cbd6a12b51723406eed6c9b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2405491a1b62927cda131b1ca48f8fe92bd473db6b2b5377d3ee248fe19861cb5e8f4a15e5ddb4bb2b93e86c172d9b525e894429946b5fc52462bacb46f82356
|
7
|
+
data.tar.gz: 5950d128d9bb248a932676351c4a874fab4292be6fedf1ec1d5537126d439c051dda5ef92333f1d18ef4f6d0c2785785a9631a06fd4631f7f4e8b7a9f816a078
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
data/data/targets.yml
CHANGED
@@ -140,20 +140,40 @@ module Yast
|
|
140
140
|
|
141
141
|
success = true
|
142
142
|
lines.each_with_index do |text, index|
|
143
|
-
misspelled =
|
143
|
+
misspelled = misspelled_on_line(text)
|
144
144
|
next if misspelled.empty?
|
145
145
|
|
146
146
|
success = false
|
147
|
-
misspelled
|
148
|
-
puts "#{file}:#{index + 1}: \"#{text}\""
|
149
|
-
|
150
|
-
misspelled.each { |word| puts " #{word.inspect} => #{speller.suggest(word)}" }
|
151
|
-
puts
|
147
|
+
print_misspelled(misspelled, index, text)
|
152
148
|
end
|
153
149
|
|
154
150
|
success
|
155
151
|
end
|
156
152
|
|
153
|
+
def print_misspelled(list, index, text)
|
154
|
+
list.each { |word| text.gsub!(word, Rainbow(word).red) } if colorize?
|
155
|
+
puts "#{file}:#{index + 1}: \"#{text}\""
|
156
|
+
|
157
|
+
list.each { |word| puts " #{word.inspect} => #{speller.suggest(word)}" }
|
158
|
+
puts
|
159
|
+
end
|
160
|
+
|
161
|
+
def misspelled_on_line(text)
|
162
|
+
switch_block_tag if block_line?(text)
|
163
|
+
return [] if inside_block
|
164
|
+
speller.list_misspelled([text]) - config["dictionary"]
|
165
|
+
end
|
166
|
+
|
167
|
+
def block_line?(line)
|
168
|
+
line =~ /^\s*```/
|
169
|
+
end
|
170
|
+
|
171
|
+
def switch_block_tag
|
172
|
+
@inside_block = !@inside_block
|
173
|
+
end
|
174
|
+
|
175
|
+
attr_reader :inside_block
|
176
|
+
|
157
177
|
# run the task
|
158
178
|
def run_task
|
159
179
|
if files_to_check.all? { |file| check_file(file) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yast-rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Reidinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|