dbf 4.2.1 → 4.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +45 -43
- data/LICENSE +1 -1
- data/README.md +17 -24
- data/Rakefile +1 -1
- data/dbf.gemspec +1 -1
- data/lib/dbf/record.rb +4 -4
- data/lib/dbf/version.rb +1 -1
- data/spec/dbf/column_spec.rb +1 -1
- metadata +6 -12
- data/ci_A.dbf +0 -0
- data/nBOOKS.DBF +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e9ef85b87158f44b02c2601acac039988b6941860ff4fec733f902be7e72024
|
4
|
+
data.tar.gz: 5755262f4f71fa0e9218f50a7d5e7f746cfbb14ad6560d9644ec41e6f1ae6da8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3965e03f8fe93fff93f8f64567374c07fc3dec6d9fb89bbb112b77305810f7e7202aadba49fe74702d9eb49af679c97dae03ee0b97562e27fc170232045f09c
|
7
|
+
data.tar.gz: e0972971a67325fdfb43f07865ac91d7ef01028fee8e6a959773e6539219fefc7d7f83ad953ebdac3ee181c167cb37e50f56a89a89eb54788afea1bfbc8b18e4
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dbf (4.2.
|
4
|
+
dbf (4.2.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.2)
|
10
10
|
awesome_print (1.9.2)
|
11
|
-
benchmark (0.2.0)
|
12
11
|
byebug (11.1.3)
|
13
12
|
coderay (1.1.3)
|
14
13
|
diff-lcs (1.5.0)
|
@@ -29,10 +28,9 @@ GEM
|
|
29
28
|
guard (~> 2.1)
|
30
29
|
guard-compat (~> 1.1)
|
31
30
|
rspec (>= 2.99.0, < 4.0)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
listen (3.7.1)
|
31
|
+
irb (1.1.1)
|
32
|
+
language_server-protocol (3.15.0.1)
|
33
|
+
listen (3.8.0)
|
36
34
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
37
35
|
rb-inotify (~> 0.9, >= 0.9.10)
|
38
36
|
lumberjack (1.2.8)
|
@@ -41,64 +39,67 @@ GEM
|
|
41
39
|
notiffany (0.1.3)
|
42
40
|
nenv (~> 0.1)
|
43
41
|
shellany (~> 0.0)
|
44
|
-
parallel (1.
|
45
|
-
parser (3.
|
42
|
+
parallel (1.20.1)
|
43
|
+
parser (3.2.2.1)
|
46
44
|
ast (~> 2.4.1)
|
47
|
-
pry (0.14.
|
45
|
+
pry (0.14.2)
|
48
46
|
coderay (~> 1.1)
|
49
47
|
method_source (~> 1.0)
|
50
48
|
rainbow (3.1.1)
|
51
49
|
rake (13.0.6)
|
52
|
-
rb-fsevent (0.11.
|
50
|
+
rb-fsevent (0.11.2)
|
53
51
|
rb-inotify (0.10.1)
|
54
52
|
ffi (~> 1.0)
|
55
|
-
regexp_parser (2.
|
56
|
-
reline (0.3.1)
|
57
|
-
io-console (~> 0.5)
|
53
|
+
regexp_parser (2.8.0)
|
58
54
|
rexml (3.2.5)
|
59
|
-
rspec (3.
|
60
|
-
rspec-core (~> 3.
|
61
|
-
rspec-expectations (~> 3.
|
62
|
-
rspec-mocks (~> 3.
|
63
|
-
rspec-core (3.
|
64
|
-
rspec-support (~> 3.
|
65
|
-
rspec-expectations (3.
|
55
|
+
rspec (3.12.0)
|
56
|
+
rspec-core (~> 3.12.0)
|
57
|
+
rspec-expectations (~> 3.12.0)
|
58
|
+
rspec-mocks (~> 3.12.0)
|
59
|
+
rspec-core (3.12.2)
|
60
|
+
rspec-support (~> 3.12.0)
|
61
|
+
rspec-expectations (3.12.3)
|
66
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
-
rspec-support (~> 3.
|
68
|
-
rspec-mocks (3.
|
63
|
+
rspec-support (~> 3.12.0)
|
64
|
+
rspec-mocks (3.12.5)
|
69
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
70
|
-
rspec-support (~> 3.
|
71
|
-
rspec-support (3.
|
72
|
-
rubocop (1.
|
66
|
+
rspec-support (~> 3.12.0)
|
67
|
+
rspec-support (3.12.0)
|
68
|
+
rubocop (1.12.1)
|
73
69
|
parallel (~> 1.10)
|
74
|
-
parser (>= 3.
|
70
|
+
parser (>= 3.0.0.0)
|
75
71
|
rainbow (>= 2.2.2, < 4.0)
|
76
72
|
regexp_parser (>= 1.8, < 3.0)
|
77
|
-
rexml
|
78
|
-
rubocop-ast (>= 1.
|
73
|
+
rexml
|
74
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
79
75
|
ruby-progressbar (~> 1.7)
|
80
76
|
unicode-display_width (>= 1.4.0, < 3.0)
|
81
|
-
rubocop-ast (1.
|
82
|
-
parser (>=
|
83
|
-
rubocop-performance (1.
|
84
|
-
rubocop (>=
|
77
|
+
rubocop-ast (1.4.1)
|
78
|
+
parser (>= 2.7.1.5)
|
79
|
+
rubocop-performance (1.10.2)
|
80
|
+
rubocop (>= 0.90.0, < 2.0)
|
85
81
|
rubocop-ast (>= 0.4.0)
|
86
|
-
rubocop-rspec (2.
|
87
|
-
rubocop (~> 1.
|
88
|
-
|
82
|
+
rubocop-rspec (2.2.0)
|
83
|
+
rubocop (~> 1.0)
|
84
|
+
rubocop-ast (>= 1.1.0)
|
85
|
+
ruby-lsp (0.0.4)
|
86
|
+
language_server-protocol
|
87
|
+
rubocop (>= 1.0)
|
88
|
+
sorbet-runtime
|
89
|
+
syntax_tree (>= 2.3)
|
90
|
+
ruby-progressbar (1.13.0)
|
89
91
|
shellany (0.0.1)
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
sorbet-runtime (0.5.10461)
|
93
|
+
syntax_tree (2.3.1)
|
94
|
+
thor (1.2.2)
|
95
|
+
unicode-display_width (2.4.2)
|
96
|
+
yard (0.9.34)
|
95
97
|
|
96
98
|
PLATFORMS
|
97
|
-
|
99
|
+
ruby
|
98
100
|
|
99
101
|
DEPENDENCIES
|
100
102
|
awesome_print
|
101
|
-
benchmark
|
102
103
|
byebug
|
103
104
|
dbf!
|
104
105
|
e2mmap
|
@@ -110,7 +111,8 @@ DEPENDENCIES
|
|
110
111
|
rubocop
|
111
112
|
rubocop-performance
|
112
113
|
rubocop-rspec
|
114
|
+
ruby-lsp
|
113
115
|
yard
|
114
116
|
|
115
117
|
BUNDLED WITH
|
116
|
-
2.
|
118
|
+
2.1.0
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# DBF
|
2
|
+
|
2
3
|
[![Version](https://img.shields.io/gem/v/dbf.svg?style=flat)](https://rubygems.org/gems/dbf)
|
3
4
|
[![Build Status](https://github.com/infused/dbf/actions/workflows/build.yml/badge.svg)](https://github.com/infused/dbf/actions/workflows/build.yml)
|
4
5
|
[![Code Quality](https://img.shields.io/codeclimate/maintainability/infused/dbf.svg?style=flat)](https://codeclimate.com/github/infused/dbf)
|
@@ -6,8 +7,7 @@
|
|
6
7
|
[![Total Downloads](https://img.shields.io/gem/dt/dbf.svg)](https://rubygems.org/gems/dbf/)
|
7
8
|
[![License](https://img.shields.io/github/license/infused/dbf.svg)](https://github.com/infused/dbf)
|
8
9
|
|
9
|
-
DBF is a small fast library for reading dBase, xBase, Clipper and FoxPro
|
10
|
-
database files
|
10
|
+
DBF is a small, fast Ruby library for reading dBase, xBase, Clipper, and FoxPro database files.
|
11
11
|
|
12
12
|
* Project page: <https://github.com/infused/dbf>
|
13
13
|
* API Documentation: <https://dbf.infused.org>
|
@@ -16,23 +16,23 @@ database files
|
|
16
16
|
subject line
|
17
17
|
* Change log: <https://github.com/infused/dbf/blob/master/CHANGELOG.md>
|
18
18
|
|
19
|
-
NOTE: Beginning with version 4 we have dropped support for Ruby 2.0, 2.1, 2.2, and 2.3. If you need support for these older Rubies,
|
20
|
-
please use 3.0.x (https://github.com/infused.org/dbf/tree/3_stable)
|
19
|
+
NOTE: Beginning with version 4, we have dropped support for Ruby 2.0, 2.1, 2.2, and 2.3. If you need support for these older Rubies,
|
20
|
+
please use 3.0.x (<https://github.com/infused.org/dbf/tree/3_stable>)
|
21
21
|
|
22
|
-
NOTE: Beginning with version 3 we have dropped support for Ruby 1.8 and 1.9. If you need support for older Rubies,
|
23
|
-
please use 2.0.x (https://github.com/infused/dbf/tree/2_stable)
|
22
|
+
NOTE: Beginning with version 3, we have dropped support for Ruby 1.8 and 1.9. If you need support for older Rubies,
|
23
|
+
please use 2.0.x (<https://github.com/infused/dbf/tree/2_stable>)
|
24
24
|
|
25
25
|
## Compatibility
|
26
26
|
|
27
27
|
DBF is tested to work with the following versions of Ruby:
|
28
28
|
|
29
|
-
* Ruby 2.4.x, 2.5.x, 2.6.x, 2.7.x, 3.0.x,
|
29
|
+
* Ruby 2.4.x, 2.5.x, 2.6.x, 2.7.x, 3.0.x, 3.1.x, and 3.2.x
|
30
30
|
|
31
31
|
## Installation
|
32
32
|
|
33
33
|
Install the gem manually:
|
34
34
|
|
35
|
-
```
|
35
|
+
```ruby
|
36
36
|
gem install dbf
|
37
37
|
```
|
38
38
|
|
@@ -101,8 +101,7 @@ widget.attributes
|
|
101
101
|
```
|
102
102
|
|
103
103
|
Search for records using a simple hash format. Multiple search criteria are
|
104
|
-
ANDed. Use the block form if the resulting
|
105
|
-
all records will be loaded into memory.
|
104
|
+
ANDed. Use the block form if the resulting record set is too big. Otherwise, all records are loaded into memory.
|
106
105
|
|
107
106
|
```ruby
|
108
107
|
# find all records with slot_number equal to s42
|
@@ -122,8 +121,7 @@ widgets.find(10)
|
|
122
121
|
|
123
122
|
## Enumeration
|
124
123
|
|
125
|
-
DBF::Table is a Ruby Enumerable
|
126
|
-
This means that you get a bunch of traversal, searching and sorting methods
|
124
|
+
DBF::Table is a Ruby Enumerable, so you get several traversal, search, and sort methods
|
127
125
|
for free. For example, let's get only records created before January 1st, 2015:
|
128
126
|
|
129
127
|
```ruby
|
@@ -136,13 +134,9 @@ Or custom sorting:
|
|
136
134
|
widgets.sort_by { |w| w.created_date }
|
137
135
|
```
|
138
136
|
|
139
|
-
|
140
137
|
## Encodings (Code Pages)
|
141
138
|
|
142
|
-
dBase supports encoding non-english characters
|
143
|
-
Unfortunately, the format used is not always set, so you may have to specify it
|
144
|
-
manually. For example, you have a DBF file from Russia and you are getting bad
|
145
|
-
data. Try using the 'Russion OEM' encoding:
|
139
|
+
dBase supports encoding non-english characters with different character sets. Unfortunately, the character set used may not be set explicitly. In that case, you will have to specify it manually. For example, if you know the dbf file is encoded with 'Russian OEM':
|
146
140
|
|
147
141
|
```ruby
|
148
142
|
table = DBF::Table.new('dbf/books.dbf', nil, 'cp866')
|
@@ -236,7 +230,7 @@ class CreateBooks < ActiveRecord::Migration
|
|
236
230
|
end
|
237
231
|
```
|
238
232
|
|
239
|
-
If you have
|
233
|
+
If you have initialized the DBF::Table with raw data, you will need to set the
|
240
234
|
exported table name manually:
|
241
235
|
|
242
236
|
```ruby
|
@@ -278,7 +272,7 @@ table.name = 'my_table_name'
|
|
278
272
|
|
279
273
|
## Command-line utility
|
280
274
|
|
281
|
-
A small command-line utility called dbf is installed
|
275
|
+
A small command-line utility called dbf is installed with the gem.
|
282
276
|
|
283
277
|
$ dbf -h
|
284
278
|
usage: dbf [-h|-s|-a] filename
|
@@ -304,8 +298,7 @@ Dump all records to a CSV file:
|
|
304
298
|
## Reading a Visual Foxpro database (v8, v9)
|
305
299
|
|
306
300
|
A special Database::Foxpro class is available to read Visual Foxpro container
|
307
|
-
files (file with .dbc extension). When using this class long field names are
|
308
|
-
supported and tables can be referenced without using names.
|
301
|
+
files (file with .dbc extension). When using this class, long field names are supported, and tables can be referenced without using names.
|
309
302
|
|
310
303
|
```ruby
|
311
304
|
require 'dbf'
|
@@ -317,9 +310,9 @@ my_contact = contacts.record(1).spouses_interests
|
|
317
310
|
## dBase version compatibility
|
318
311
|
|
319
312
|
The basic dBase data types are generally supported well. Support for the
|
320
|
-
advanced data types in
|
313
|
+
advanced data types in dBase V and FoxPro are still experimental or not
|
321
314
|
supported. If you have insight into how any of the unsupported data types are
|
322
|
-
implemented, please
|
315
|
+
implemented, please open an issue on Github. FoxBase/dBase II files are not supported
|
323
316
|
at this time.
|
324
317
|
|
325
318
|
### Supported data types by dBase version
|
@@ -369,7 +362,7 @@ Data type descriptions
|
|
369
362
|
|
370
363
|
## License
|
371
364
|
|
372
|
-
Copyright (c) 2006-
|
365
|
+
Copyright (c) 2006-2023 Keith Morrison <<keithm@infused.org>>
|
373
366
|
|
374
367
|
Permission is hereby granted, free of charge, to any person
|
375
368
|
obtaining a copy of this software and associated documentation
|
data/Rakefile
CHANGED
data/dbf.gemspec
CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.rdoc_options = ['--charset=UTF-8']
|
17
17
|
s.extra_rdoc_files = ['README.md', 'CHANGELOG.md', 'LICENSE']
|
18
18
|
s.files = Dir['[A-Z]*', '{bin,docs,lib,spec}/**/*', 'dbf.gemspec']
|
19
|
-
s.test_files = Dir.glob('spec/**/*_spec.rb')
|
20
19
|
s.require_paths = ['lib']
|
21
20
|
s.required_rubygems_version = Gem::Requirement.new('>= 1.3.0')
|
22
21
|
s.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
22
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
23
23
|
end
|
data/lib/dbf/record.rb
CHANGED
@@ -38,7 +38,7 @@ module DBF
|
|
38
38
|
#
|
39
39
|
# @return [Hash]
|
40
40
|
def attributes
|
41
|
-
@attributes ||= Hash[
|
41
|
+
@attributes ||= Hash[column_names.zip(to_a)]
|
42
42
|
end
|
43
43
|
|
44
44
|
# Do all search parameters match?
|
@@ -53,13 +53,13 @@ module DBF
|
|
53
53
|
#
|
54
54
|
# @return [Array]
|
55
55
|
def to_a
|
56
|
-
@columns.map { |column|
|
56
|
+
@to_a ||= @columns.map { |column| init_attribute(column) }
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
-
def
|
62
|
-
@columns.map { |column|
|
61
|
+
def column_names # :nodoc:
|
62
|
+
@column_names ||= @columns.map { |column| column.name }
|
63
63
|
end
|
64
64
|
|
65
65
|
def get_data(column) # :nodoc:
|
data/lib/dbf/version.rb
CHANGED
data/spec/dbf/column_spec.rb
CHANGED
@@ -291,7 +291,7 @@ RSpec.describe DBF::Column do
|
|
291
291
|
end
|
292
292
|
|
293
293
|
it 'is truncated at the null character' do
|
294
|
-
column = DBF::Column.new table, "--\x1F-\x68\x65\x6C\x6C\x6F \x00world-\x80--", 'N', 1, 0
|
294
|
+
column = DBF::Column.new table, "--\x1F-\x68\x65\x6C\x6C\x6F \x00world-\x80\x80--", 'N', 1, 0
|
295
295
|
expect(column.name).to eq '---hello world---'
|
296
296
|
end
|
297
297
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A small fast library for reading dBase, xBase, Clipper and FoxPro database
|
14
14
|
files.
|
@@ -29,7 +29,6 @@ files:
|
|
29
29
|
- README.md
|
30
30
|
- Rakefile
|
31
31
|
- bin/dbf
|
32
|
-
- ci_A.dbf
|
33
32
|
- dbf.gemspec
|
34
33
|
- lib/dbf.rb
|
35
34
|
- lib/dbf/column.rb
|
@@ -45,7 +44,6 @@ files:
|
|
45
44
|
- lib/dbf/schema.rb
|
46
45
|
- lib/dbf/table.rb
|
47
46
|
- lib/dbf/version.rb
|
48
|
-
- nBOOKS.DBF
|
49
47
|
- spec/dbf/column_spec.rb
|
50
48
|
- spec/dbf/database/foxpro_spec.rb
|
51
49
|
- spec/dbf/file_formats_spec.rb
|
@@ -99,7 +97,8 @@ files:
|
|
99
97
|
homepage: http://github.com/infused/dbf
|
100
98
|
licenses:
|
101
99
|
- MIT
|
102
|
-
metadata:
|
100
|
+
metadata:
|
101
|
+
rubygems_mfa_required: 'true'
|
103
102
|
post_install_message:
|
104
103
|
rdoc_options:
|
105
104
|
- "--charset=UTF-8"
|
@@ -116,13 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
115
|
- !ruby/object:Gem::Version
|
117
116
|
version: 1.3.0
|
118
117
|
requirements: []
|
119
|
-
rubygems_version: 3.
|
118
|
+
rubygems_version: 3.4.13
|
120
119
|
signing_key:
|
121
120
|
specification_version: 4
|
122
121
|
summary: Read xBase files
|
123
|
-
test_files:
|
124
|
-
- spec/dbf/column_spec.rb
|
125
|
-
- spec/dbf/database/foxpro_spec.rb
|
126
|
-
- spec/dbf/file_formats_spec.rb
|
127
|
-
- spec/dbf/record_spec.rb
|
128
|
-
- spec/dbf/table_spec.rb
|
122
|
+
test_files: []
|
data/ci_A.dbf
DELETED
Binary file
|
data/nBOOKS.DBF
DELETED
Binary file
|