docparser 0.1.4 → 0.1.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/.rubocop.yml +2 -6
- data/.yardops +5 -0
- data/Gemfile +2 -2
- data/README.md +8 -5
- data/Rakefile +2 -2
- data/docparser.gemspec +4 -3
- data/example.rb +1 -1
- data/lib/docparser.rb +1 -2
- data/lib/docparser/document.rb +14 -12
- data/lib/docparser/output.rb +1 -1
- data/lib/docparser/output/csv_output.rb +1 -1
- data/lib/docparser/output/html_output.rb +1 -1
- data/lib/docparser/output/json_output.rb +8 -14
- data/lib/docparser/output/multi_output.rb +10 -16
- data/lib/docparser/output/nil_output.rb +2 -3
- data/lib/docparser/output/screen_output.rb +3 -2
- data/lib/docparser/output/xlsx_output.rb +1 -1
- data/lib/docparser/output/yaml_output.rb +4 -6
- data/lib/docparser/parser.rb +31 -38
- data/lib/docparser/version.rb +1 -1
- data/test/.rubocop.yml +1 -1
- data/test/lib/docparser/blackbox_test.rb +1 -1
- data/test/lib/docparser/document_test.rb +9 -9
- data/test/lib/docparser/logging_test.rb +1 -1
- data/test/lib/docparser/output/csv_output_test.rb +1 -1
- data/test/lib/docparser/output/html_output_test.rb +1 -1
- data/test/lib/docparser/output/json_output_test.rb +1 -1
- data/test/lib/docparser/output/multi_output_test.rb +1 -1
- data/test/lib/docparser/output/nil_output_test.rb +1 -1
- data/test/lib/docparser/output/screen_output_test.rb +7 -7
- data/test/lib/docparser/output/xlsx_output_test.rb +1 -1
- data/test/lib/docparser/output/yaml_output_test.rb +1 -1
- data/test/lib/docparser/output_test.rb +1 -1
- data/test/lib/docparser/parser_test.rb +4 -2
- data/test/lib/docparser/version_test.rb +1 -1
- data/test/test_helper.rb +2 -2
- metadata +51 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b7bee15c24dec4a95cb7d36e724f127360eb3b1
|
4
|
+
data.tar.gz: feee0df9857c9488bbd76d065f5fbdef781ec0b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc6523cc590e56df0e22440b40c301c513647e56fe5ca18fc98a6d849d2cd084be29e011d242db9ee9327475d49082915e7a80faaf4077fa6c4cb056b1f51184
|
7
|
+
data.tar.gz: 99c44f0eabc3e58d6e463b3cac3ae0859ad448c647ccfecd73ab9e4eef9f709df18e79d15ac0ae19c511f0652a8aabca7608c610681fd63bb51bccb32e5335c7
|
data/.rubocop.yml
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
# Avoid methods longer than 10 lines of code
|
2
|
-
MethodLength:
|
3
|
-
Enabled: true
|
4
|
-
CountComments: false # count full line comments?
|
5
|
-
Max: 20
|
6
|
-
|
7
1
|
# Temporary turn this off
|
8
2
|
# Avoid parameter lists longer than three or four parameters.
|
9
3
|
ParameterLists:
|
4
|
+
Enabled: false
|
5
|
+
MultilineBlockChain:
|
10
6
|
Enabled: false
|
data/.yardops
CHANGED
data/Gemfile
CHANGED
@@ -4,10 +4,10 @@ gemspec
|
|
4
4
|
source 'https://rubygems.org'
|
5
5
|
|
6
6
|
group :test do
|
7
|
-
gem 'minitest', '~> 5.0'
|
7
|
+
gem 'minitest', '~> 5.0.8'
|
8
8
|
gem 'coveralls', require: false
|
9
9
|
gem 'rake'
|
10
|
-
gem 'rubocop', '~> 0.
|
10
|
+
gem 'rubocop', '~> 0.13.1'
|
11
11
|
gem 'simplecov', require: false
|
12
12
|
gem 'simple_mock'
|
13
13
|
end
|
data/README.md
CHANGED
@@ -32,11 +32,11 @@ Add this line to your application's Gemfile:
|
|
32
32
|
|
33
33
|
And then execute:
|
34
34
|
|
35
|
-
|
35
|
+
bundle
|
36
36
|
|
37
|
-
Or install it yourself
|
37
|
+
Or install it yourself using:
|
38
38
|
|
39
|
-
|
39
|
+
gem install docparser
|
40
40
|
|
41
41
|
## Usage
|
42
42
|
|
@@ -44,8 +44,7 @@ See [example.rb](https://github.com/jurriaan/docparser/blob/master/example.rb)
|
|
44
44
|
|
45
45
|
## Todo
|
46
46
|
|
47
|
-
-
|
48
|
-
- Better examples
|
47
|
+
- Better examples and documentation
|
49
48
|
|
50
49
|
## Contributing
|
51
50
|
|
@@ -58,3 +57,7 @@ See [example.rb](https://github.com/jurriaan/docparser/blob/master/example.rb)
|
|
58
57
|
## Contributors
|
59
58
|
|
60
59
|
- [Jurriaan Pruis](https://github.com/jurriaan)
|
60
|
+
|
61
|
+
## Thanks
|
62
|
+
|
63
|
+
- [randym](https://github.com/randym) - for providing the [axlsx](https://github.com/randym/axlsx) gem
|
data/Rakefile
CHANGED
@@ -14,9 +14,9 @@ task test: :rubocop
|
|
14
14
|
|
15
15
|
task :rubocop do
|
16
16
|
puts "Running Rubocop #{Rubocop::Version::STRING}"
|
17
|
-
args = FileList['**/*.rb', 'Rakefile', 'docparser.gemspec']
|
17
|
+
args = FileList['**/*.rb', 'Rakefile', 'docparser.gemspec', 'Gemfile']
|
18
18
|
cli = Rubocop::CLI.new
|
19
19
|
fail unless cli.run(args) == 0
|
20
20
|
end
|
21
21
|
|
22
|
-
task default: :test
|
22
|
+
task default: :test
|
data/docparser.gemspec
CHANGED
@@ -20,13 +20,14 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.extra_rdoc_files = ['README.md', 'LICENSE']
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'nokogiri', '~> 1.6.0'
|
23
|
-
spec.add_runtime_dependency 'parallel', '~> 0.
|
24
|
-
spec.add_runtime_dependency 'axlsx', '~>
|
23
|
+
spec.add_runtime_dependency 'parallel', '~> 0.8.4'
|
24
|
+
spec.add_runtime_dependency 'axlsx', '~> 2.0.1'
|
25
25
|
spec.add_runtime_dependency 'terminal-table', '~> 1.4.5'
|
26
26
|
spec.add_runtime_dependency 'pageme', '~> 0.0.3'
|
27
|
-
spec.add_runtime_dependency 'multi_json', '~> 1.7'
|
28
27
|
spec.add_runtime_dependency 'log4r', '~> 1.1.10'
|
29
28
|
|
30
29
|
spec.add_development_dependency 'yard'
|
30
|
+
spec.add_development_dependency 'redcarpet'
|
31
|
+
spec.add_development_dependency 'github-markup'
|
31
32
|
spec.required_ruby_version = '>= 2.0.0'
|
32
33
|
end
|
data/example.rb
CHANGED
data/lib/docparser.rb
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
require 'docparser/parser'
|
1
|
+
require 'docparser/parser'
|
data/lib/docparser/document.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'nokogiri'
|
2
2
|
module DocParser
|
3
3
|
# The Document class loads and parses the files.
|
4
4
|
# @see Parser
|
@@ -10,22 +10,13 @@ module DocParser
|
|
10
10
|
attr_reader :html
|
11
11
|
|
12
12
|
def initialize(filename: nil, encoding: 'utf-8', parser: nil)
|
13
|
-
if encoding == 'utf-8'
|
14
|
-
encodingstring = 'r:utf-8'
|
15
|
-
else
|
16
|
-
encodingstring = "r:#{encoding}:utf-8"
|
17
|
-
end
|
18
13
|
@logger = Log4r::Logger.new('docparser::document')
|
19
14
|
@logger.debug { "Parsing #{filename}" }
|
20
|
-
open(filename, encodingstring) do |f|
|
21
|
-
@html = f.read
|
22
|
-
@logger.warn "#{filename} is empty" if @html.empty?
|
23
|
-
@doc = Nokogiri(@html)
|
24
|
-
end
|
25
15
|
@encoding = encoding
|
26
16
|
@parser = parser
|
27
17
|
@filename = filename
|
28
18
|
@results = Array.new(@parser.outputs ? @parser.outputs.length : 0) { [] }
|
19
|
+
read_file
|
29
20
|
end
|
30
21
|
|
31
22
|
# Adds a row to an output
|
@@ -79,7 +70,18 @@ module DocParser
|
|
79
70
|
"<Document file:'#{@filename}', encoding:'#{@encoding}'>"
|
80
71
|
end
|
81
72
|
|
73
|
+
private
|
74
|
+
|
75
|
+
def read_file
|
76
|
+
encodingstring = @encoding == 'utf-8' ? 'r:utf-8' : "r:#{encoding}:utf-8"
|
77
|
+
open(@filename, encodingstring) do |f|
|
78
|
+
@html = f.read
|
79
|
+
@logger.warn "#{filename} is empty" if @html.empty?
|
80
|
+
@doc = Nokogiri(@html)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
82
84
|
alias_method :css, :xpath
|
83
85
|
alias_method :css_content, :xpath_content
|
84
86
|
end
|
85
|
-
end
|
87
|
+
end
|
data/lib/docparser/output.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'json'
|
2
2
|
module DocParser
|
3
3
|
# The JSONOutput class generates a JSON file containing all rows as seperate
|
4
4
|
# Array elements
|
@@ -7,29 +7,23 @@ module DocParser
|
|
7
7
|
# @!visibility private
|
8
8
|
def open_file
|
9
9
|
@file << '['
|
10
|
-
@first = true
|
11
10
|
@doc = {}
|
12
11
|
end
|
13
12
|
|
14
13
|
def write_row(row)
|
15
14
|
raise MissingHeaderException if @header.nil? || @header.length == 0
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
@file << ','
|
20
|
-
end
|
15
|
+
|
16
|
+
@file << ',' unless @file.pos <= 1
|
17
|
+
|
21
18
|
0.upto(@header.length - 1) do |counter|
|
22
|
-
|
23
|
-
@doc[@header[counter]] = row[counter]
|
24
|
-
else
|
25
|
-
@doc[@header[counter]] = ''
|
26
|
-
end
|
19
|
+
@doc[@header[counter]] = row.length > counter ? row[counter] : ''
|
27
20
|
end
|
28
|
-
|
21
|
+
|
22
|
+
@file << JSON.generate(@doc)
|
29
23
|
end
|
30
24
|
|
31
25
|
def footer
|
32
26
|
@file << ']'
|
33
27
|
end
|
34
28
|
end
|
35
|
-
end
|
29
|
+
end
|
@@ -7,24 +7,18 @@ module DocParser
|
|
7
7
|
# @see XLSXOutput
|
8
8
|
# @see Output
|
9
9
|
class MultiOutput < Output
|
10
|
+
# All the possible outputs
|
11
|
+
OUTPUT_TYPES = { csv: CSVOutput, html: HTMLOutput, yml: YAMLOutput,
|
12
|
+
xlsx: XLSXOutput, json: JSONOutput }
|
13
|
+
|
10
14
|
# @!visibility private
|
11
15
|
def initialize(**options)
|
12
16
|
@outputs = []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
yamloptions[:filename] += '.yml'
|
19
|
-
xlsxoptions = options.clone
|
20
|
-
xlsxoptions[:filename] += '.xlsx'
|
21
|
-
jsonoptions = options.clone
|
22
|
-
jsonoptions[:filename] += '.json'
|
23
|
-
@outputs << CSVOutput.new(csvoptions)
|
24
|
-
@outputs << HTMLOutput.new(htmloptions)
|
25
|
-
@outputs << YAMLOutput.new(yamloptions)
|
26
|
-
@outputs << XLSXOutput.new(xlsxoptions)
|
27
|
-
@outputs << JSONOutput.new(jsonoptions)
|
17
|
+
OUTPUT_TYPES.each do |type, output|
|
18
|
+
output_options = options.clone
|
19
|
+
output_options[:filename] += '.' + type.to_s
|
20
|
+
@outputs << output.new(output_options)
|
21
|
+
end
|
28
22
|
end
|
29
23
|
|
30
24
|
def header=(row)
|
@@ -43,4 +37,4 @@ module DocParser
|
|
43
37
|
@outputs.each { |out| out.close }
|
44
38
|
end
|
45
39
|
end
|
46
|
-
end
|
40
|
+
end
|
@@ -2,9 +2,8 @@ module DocParser
|
|
2
2
|
# This Output is used for testing purposes.
|
3
3
|
|
4
4
|
# @see Output
|
5
|
+
# @!visibility private
|
5
6
|
class NilOutput < Output
|
6
|
-
# @!visibility private
|
7
|
-
|
8
7
|
def initialize
|
9
8
|
@rowcount = 0
|
10
9
|
end
|
@@ -18,4 +17,4 @@ module DocParser
|
|
18
17
|
def add_row(row)
|
19
18
|
end
|
20
19
|
end
|
21
|
-
end
|
20
|
+
end
|
@@ -3,7 +3,8 @@ require 'pageme'
|
|
3
3
|
module DocParser
|
4
4
|
# This Output can be used for debugging purposes.
|
5
5
|
|
6
|
-
#
|
6
|
+
# This output sends the results directly to the terminal and pipes all rows
|
7
|
+
# through a pager
|
7
8
|
# @see Output
|
8
9
|
class ScreenOutput < Output
|
9
10
|
# @!visibility private
|
@@ -33,4 +34,4 @@ module DocParser
|
|
33
34
|
@tables << Terminal::Table.new(rows: out)
|
34
35
|
end
|
35
36
|
end
|
36
|
-
end
|
37
|
+
end
|
@@ -8,14 +8,12 @@ module DocParser
|
|
8
8
|
def write_row(row)
|
9
9
|
raise MissingHeaderException if @header.nil? || @header.length == 0
|
10
10
|
@doc ||= {}
|
11
|
+
|
11
12
|
0.upto(@header.length - 1) do |counter|
|
12
|
-
|
13
|
-
@doc[@header[counter]] = row[counter]
|
14
|
-
else
|
15
|
-
@doc[@header[counter]] = ''
|
16
|
-
end
|
13
|
+
@doc[@header[counter]] = row.length > counter ? row[counter] : ''
|
17
14
|
end
|
15
|
+
|
18
16
|
YAML.dump @doc, @file
|
19
17
|
end
|
20
18
|
end
|
21
|
-
end
|
19
|
+
end
|
data/lib/docparser/parser.rb
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
-
$LOAD_PATH.unshift __dir__
|
2
1
|
require 'rubygems'
|
3
2
|
require 'bundler/setup'
|
4
|
-
require 'version'
|
5
|
-
require 'output'
|
6
|
-
require 'document'
|
7
|
-
require 'nokogiri'
|
8
3
|
require 'open-uri'
|
9
4
|
require 'parallel'
|
10
5
|
require 'set'
|
11
6
|
require 'log4r'
|
12
7
|
require 'log4r/formatter/patternformatter'
|
13
|
-
require '
|
14
|
-
require 'output
|
15
|
-
require '
|
16
|
-
require 'output/
|
17
|
-
require 'output/
|
18
|
-
require 'output/
|
19
|
-
require 'output/
|
20
|
-
require 'output/
|
8
|
+
require 'docparser/version'
|
9
|
+
require 'docparser/output'
|
10
|
+
require 'docparser/document'
|
11
|
+
require 'docparser/output/screen_output.rb'
|
12
|
+
require 'docparser/output/csv_output.rb'
|
13
|
+
require 'docparser/output/html_output.rb'
|
14
|
+
require 'docparser/output/xlsx_output.rb'
|
15
|
+
require 'docparser/output/yaml_output.rb'
|
16
|
+
require 'docparser/output/json_output.rb'
|
17
|
+
require 'docparser/output/multi_output.rb'
|
18
|
+
require 'docparser/output/nil_output.rb'
|
21
19
|
|
22
20
|
Log4r.define_levels(*Log4r::Log4rConfig::LogLevels)
|
23
21
|
logger = Log4r::Logger.new('docparser')
|
@@ -25,8 +23,6 @@ output = Log4r::StdoutOutputter.new('docparser')
|
|
25
23
|
output.formatter = Log4r::PatternFormatter.new(pattern: '[%l %C] %d :: %m')
|
26
24
|
logger.outputters = output
|
27
25
|
logger.level = Log4r::INFO
|
28
|
-
logger = nil
|
29
|
-
output = nil
|
30
26
|
|
31
27
|
# The DocParser namespace
|
32
28
|
# See README.md for information on using DocParser
|
@@ -55,29 +51,17 @@ module DocParser
|
|
55
51
|
|
56
52
|
Log4r::Logger['docparser'].level = quiet ? Log4r::ERROR : Log4r::INFO
|
57
53
|
|
58
|
-
|
59
|
-
if output.is_a? Output
|
60
|
-
@outputs = []
|
61
|
-
@outputs << output
|
62
|
-
elsif output.is_a?(Array) && output.all? { |o| o.is_a? Output }
|
63
|
-
@outputs = output
|
64
|
-
else
|
65
|
-
raise ArgumentError, 'Invalid outputs specified'
|
66
|
-
end
|
67
|
-
|
68
|
-
@resultsets = Array.new(@outputs.length) { Set.new }
|
69
|
-
end
|
54
|
+
initialize_outputs output
|
70
55
|
|
71
56
|
@logger = Log4r::Logger.new('docparser::parser')
|
72
|
-
@logger.info "DocParser v#{VERSION}"
|
73
|
-
@logger.info "#{@files.length} files loaded (encoding: #{@encoding})"
|
57
|
+
@logger.info "DocParser v#{VERSION} loaded"
|
74
58
|
end
|
75
59
|
|
76
60
|
#
|
77
61
|
# Parses the `files`
|
78
62
|
#
|
79
63
|
def parse!(&block)
|
80
|
-
@logger.info "Parsing #{@files.length} files."
|
64
|
+
@logger.info "Parsing #{@files.length} files (encoding: #{@encoding})."
|
81
65
|
start_time = Time.now
|
82
66
|
|
83
67
|
if @num_processes > 1
|
@@ -88,21 +72,30 @@ module DocParser
|
|
88
72
|
|
89
73
|
@logger.info 'Processing finished'
|
90
74
|
|
91
|
-
write_to_outputs
|
75
|
+
write_to_outputs
|
92
76
|
|
93
77
|
@logger.info sprintf('Done processing in %.2fs.', Time.now - start_time)
|
94
78
|
end
|
95
79
|
|
96
80
|
private
|
97
81
|
|
82
|
+
def initialize_outputs(output)
|
83
|
+
@outputs = []
|
84
|
+
if output.is_a? Output
|
85
|
+
@outputs << output
|
86
|
+
elsif output.is_a?(Array) && output.all? { |o| o.is_a? Output }
|
87
|
+
@outputs = output
|
88
|
+
elsif !output.nil?
|
89
|
+
raise ArgumentError, 'Invalid outputs specified'
|
90
|
+
end
|
91
|
+
|
92
|
+
@resultsets = Array.new(@outputs.length) { Set.new }
|
93
|
+
end
|
94
|
+
|
98
95
|
def parallel_process(&block)
|
99
96
|
@logger.info "Starting #{@num_processes} processes"
|
100
|
-
|
101
|
-
|
102
|
-
else
|
103
|
-
options = { in_processes: @num_processes }
|
104
|
-
end
|
105
|
-
Parallel.map(@files, options) do |file|
|
97
|
+
option = RUBY_ENGINE == 'ruby' ? :in_processes : :in_threads
|
98
|
+
Parallel.map(@files, { option => @num_processes }) do |file|
|
106
99
|
# :nocov: #
|
107
100
|
parse_doc(file, &block)
|
108
101
|
# :nocov: #
|
@@ -138,4 +131,4 @@ module DocParser
|
|
138
131
|
end
|
139
132
|
|
140
133
|
end
|
141
|
-
end
|
134
|
+
end
|
data/lib/docparser/version.rb
CHANGED
data/test/.rubocop.yml
CHANGED
@@ -4,8 +4,8 @@ describe DocParser::Document do
|
|
4
4
|
Log4r::Logger['docparser'].level = Log4r::INFO
|
5
5
|
$output = DocParser::NilOutput.new
|
6
6
|
@parser = Class.new do
|
7
|
-
|
8
|
-
|
7
|
+
define_method(:outputs) { [$output] }
|
8
|
+
end.new
|
9
9
|
@test_doc_path = File.join($SUPPORT_DIR, 'test_html.html')
|
10
10
|
@test_doc = DocParser::Document.new(filename: @test_doc_path,
|
11
11
|
parser: @parser)
|
@@ -115,10 +115,10 @@ describe DocParser::Document do
|
|
115
115
|
|
116
116
|
it 'should be possible to not use outputs' do
|
117
117
|
parser = Class.new do
|
118
|
-
|
119
|
-
|
118
|
+
define_method(:outputs) { [] }
|
119
|
+
end.new
|
120
120
|
test_doc = DocParser::Document.new(filename: @test_doc_path,
|
121
|
-
|
121
|
+
parser: parser)
|
122
122
|
test_doc.html.must_include('Test HTML')
|
123
123
|
end
|
124
124
|
|
@@ -131,13 +131,13 @@ describe DocParser::Document do
|
|
131
131
|
output = DocParser::NilOutput.new
|
132
132
|
output2 = DocParser::NilOutput.new
|
133
133
|
parser = Class.new do
|
134
|
-
|
135
|
-
|
134
|
+
define_method(:outputs) { [output, output2] }
|
135
|
+
end.new
|
136
136
|
test_doc = DocParser::Document.new(filename: @test_doc_path,
|
137
|
-
|
137
|
+
parser: parser)
|
138
138
|
test_doc.add_row ['a'], output: 1
|
139
139
|
test_doc.add_row ['b'], output: 0
|
140
140
|
test_doc.results.must_equal [[['b']], [['a']]]
|
141
141
|
end
|
142
142
|
|
143
|
-
end
|
143
|
+
end
|
@@ -35,12 +35,12 @@ describe DocParser::ScreenOutput do
|
|
35
35
|
it 'must output the data after close' do
|
36
36
|
$out = StringIO.new
|
37
37
|
output = Class.new DocParser::ScreenOutput do
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
def page(*args, &p)
|
39
|
+
args << p
|
40
|
+
args.compact!
|
41
|
+
page_to $out, args
|
42
|
+
end
|
43
|
+
end.new
|
44
44
|
output.header = 'test', 'the', 'header'
|
45
45
|
output.add_row ['aap1' , '', 'mies']
|
46
46
|
output.add_row %w(aap2 mies1)
|
@@ -51,4 +51,4 @@ describe DocParser::ScreenOutput do
|
|
51
51
|
out.must_include 'mies1'
|
52
52
|
out.must_include 'mies'
|
53
53
|
end
|
54
|
-
end
|
54
|
+
end
|
@@ -24,6 +24,7 @@ describe DocParser::Parser do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'should set logger level depending on the quiet setting' do
|
27
|
+
# rubocop : disable UselessAssignment
|
27
28
|
parser = DocParser::Parser.new(quiet: true)
|
28
29
|
logger = Log4r::Logger['docparser']
|
29
30
|
old_output = logger.outputters.pop
|
@@ -33,6 +34,7 @@ describe DocParser::Parser do
|
|
33
34
|
parser = DocParser::Parser.new
|
34
35
|
logger.level.must_equal Log4r::INFO
|
35
36
|
logger.outputters.push old_output
|
37
|
+
# rubocop : enable UselessAssignment
|
36
38
|
end
|
37
39
|
|
38
40
|
it 'should only process the files in range' do
|
@@ -70,7 +72,7 @@ describe DocParser::Parser do
|
|
70
72
|
files: [file.path],
|
71
73
|
parallel: false)
|
72
74
|
parser.parse! do
|
73
|
-
$encoding =
|
75
|
+
$encoding = encoding
|
74
76
|
end
|
75
77
|
$encoding.must_equal 'iso-8859-1'
|
76
78
|
end
|
@@ -192,4 +194,4 @@ describe DocParser::Parser do
|
|
192
194
|
$method_id.must_equal :fork
|
193
195
|
mock_output.verify.must_equal true
|
194
196
|
end
|
195
|
-
end
|
197
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -12,8 +12,8 @@ require 'minitest/pride'
|
|
12
12
|
require 'tempfile'
|
13
13
|
require 'tmpdir'
|
14
14
|
require 'simple_mock'
|
15
|
-
|
16
15
|
require File.expand_path('../lib/docparser.rb', __dir__)
|
16
|
+
|
17
17
|
$TEST_DIR = __dir__
|
18
18
|
$ROOT_DIR = File.expand_path('..', $TEST_DIR)
|
19
|
-
$SUPPORT_DIR = File.join(__dir__, 'support/')
|
19
|
+
$SUPPORT_DIR = File.join(__dir__, 'support/')
|
metadata
CHANGED
@@ -1,125 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurriaan Pruis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.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
26
|
version: 1.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: parallel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.8.4
|
34
34
|
type: :runtime
|
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: 0.
|
40
|
+
version: 0.8.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: axlsx
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.0.1
|
48
48
|
type: :runtime
|
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: 2.0.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: terminal-table
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.4.5
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.4.5
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pageme
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.0.3
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.0.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: log4r
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.1.10
|
90
90
|
type: :runtime
|
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:
|
96
|
+
version: 1.1.10
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: yard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
type: :
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: redcarpet
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: github-markup
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - ">="
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
139
|
description: DocParser is a Ruby Gem for webscraping
|
@@ -131,11 +145,11 @@ extra_rdoc_files:
|
|
131
145
|
- README.md
|
132
146
|
- LICENSE
|
133
147
|
files:
|
134
|
-
- .coveralls.yml
|
135
|
-
- .gitignore
|
136
|
-
- .rubocop.yml
|
137
|
-
- .travis.yml
|
138
|
-
- .yardops
|
148
|
+
- ".coveralls.yml"
|
149
|
+
- ".gitignore"
|
150
|
+
- ".rubocop.yml"
|
151
|
+
- ".travis.yml"
|
152
|
+
- ".yardops"
|
139
153
|
- Gemfile
|
140
154
|
- LICENSE
|
141
155
|
- README.md
|
@@ -226,12 +240,12 @@ require_paths:
|
|
226
240
|
- lib
|
227
241
|
required_ruby_version: !ruby/object:Gem::Requirement
|
228
242
|
requirements:
|
229
|
-
- -
|
243
|
+
- - ">="
|
230
244
|
- !ruby/object:Gem::Version
|
231
245
|
version: 2.0.0
|
232
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
247
|
requirements:
|
234
|
-
- -
|
248
|
+
- - ">="
|
235
249
|
- !ruby/object:Gem::Version
|
236
250
|
version: '0'
|
237
251
|
requirements: []
|