docparser 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 907927469491015367a9b5ba12ff4a8122495428
4
- data.tar.gz: 5c842a24a58026c8296d61ca95d921f9ab20ccf9
3
+ metadata.gz: eceabf457acfee3b6887569cb724f1330604627d
4
+ data.tar.gz: a28bd9009eca5025d7d1ce243f0637e671740d73
5
5
  SHA512:
6
- metadata.gz: 126b0563186b5f7dc9b94a55ee576d3f07818119056c99bd8dd938f940cb5c19b942cdb380ad9f2dc0367383b4e30cf42b8a2468cb9cad734f5cd716e92ce192
7
- data.tar.gz: 7abef08de7561f3e8486141c311655bf8f13e1d4c6a658b9a9919c56f0d23fc48c071b6df14211f19f0d3987018d97b739065c01bb5fed267c38f3e86292071e
6
+ metadata.gz: a8aed4d463232f18441eab3aec91d29618c8df9ba97d842f048e7931ed064b1e7eaa99d50c26f22ee04944d605fef1667f18e16bd19e4f012ad7068afc1a3ab6
7
+ data.tar.gz: fff5bce5bb1b8b5dc6f0804746a11e882b2dfe24ee517a67dc5775b7249101d36f751711e321d956e3ccc3cd0ba5be3637577fc1e7d341f7fddda316d77114e1
@@ -2,4 +2,9 @@
2
2
  MethodLength:
3
3
  Enabled: true
4
4
  CountComments: false # count full line comments?
5
- Max: 20
5
+ Max: 20
6
+
7
+ # Temporary turn this off
8
+ # Avoid parameter lists longer than three or four parameters.
9
+ ParameterLists:
10
+ Enabled: false
data/Gemfile CHANGED
@@ -4,9 +4,10 @@ gemspec
4
4
  source 'https://rubygems.org'
5
5
 
6
6
  group :test do
7
+ gem 'minitest', '~> 5.0'
7
8
  gem 'coveralls', require: false
8
9
  gem 'rake'
9
- gem 'rubocop', git: 'git://github.com/bbatsov/rubocop.git', ref: '011ca3536c0a'
10
+ gem 'rubocop', '~> 0.9.0' #, github: 'bbatsov/rubocop', ref: '2dd9b' #, '~> 0.8.2'
10
11
  gem 'simplecov', require: false
11
12
  gem 'simple_mock'
12
13
  end
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
  spec.extra_rdoc_files = ['README.md', 'LICENSE']
21
21
 
22
- spec.add_runtime_dependency 'nokogiri', '~> 1.5.9'
23
- spec.add_runtime_dependency 'parallel', '~> 0.6.4'
22
+ spec.add_runtime_dependency 'nokogiri', '~> 1.6.0'
23
+ spec.add_runtime_dependency 'parallel', '~> 0.7.1'
24
24
  spec.add_runtime_dependency 'axlsx', '~> 1.3.6'
25
25
  spec.add_runtime_dependency 'terminal-table', '~> 1.4.5'
26
26
  spec.add_runtime_dependency 'pageme', '~> 0.0.3'
@@ -32,9 +32,9 @@ module DocParser
32
32
  def close
33
33
  footer
34
34
  @file.close unless @file.closed?
35
- @logger.info "Finished writing"
35
+ @logger.info 'Finished writing'
36
36
  size = File.size(@filename) / 1024.0
37
- @logger.info sprintf("%s: %d rows, %.2f KiB", @filename, rowcount, size)
37
+ @logger.info sprintf('%s: %d rows, %.2f KiB', @filename, rowcount, size)
38
38
  end
39
39
 
40
40
  # Called after the file is opened
@@ -5,39 +5,38 @@ module DocParser
5
5
  class HTMLOutput < Output
6
6
  # @!visibility private
7
7
  HTMLHEADER = <<-EOS
8
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
9
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
8
+ <!DOCTYPE html>
10
9
  <html>
11
10
  <head>
12
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
13
11
  <title>HTML output "#FILENAME#"</title>
12
+ <meta charset="utf-8">
14
13
  <style type="text/css">
15
14
  body {
16
- font-family:"Helvetica Neue", Helvetica, Sans-Serif;
15
+ font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
17
16
  font-size:12px;
18
17
  }
19
18
  table {
20
- border:1px solid #69c;
21
- border-collapse:collapse;
22
- font-size:12px;
23
- text-align:left;
24
- width:480px;
19
+ border:1px solid #69c;
20
+ border-collapse:collapse;
21
+ font-size:12px;
22
+ text-align:left;
23
+ width:480px;
25
24
  }
