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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -6
  3. data/.yardops +5 -0
  4. data/Gemfile +2 -2
  5. data/README.md +8 -5
  6. data/Rakefile +2 -2
  7. data/docparser.gemspec +4 -3
  8. data/example.rb +1 -1
  9. data/lib/docparser.rb +1 -2
  10. data/lib/docparser/document.rb +14 -12
  11. data/lib/docparser/output.rb +1 -1
  12. data/lib/docparser/output/csv_output.rb +1 -1
  13. data/lib/docparser/output/html_output.rb +1 -1
  14. data/lib/docparser/output/json_output.rb +8 -14
  15. data/lib/docparser/output/multi_output.rb +10 -16
  16. data/lib/docparser/output/nil_output.rb +2 -3
  17. data/lib/docparser/output/screen_output.rb +3 -2
  18. data/lib/docparser/output/xlsx_output.rb +1 -1
  19. data/lib/docparser/output/yaml_output.rb +4 -6
  20. data/lib/docparser/parser.rb +31 -38
  21. data/lib/docparser/version.rb +1 -1
  22. data/test/.rubocop.yml +1 -1
  23. data/test/lib/docparser/blackbox_test.rb +1 -1
  24. data/test/lib/docparser/document_test.rb +9 -9
  25. data/test/lib/docparser/logging_test.rb +1 -1
  26. data/test/lib/docparser/output/csv_output_test.rb +1 -1
  27. data/test/lib/docparser/output/html_output_test.rb +1 -1
  28. data/test/lib/docparser/output/json_output_test.rb +1 -1
  29. data/test/lib/docparser/output/multi_output_test.rb +1 -1
  30. data/test/lib/docparser/output/nil_output_test.rb +1 -1
  31. data/test/lib/docparser/output/screen_output_test.rb +7 -7
  32. data/test/lib/docparser/output/xlsx_output_test.rb +1 -1
  33. data/test/lib/docparser/output/yaml_output_test.rb +1 -1
  34. data/test/lib/docparser/output_test.rb +1 -1
  35. data/test/lib/docparser/parser_test.rb +4 -2
  36. data/test/lib/docparser/version_test.rb +1 -1
  37. data/test/test_helper.rb +2 -2
  38. metadata +51 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eceabf457acfee3b6887569cb724f1330604627d
4
- data.tar.gz: a28bd9009eca5025d7d1ce243f0637e671740d73
3
+ metadata.gz: 9b7bee15c24dec4a95cb7d36e724f127360eb3b1
4
+ data.tar.gz: feee0df9857c9488bbd76d065f5fbdef781ec0b8
5
5
  SHA512:
6
- metadata.gz: a8aed4d463232f18441eab3aec91d29618c8df9ba97d842f048e7931ed064b1e7eaa99d50c26f22ee04944d605fef1667f18e16bd19e4f012ad7068afc1a3ab6
7
- data.tar.gz: fff5bce5bb1b8b5dc6f0804746a11e882b2dfe24ee517a67dc5775b7249101d36f751711e321d956e3ccc3cd0ba5be3637577fc1e7d341f7fddda316d77114e1
6
+ metadata.gz: fc6523cc590e56df0e22440b40c301c513647e56fe5ca18fc98a6d849d2cd084be29e011d242db9ee9327475d49082915e7a80faaf4077fa6c4cb056b1f51184
7
+ data.tar.gz: 99c44f0eabc3e58d6e463b3cac3ae0859ad448c647ccfecd73ab9e4eef9f709df18e79d15ac0ae19c511f0652a8aabca7608c610681fd63bb51bccb32e5335c7
@@ -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
@@ -1,2 +1,7 @@
1
+ --no-private
2
+ --hide-void-return
3
+
4
+ --markup-provider=redcarpet
5
+ --markup=markdown
1
6
  README.md
2
7
  LICENSE
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.9.0' #, github: 'bbatsov/rubocop', ref: '2dd9b' #, '~> 0.8.2'
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
- $ bundle
35
+ bundle
36
36
 
37
- Or install it yourself as:
37
+ Or install it yourself using:
38
38
 
39
- $ gem install docparser
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
- - Tests
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
@@ -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.7.1'
24
- spec.add_runtime_dependency 'axlsx', '~> 1.3.6'
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
@@ -20,4 +20,4 @@ parser.parse! do
20
20
  summary = post.search('.entry-content').first.content.strip
21
21
  add_row title, author, published_time, url, summary
22
22
  end
23
- end
23
+ end
@@ -1,2 +1 @@
1
- $LOAD_PATH.unshift __dir__
2
- require 'docparser/parser'
1
+ require 'docparser/parser'
@@ -1,4 +1,4 @@
1
- require 'set'
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
@@ -59,4 +59,4 @@ module DocParser
59
59
 
60
60
  # MissingHeaderException gets thrown if a required header is missing.
61
61
  class MissingHeaderException < StandardError; end
62
- end
62
+ end
@@ -17,4 +17,4 @@ module DocParser
17
17
  @csv << row
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -80,4 +80,4 @@ EOS
80
80
  @file << HTMLFOOTER.gsub('#COUNT#', @rowcount.to_s)
