loadfile 0.1.0
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 +7 -0
- data/README.md +41 -0
- data/lib/loadfile.rb +5 -0
- data/lib/loadfile/version.rb +3 -0
- data/lib/opticon/opt_parser.rb +40 -0
- data/lib/opticon/opticon.rb +80 -0
- data/loadfile.gemspec +29 -0
- data/spec/loadfile_spec.rb +57 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 752facc20baaa2818801edebd9141ea44b9b4829
|
4
|
+
data.tar.gz: d7dff27e0136af6fc2305851b0c1d31a72acba25
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 11210d5375941ee4f133ec2138ce5c2a8631273d26e03a4ccf54fb6003e34a85669315967da75534783aaaaae7e8c00e53e5e45838bef1c435ba5dca6ee1b916
|
7
|
+
data.tar.gz: 87058cc19f9f396498c2e814aca9fe407f9f9a99c7306942149e543531d6537b37e51e1b12e6cfb1d12452c652af051e0a6db08d04eb2389a63ccabf7117e665
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
loadfile
|
2
|
+
---------
|
3
|
+
A ruby gem to manipulate
|
4
|
+
.opt and .log files for Concordance® / Opticon®,
|
5
|
+
.lfp files for Ipro eCap,
|
6
|
+
and .dii files for Summation®.
|
7
|
+
This software is not made or endorsed by Ipro®, Lexis-Nexis® or Dataflight®."
|
8
|
+
|
9
|
+
Installation
|
10
|
+
---------
|
11
|
+
`gem install loadfile`
|
12
|
+
|
13
|
+
or, if you want the latest and the greatest,
|
14
|
+
|
15
|
+
git clone https://github.com/loadfile
|
16
|
+
cd loadfile
|
17
|
+
rake install
|
18
|
+
|
19
|
+
(use `sudo` as necessary)
|
20
|
+
|
21
|
+
Runtime Requirements
|
22
|
+
---------
|
23
|
+
ruby >= 1.8.7
|
24
|
+
|
25
|
+
Build Requirements
|
26
|
+
---------
|
27
|
+
rake
|
28
|
+
|
29
|
+
Inspiration and History
|
30
|
+
---------
|
31
|
+
This is the start of converting
|
32
|
+
https://github.com/nbirnel/eed-tools
|
33
|
+
to ruby.
|
34
|
+
|
35
|
+
License
|
36
|
+
---------
|
37
|
+
© 2014 Noah Birnel
|
38
|
+
MIT license
|
39
|
+
|
40
|
+
[](https://travis-ci.org/nbirnel/loadfile)
|
41
|
+
[](https://codeclimate.com/github/nbirnel/loadfile)
|
data/lib/loadfile.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module Loadfile
|
2
|
+
|
3
|
+
##
|
4
|
+
# This class converts an opticon text file or data stream to an instance
|
5
|
+
# of Opticon
|
6
|
+
|
7
|
+
class OptParser
|
8
|
+
|
9
|
+
##
|
10
|
+
# Create a new parser for Opticon
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@records = []
|
14
|
+
end
|
15
|
+
|
16
|
+
##
|
17
|
+
# Parse text from IO object +input+. It is the caller's responsibility to
|
18
|
+
# open and close the +input+ correctly.
|
19
|
+
|
20
|
+
def parse input
|
21
|
+
c_doc = []
|
22
|
+
while line = input.gets
|
23
|
+
l = line.chomp.split(',')
|
24
|
+
c_record = {
|
25
|
+
:key => l[0],
|
26
|
+
:volume => l[1],
|
27
|
+
:path => l[2],
|
28
|
+
:break => l[3],
|
29
|
+
:empty1 => l[4],
|
30
|
+
:empty2 => l[5],
|
31
|
+
:pages => l[6],
|
32
|
+
}
|
33
|
+
@records.push c_record
|
34
|
+
end
|
35
|
+
Loadfile::Opticon.new @records
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
##
|
2
|
+
# classes for manipulating electronic evidence discovery loadfiles
|
3
|
+
|
4
|
+
module Loadfile
|
5
|
+
|
6
|
+
##
|
7
|
+
# Represent the data in a Concordance® Opticon® image loadfile.
|
8
|
+
|
9
|
+
class Opticon
|
10
|
+
attr_reader :records
|
11
|
+
|
12
|
+
##
|
13
|
+
# Create a new opticon composed of +records+.
|
14
|
+
|
15
|
+
def initialize records
|
16
|
+
@records = records
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Return the first and last image keys
|
21
|
+
|
22
|
+
def beg_end
|
23
|
+
b = @records[0][:key]
|
24
|
+
e = @records[-1][:key]
|
25
|
+
[b, e]
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Return a list of begining and end image keys for each document.
|
30
|
+
# FIXME not yet implemented.
|
31
|
+
|
32
|
+
def beg_end_list
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Return a count of documents.
|
37
|
+
|
38
|
+
def doc_count
|
39
|
+
@records.select{|r| r[:break]}.length
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Return a count of images
|
44
|
+
|
45
|
+
def image_count
|
46
|
+
@records.length
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Return a count of tiffs
|
51
|
+
|
52
|
+
def tiff_count
|
53
|
+
@records.select{|r| r[:path] =~ /\.tif$/}.length
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# Return a count of jpegs
|
58
|
+
|
59
|
+
def jpeg_count
|
60
|
+
@records.select{|r| r[:path] =~ /\.jpg$/}.length
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Return a list of volumes
|
65
|
+
|
66
|
+
def volumes
|
67
|
+
@records.map{|r| r[:volume]}.uniq
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# Return a new opticon data stream, suitable for loading.
|
72
|
+
|
73
|
+
def to_s
|
74
|
+
l = @records.map{|r| r.values.join ','}
|
75
|
+
l.join("\r\n") << "\r\n"
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data/loadfile.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/lib/loadfile/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'loadfile'
|
5
|
+
s.version = Loadfile::VERSION
|
6
|
+
s.date = '2014-03-28'
|
7
|
+
s.required_ruby_version = '>=1.8.7'
|
8
|
+
s.summary = "manipulate electronic evidence discovery loadfiles"
|
9
|
+
s.description = "A ruby gem to manipulate
|
10
|
+
.opt and .log files for Concordance® / Opticon®,
|
11
|
+
.lfp files for Ipro eCap,
|
12
|
+
and .dii files for Summation®.
|
13
|
+
This software is not made or endorsed by Ipro®, Lexis-Nexis® or Dataflight®."
|
14
|
+
s.authors = ['Noah Birnel']
|
15
|
+
s.email = 'nbirnel@gmail.com'
|
16
|
+
s.homepage = 'http://github.com/nbirnel/loadfile'
|
17
|
+
s.files = [
|
18
|
+
'README.md',
|
19
|
+
'loadfile.gemspec',
|
20
|
+
'lib/loadfile.rb',
|
21
|
+
'lib/loadfile/version.rb',
|
22
|
+
'lib/opticon/opticon.rb',
|
23
|
+
'lib/opticon/opt_parser.rb',
|
24
|
+
'spec/loadfile_spec.rb'
|
25
|
+
]
|
26
|
+
s.has_rdoc = true
|
27
|
+
s.license = 'MIT'
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../lib/loadfile"
|
2
|
+
|
3
|
+
describe Loadfile do
|
4
|
+
|
5
|
+
describe Loadfile::Opticon do
|
6
|
+
|
7
|
+
before do
|
8
|
+
@parser = Loadfile::OptParser.new
|
9
|
+
@sample = "#{File.dirname(__FILE__)}/../sample/sample.opt"
|
10
|
+
@io = File.new(@sample,'r')
|
11
|
+
@opt = @parser.parse @io
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns a beg - end' do
|
15
|
+
@opt.beg_end.should eq ["CTRL-000001", "CTRL-000018"]
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns a document count' do
|
19
|
+
@opt.doc_count.should eq 3
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns an image count' do
|
23
|
+
@opt.image_count.should eq 18
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns a tiff count' do
|
27
|
+
@opt.tiff_count.should eq 17
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns a jpeg count' do
|
31
|
+
@opt.jpeg_count.should eq 1
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'returns an list of volumes' do
|
35
|
+
@opt.volumes.should eq ["SAMPLE_VOLUME_001", "SAMPLE_VOLUME_002"]
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'prints itself' do
|
39
|
+
@opt.to_s.length.should eq 1122
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns a beg-end list' do
|
43
|
+
pending
|
44
|
+
@opt.beg_end_list.should eq 'foo'
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'returns an Ipro lfp' do
|
48
|
+
pending
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'returns a Summation dii' do
|
52
|
+
pending
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: loadfile
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Noah Birnel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |-
|
14
|
+
A ruby gem to manipulate
|
15
|
+
.opt and .log files for Concordance® / Opticon®,
|
16
|
+
.lfp files for Ipro eCap,
|
17
|
+
and .dii files for Summation®.
|
18
|
+
This software is not made or endorsed by Ipro®, Lexis-Nexis® or Dataflight®.
|
19
|
+
email: nbirnel@gmail.com
|
20
|
+
executables: []
|
21
|
+
extensions: []
|
22
|
+
extra_rdoc_files: []
|
23
|
+
files:
|
24
|
+
- README.md
|
25
|
+
- lib/loadfile.rb
|
26
|
+
- lib/loadfile/version.rb
|
27
|
+
- lib/opticon/opt_parser.rb
|
28
|
+
- lib/opticon/opticon.rb
|
29
|
+
- loadfile.gemspec
|
30
|
+
- spec/loadfile_spec.rb
|
31
|
+
homepage: http://github.com/nbirnel/loadfile
|
32
|
+
licenses:
|
33
|
+
- MIT
|
34
|
+
metadata: {}
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.8.7
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 2.2.2
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: manipulate electronic evidence discovery loadfiles
|
55
|
+
test_files: []
|