bin/review-check in review-1.3.0 vs bin/review-check in review-1.4.0
- old
+ new
@@ -35,10 +35,12 @@
@config = ReVIEW::Configure.values
@config.merge!({
"inencoding" => "UTF-8",
"outencoding" => "UTF-8"
})
+ @book = ReVIEW::Book::Base.load_default
+ @book.config = @config
modes = nil
files = ARGV unless ARGV.empty?
opts = OptionParser.new
opts.version = ReVIEW::VERSION
@@ -47,11 +49,11 @@
}
opts.on('--outencoding=ENCODING', 'Set output encoding. (UTF-8[default], EUC, JIS, and SJIS)') {|enc|
@config["outencoding"] = enc
}
opts.on('-a', '--all-chapters', 'Check all chapters.') {
- files = ReVIEW.book.chapters.map {|ent| ent.path }
+ files = @book.chapters.map {|ent| ent.path }
}
opts.on('-s', '--section N', 'Check section N. (deprecated)') {|n|
ents = ReVIEW.env.parts[Integer(n) - 1] or
raise ReVIEW::ApplicationError, "section #{n} not exist"
files = ents.map {|ent| ent.path }
@@ -85,10 +87,10 @@
end
end
end
def check_text(files)
- re, neg = words_re(ReVIEW.book.basedir + ReVIEW.book.reject_file)
+ re, neg = words_re("#{@book.basedir}/#{@book.reject_file}")
files.each do |path|
File.open(path) {|f|
each_paragraph(f) do |para, lineno|
s = para.join('')
if m = re.match(s)