26
25
  th {
27
- border-bottom:1px dashed #69c;
28
- color:#039;
29
- font-size:14px;
30
- font-weight:normal;
31
- padding:12px 17px;
26
+ border-bottom:1px dashed #69c;
27
+ color:#039;
28
+ font-size:14px;
29
+ font-weight:normal;
30
+ padding:12px 17px;
32
31
  }
33
32
  td {
34
- color:#669;
35
- padding:7px 17px;
36
- white-space: pre;
33
+ color:#669;
34
+ padding:7px 17px;
35
+ white-space: pre;
37
36
  }
38
37
  tbody tr:hover td {
39
- background:#d0dafd;
40
- color:#339;
38
+ background:#d0dafd;
39
+ color:#339;
41
40
  }
42
41
  tbody tr:nth-child(even) {
43
42
  background:#e0eaff;
@@ -97,7 +97,12 @@ module DocParser
97
97
 
98
98
  def parallel_process(&block)
99
99
  @logger.info "Starting #{@num_processes} processes"
100
- Parallel.map(@files, in_processes: @num_processes) do |file|
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|
101
106
  # :nocov: #
102
107
  parse_doc(file, &block)
103
108
  # :nocov: #
@@ -1,4 +1,6 @@
1
+ # DocParser
2
+ # See README.md for information on using DocParser
1
3
  module DocParser
2
4
  # The current version of DocParser
3
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
4
6
  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,8 +115,8 @@ 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
121
  parser: parser)
122
122
  test_doc.html.must_include('Test HTML')
@@ -131,8 +131,8 @@ 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
137
  parser: parser)
138
138
  test_doc.add_row ['a'], output: 1
@@ -30,7 +30,7 @@ describe DocParser::JSONOutput do
30
30
  Dir.mktmpdir do |dir|
31
31
  filename = File.join(dir, 'test.json')
32
32
  output = DocParser::JSONOutput.new(filename: filename)
33
- -> do
33
+ lambda do
34
34
  output.add_row %w(aap noot mies)
35
35
  end.must_raise(DocParser::MissingHeaderException)
36
36
  end
@@ -35,7 +35,7 @@ describe DocParser::MultiOutput do
35
35
  Dir.mktmpdir do |dir|
36
36
  filename = File.join(dir, 'test')
37
37
  output = DocParser::MultiOutput.new(filename: filename)
38
- -> do
38
+ lambda do
39
39
  output.add_row %w(aap noot mies)
40
40
  end.must_raise(DocParser::MissingHeaderException)
41
41
  end
@@ -27,7 +27,7 @@ describe DocParser::ScreenOutput do
27
27
 
28
28
  it 'must have a header' do
29
29
  output = DocParser::ScreenOutput.new
30
- -> do
30
+ lambda do
31
31
  output.add_row %w(aap noot mies)
32
32
  end.must_raise(DocParser::MissingHeaderException)
33
33
  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)
@@ -30,7 +30,7 @@ describe DocParser::YAMLOutput do
30
30
  Dir.mktmpdir do |dir|
31
31
  filename = File.join(dir, 'test.yml')
32
32
  output = DocParser::YAMLOutput.new(filename: filename)
33
- -> do
33
+ lambda do
34
34
  output.add_row %w(aap noot mies)
35
35
  end.must_raise(DocParser::MissingHeaderException)
36
36
  end
@@ -30,7 +30,7 @@ describe DocParser::Parser do
30
30
  logger.level.must_equal Log4r::ERROR
31
31
  parser = DocParser::Parser.new(quiet: false)
32
32
  logger.level.must_equal Log4r::INFO
33
- parser = DocParser::Parser.new()
33
+ parser = DocParser::Parser.new
34
34
  logger.level.must_equal Log4r::INFO
35
35
  logger.outputters.push old_output
36
36
  end
@@ -76,7 +76,7 @@ describe DocParser::Parser do
76
76
  end
77
77
 
78
78
  it 'should give an Exception if output is not supported' do
79
- -> do
79
+ lambda do
80
80
  DocParser::Parser.new(quiet: true, output: 1)
81
81
  end.must_raise(ArgumentError)
82
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
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-05-12 00:00:00.000000000 Z
11
+ date: 2013-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.5.9
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
- version: 1.5.9
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.6.4
33
+ version: 0.7.1
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.6.4
40
+ version: 0.7.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: axlsx
43
43
  requirement: !ruby/object:Gem::Requirement