81
81
  end
82
82
  end
83
- end
83
+ end
@@ -1,4 +1,4 @@
1
- require 'multi_json'
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
- if @first
17
- @first = false
18
- else
19
- @file << ','
20
- end
15
+
16
+ @file << ',' unless @file.pos <= 1
17
+
21
18
  0.upto(@header.length - 1) do |counter|
22
- if row.length > counter
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
- @file << MultiJson.dump(@doc)
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
- csvoptions = options.clone
14
- csvoptions[:filename] += '.csv'
15
- htmloptions = options.clone
16
- htmloptions[:filename] += '.html'
17
- yamloptions = options.clone
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
- # It pipes all rows through a pager
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
@@ -35,4 +35,4 @@ module DocParser
35
35
  end
36
36
  end
37
37
  end
38
- end
38
+ 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
- if row.length > counter
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
@@ -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 'output/screen_output.rb'
14
- require 'output/csv_output.rb'
15
- require 'output/html_output.rb'
16
- require 'output/xlsx_output.rb'
17
- require 'output/yaml_output.rb'
18
- require 'output/json_output.rb'
19
- require 'output/multi_output.rb'
20
- require 'output/nil_output.rb'
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
- unless output.nil?
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 if @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
- if defined?(RUBY_ENGINE) && RUBY_ENGINE != 'ruby'
101
- options = { in_threads: @num_processes }
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
@@ -2,5 +2,5 @@
2
2
  # See README.md for information on using DocParser
3
3
  module DocParser
4
4
  # The current version of DocParser
5
- VERSION = '0.1.4'
5
+ VERSION = '0.1.6'
6
6
  end
@@ -1,3 +1,3 @@
1
1
  # Do not introduce global variables.
2
- AvoidGlobalVars:
2
+ GlobalVars:
3
3
  Enabled: false
@@ -26,4 +26,4 @@ describe DocParser do
26
26
  end
27
27
  Dir.chdir(curwd)
28
28
  end
29
- end
29
+ end
@@ -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
- define_method(:outputs) { [$output] }
8
- end.new
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
- define_method(:outputs) { [] }
119
- end.new
118
+ define_method(:outputs) { [] }
119
+ end.new
120
120
  test_doc = DocParser::Document.new(filename: @test_doc_path,
121
- parser: parser)
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
- define_method(:outputs) { [output, output2] }
135
- end.new
134
+ define_method(:outputs) { [output, output2] }
135
+ end.new
136
136
  test_doc = DocParser::Document.new(filename: @test_doc_path,
137
- parser: parser)
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
@@ -16,4 +16,4 @@ describe DocParser do
16
16
  outputters.length.must_equal 1
17
17
  outputters.first.must_be_instance_of Log4r::StdoutOutputter
18
18
  end
19
- end
19
+ end
@@ -48,4 +48,4 @@ describe DocParser::CSVOutput do
48
48
  output.rowcount.must_equal 2
49
49
  end
50
50
  end
51
- end
51
+ end
@@ -54,4 +54,4 @@ describe DocParser::HTMLOutput do
54
54
  open(filename).read.must_include('<p>2 rows</p>')
55
55
  end
56
56
  end
57
- end
57
+ end
@@ -63,4 +63,4 @@ describe DocParser::JSONOutput do
63
63
  output.rowcount.must_equal 2
64
64
  end
65
65
  end
66
- end
66
+ end
@@ -77,4 +77,4 @@ describe DocParser::MultiOutput do
77
77
  end
78
78
  end
79
79
 
80
- end
80
+ end
@@ -24,4 +24,4 @@ describe DocParser::NilOutput do
24
24
  output.add_row %w(aap noot mies)
25
25
  output.rowcount.must_equal 0
26
26
  end
27
- end
27
+ 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
- def page(*args, &p)
39
- args << p
40
- args.compact!
41
- page_to $out, args
42
- end
43
- end.new
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
@@ -50,4 +50,4 @@ describe DocParser::XLSXOutput do
50
50
  output.rowcount.must_equal 2
51
51
  end
52
52
  end
53
- end
53
+ end
@@ -73,4 +73,4 @@ YAMLEND
73
73
  output.rowcount.must_equal 2
74
74
  end
75
75
  end
76
- end
76
+ end
@@ -81,4 +81,4 @@ describe DocParser::Output do
81
81
  -> { output.write_row([]) }.must_raise(NotImplementedError)
82
82
  end
83
83
  end
84
- end
84
+ 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 = self.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
@@ -8,4 +8,4 @@ describe DocParser do
8
8
  it 'must have a correct version' do
9
9
  DocParser::VERSION.must_match(/^\d+\.\d+\.\d+$/)
10
10
  end
11
- end
11
+ end
@@ -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
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-07-02 00:00:00.000000000 Z
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.7.1
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.7.1
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: 1.3.6
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: 1.3.6
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: multi_json
84
+ name: log4r
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.7'
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: '1.7'
96
+ version: 1.1.10
97
97
  - !ruby/object:Gem::Dependency
98
- name: log4r
98
+ name: yard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.1.10
104
- type: :runtime
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: 1.1.10
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: yard
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: []