dbf 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 2.0.8
2
+ - fix FoxPro currency fields on some builds of Ruby 1.9.3 and 2.0.0
3
+
1
4
  # 2.0.7
2
5
  - fix the dbf binary on some linux systems
3
6
 
data/Gemfile CHANGED
@@ -1,2 +1,10 @@
1
1
  gemspec
2
2
  source 'https://rubygems.org'
3
+
4
+ gem 'rubysl', :platform => :rbx
5
+
6
+ group :development, :test do
7
+ gem 'rspec'
8
+ gem 'guard'
9
+ gem 'guard-rspec'
10
+ end
data/Gemfile.lock CHANGED
@@ -1,29 +1,266 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dbf (2.0.6)
4
+ dbf (2.0.7)
5
5
  fastercsv (~> 1.5.4)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- diff-lcs (1.2.4)
10
+ celluloid (0.15.2)
11
+ timers (~> 1.1.0)
12
+ coderay (1.1.0)
13
+ diff-lcs (1.2.5)
11
14
  fastercsv (1.5.5)
12
- rake (10.1.0)
13
- rspec (2.14.1)
14
- rspec-core (~> 2.14.0)
15
- rspec-expectations (~> 2.14.0)
16
- rspec-mocks (~> 2.14.0)
17
- rspec-core (2.14.2)
18
- rspec-expectations (2.14.0)
19
- diff-lcs (>= 1.1.3, < 2.0)
20
- rspec-mocks (2.14.1)
15
+ ffi (1.9.3)
16
+ ffi2-generators (0.1.1)
17
+ formatador (0.2.5)
18
+ guard (2.6.1)
19
+ formatador (>= 0.2.4)
20
+ listen (~> 2.7)
21
+ lumberjack (~> 1.0)
22
+ pry (>= 0.9.12)
23
+ thor (>= 0.18.1)
24
+ guard-rspec (4.2.9)
25
+ guard (~> 2.1)
26
+ rspec (>= 2.14, < 4.0)
27
+ listen (2.7.7)
28
+ celluloid (>= 0.15.2)
29
+ rb-fsevent (>= 0.9.3)
30
+ rb-inotify (>= 0.9)
31
+ lumberjack (1.0.6)
32
+ method_source (0.8.2)
33
+ pry (0.9.12.6)
34
+ coderay (~> 1.0)
35
+ method_source (~> 0.8)
36
+ slop (~> 3.4)
37
+ rb-fsevent (0.9.4)
38
+ rb-inotify (0.9.5)
39
+ ffi (>= 0.5.0)
40
+ rspec (3.0.0)
41
+ rspec-core (~> 3.0.0)
42
+ rspec-expectations (~> 3.0.0)
43
+ rspec-mocks (~> 3.0.0)
44
+ rspec-core (3.0.0)
45
+ rspec-support (~> 3.0.0)
46
+ rspec-expectations (3.0.0)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.0.0)
49
+ rspec-mocks (3.0.0)
50
+ rspec-support (~> 3.0.0)
51
+ rspec-support (3.0.0)
52
+ rubysl (2.0.15)
53
+ rubysl-abbrev (~> 2.0)
54
+ rubysl-base64 (~> 2.0)
55
+ rubysl-benchmark (~> 2.0)
56
+ rubysl-bigdecimal (~> 2.0)
57
+ rubysl-cgi (~> 2.0)
58
+ rubysl-cgi-session (~> 2.0)
59
+ rubysl-cmath (~> 2.0)
60
+ rubysl-complex (~> 2.0)
61
+ rubysl-continuation (~> 2.0)
62
+ rubysl-coverage (~> 2.0)
63
+ rubysl-csv (~> 2.0)
64
+ rubysl-curses (~> 2.0)
65
+ rubysl-date (~> 2.0)
66
+ rubysl-delegate (~> 2.0)
67
+ rubysl-digest (~> 2.0)
68
+ rubysl-drb (~> 2.0)
69
+ rubysl-e2mmap (~> 2.0)
70
+ rubysl-english (~> 2.0)
71
+ rubysl-enumerator (~> 2.0)
72
+ rubysl-erb (~> 2.0)
73
+ rubysl-etc (~> 2.0)
74
+ rubysl-expect (~> 2.0)
75
+ rubysl-fcntl (~> 2.0)
76
+ rubysl-fiber (~> 2.0)
77
+ rubysl-fileutils (~> 2.0)
78
+ rubysl-find (~> 2.0)
79
+ rubysl-forwardable (~> 2.0)
80
+ rubysl-getoptlong (~> 2.0)
81
+ rubysl-gserver (~> 2.0)
82
+ rubysl-io-console (~> 2.0)
83
+ rubysl-io-nonblock (~> 2.0)
84
+ rubysl-io-wait (~> 2.0)
85
+ rubysl-ipaddr (~> 2.0)
86
+ rubysl-irb (~> 2.0)
87
+ rubysl-logger (~> 2.0)
88
+ rubysl-mathn (~> 2.0)
89
+ rubysl-matrix (~> 2.0)
90
+ rubysl-mkmf (~> 2.0)
91
+ rubysl-monitor (~> 2.0)
92
+ rubysl-mutex_m (~> 2.0)
93
+ rubysl-net-ftp (~> 2.0)
94
+ rubysl-net-http (~> 2.0)
95
+ rubysl-net-imap (~> 2.0)
96
+ rubysl-net-pop (~> 2.0)
97
+ rubysl-net-protocol (~> 2.0)
98
+ rubysl-net-smtp (~> 2.0)
99
+ rubysl-net-telnet (~> 2.0)
100
+ rubysl-nkf (~> 2.0)
101
+ rubysl-observer (~> 2.0)
102
+ rubysl-open-uri (~> 2.0)
103
+ rubysl-open3 (~> 2.0)
104
+ rubysl-openssl (~> 2.0)
105
+ rubysl-optparse (~> 2.0)
106
+ rubysl-ostruct (~> 2.0)
107
+ rubysl-pathname (~> 2.0)
108
+ rubysl-prettyprint (~> 2.0)
109
+ rubysl-prime (~> 2.0)
110
+ rubysl-profile (~> 2.0)
111
+ rubysl-profiler (~> 2.0)
112
+ rubysl-pstore (~> 2.0)
113
+ rubysl-pty (~> 2.0)
114
+ rubysl-rational (~> 2.0)
115
+ rubysl-readline (~> 2.0)
116
+ rubysl-resolv (~> 2.0)
117
+ rubysl-rexml (~> 2.0)
118
+ rubysl-rinda (~> 2.0)
119
+ rubysl-rss (~> 2.0)
120
+ rubysl-scanf (~> 2.0)
121
+ rubysl-securerandom (~> 2.0)
122
+ rubysl-set (~> 2.0)
123
+ rubysl-shellwords (~> 2.0)
124
+ rubysl-singleton (~> 2.0)
125
+ rubysl-socket (~> 2.0)
126
+ rubysl-stringio (~> 2.0)
127
+ rubysl-strscan (~> 2.0)
128
+ rubysl-sync (~> 2.0)
129
+ rubysl-syslog (~> 2.0)
130
+ rubysl-tempfile (~> 2.0)
131
+ rubysl-thread (~> 2.0)
132
+ rubysl-thwait (~> 2.0)
133
+ rubysl-time (~> 2.0)
134
+ rubysl-timeout (~> 2.0)
135
+ rubysl-tmpdir (~> 2.0)
136
+ rubysl-tsort (~> 2.0)
137
+ rubysl-un (~> 2.0)
138
+ rubysl-uri (~> 2.0)
139
+ rubysl-weakref (~> 2.0)
140
+ rubysl-webrick (~> 2.0)
141
+ rubysl-xmlrpc (~> 2.0)
142
+ rubysl-yaml (~> 2.0)
143
+ rubysl-zlib (~> 2.0)
144
+ rubysl-abbrev (2.0.4)
145
+ rubysl-base64 (2.0.0)
146
+ rubysl-benchmark (2.0.1)
147
+ rubysl-bigdecimal (2.0.2)
148
+ rubysl-cgi (2.0.1)
149
+ rubysl-cgi-session (2.0.1)
150
+ rubysl-cmath (2.0.0)
151
+ rubysl-complex (2.0.0)
152
+ rubysl-continuation (2.0.0)
153
+ rubysl-coverage (2.0.3)
154
+ rubysl-csv (2.0.2)
155
+ rubysl-english (~> 2.0)
156
+ rubysl-curses (2.0.1)
157
+ rubysl-date (2.0.6)
158
+ rubysl-delegate (2.0.1)
159
+ rubysl-digest (2.0.3)
160
+ rubysl-drb (2.0.1)
161
+ rubysl-e2mmap (2.0.0)
162
+ rubysl-english (2.0.0)
163
+ rubysl-enumerator (2.0.0)
164
+ rubysl-erb (2.0.1)
165
+ rubysl-etc (2.0.3)
166
+ ffi2-generators (~> 0.1)
167
+ rubysl-expect (2.0.0)
168
+ rubysl-fcntl (2.0.4)
169
+ ffi2-generators (~> 0.1)
170
+ rubysl-fiber (2.0.0)
171
+ rubysl-fileutils (2.0.3)
172
+ rubysl-find (2.0.1)
173
+ rubysl-forwardable (2.0.1)
174
+ rubysl-getoptlong (2.0.0)
175
+ rubysl-gserver (2.0.0)
176
+ rubysl-socket (~> 2.0)
177
+ rubysl-thread (~> 2.0)
178
+ rubysl-io-console (2.0.0)
179
+ rubysl-io-nonblock (2.0.0)
180
+ rubysl-io-wait (2.0.0)
181
+ rubysl-ipaddr (2.0.0)
182
+ rubysl-irb (2.0.4)
183
+ rubysl-e2mmap (~> 2.0)
184
+ rubysl-mathn (~> 2.0)
185
+ rubysl-readline (~> 2.0)
186
+ rubysl-thread (~> 2.0)
187
+ rubysl-logger (2.0.0)
188
+ rubysl-mathn (2.0.0)
189
+ rubysl-matrix (2.1.0)
190
+ rubysl-e2mmap (~> 2.0)
191
+ rubysl-mkmf (2.0.1)
192
+ rubysl-fileutils (~> 2.0)
193
+ rubysl-shellwords (~> 2.0)
194
+ rubysl-monitor (2.0.0)
195
+ rubysl-mutex_m (2.0.0)
196
+ rubysl-net-ftp (2.0.1)
197
+ rubysl-net-http (2.0.4)
198
+ rubysl-cgi (~> 2.0)
199
+ rubysl-erb (~> 2.0)
200
+ rubysl-singleton (~> 2.0)
201
+ rubysl-net-imap (2.0.1)
202
+ rubysl-net-pop (2.0.1)
203
+ rubysl-net-protocol (2.0.1)
204
+ rubysl-net-smtp (2.0.1)
205
+ rubysl-net-telnet (2.0.0)
206
+ rubysl-nkf (2.0.1)
207
+ rubysl-observer (2.0.0)
208
+ rubysl-open-uri (2.0.0)
209
+ rubysl-open3 (2.0.0)
210
+ rubysl-openssl (2.1.0)
211
+ rubysl-optparse (2.0.1)
212
+ rubysl-shellwords (~> 2.0)
213
+ rubysl-ostruct (2.0.4)
214
+ rubysl-pathname (2.0.0)
215
+ rubysl-prettyprint (2.0.3)
216
+ rubysl-prime (2.0.1)
217
+ rubysl-profile (2.0.0)
218
+ rubysl-profiler (2.0.1)
219
+ rubysl-pstore (2.0.0)
220
+ rubysl-pty (2.0.2)
221
+ rubysl-rational (2.0.1)
222
+ rubysl-readline (2.0.2)
223
+ rubysl-resolv (2.1.0)
224
+ rubysl-rexml (2.0.2)
225
+ rubysl-rinda (2.0.1)
226
+ rubysl-rss (2.0.0)
227
+ rubysl-scanf (2.0.0)
228
+ rubysl-securerandom (2.0.0)
229
+ rubysl-set (2.0.1)
230
+ rubysl-shellwords (2.0.0)
231
+ rubysl-singleton (2.0.0)
232
+ rubysl-socket (2.0.1)
233
+ rubysl-stringio (2.0.0)
234
+ rubysl-strscan (2.0.0)
235
+ rubysl-sync (2.0.0)
236
+ rubysl-syslog (2.0.1)
237
+ ffi2-generators (~> 0.1)
238
+ rubysl-tempfile (2.0.1)
239
+ rubysl-thread (2.0.2)
240
+ rubysl-thwait (2.0.0)
241
+ rubysl-time (2.0.3)
242
+ rubysl-timeout (2.0.0)
243
+ rubysl-tmpdir (2.0.1)
244
+ rubysl-tsort (2.0.1)
245
+ rubysl-un (2.0.0)
246
+ rubysl-fileutils (~> 2.0)
247
+ rubysl-optparse (~> 2.0)
248
+ rubysl-uri (2.0.0)
249
+ rubysl-weakref (2.0.0)
250
+ rubysl-webrick (2.0.0)
251
+ rubysl-xmlrpc (2.0.0)
252
+ rubysl-yaml (2.0.4)
253
+ rubysl-zlib (2.0.1)
254
+ slop (3.5.0)
255
+ thor (0.19.1)
256
+ timers (1.1.0)
21
257
 
22
258
  PLATFORMS
23
- java
24
259
  ruby
25
260
 
26
261
  DEPENDENCIES
27
262
  dbf!
28
- rake (>= 0.9.2)
263
+ guard
264
+ guard-rspec
29
265
  rspec
266
+ rubysl
data/Gemfile.travis ADDED
@@ -0,0 +1,9 @@
1
+ gemspec
2
+ source 'https://rubygems.org'
3
+
4
+ gem 'rubysl', :platform => :rbx
5
+
6
+ group :test do
7
+ gem 'rspec'
8
+ gem 'codeclimate-test-reporter', :require => false, :platform => :ruby
9
+ end
data/Gemfile.travis18 ADDED
@@ -0,0 +1,8 @@
1
+ gemspec
2
+ source 'https://rubygems.org'
3
+
4
+ gem 'rubysl', :platform => :rbx
5
+
6
+ group :test do
7
+ gem 'rspec'
8
+ end
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2011 Keith Morrison <keithm@infused.org>
1
+ Copyright (c) 2006-2014 Keith Morrison <keithm@infused.org>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # DBF
2
- [![Build Status](https://secure.travis-ci.org/infused/dbf.png)](http://travis-ci.org/infused/dbf)
3
- [![Gem Version](https://badge.fury.io/rb/dbf.png)](http://badge.fury.io/rb/dbf)
4
- [![Code Climate](https://codeclimate.com/github/infused/dbf.png)](https://codeclimate.com/github/infused/dbf)
5
- [![Dependency Status](https://gemnasium.com/infused/dbf.png)](https://gemnasium.com/infused/dbf)
2
+ [![Version](http://img.shields.io/gem/v/dbf.svg?style=flat)](https://rubygems.org/gems/dbf)
3
+ [![Build Status](http://img.shields.io/travis/infused/dbf/master.svg?style=flat)](http://travis-ci.org/infused/dbf)
4
+ [![Code Quality](http://img.shields.io/codeclimate/github/infused/dbf.svg?style=flat)](https://codeclimate.com/github/infused/dbf)
5
+ [![Test Coverage](http://img.shields.io/codeclimate/coverage/github/infused/dbf.svg?style=flat)](https://codeclimate.com/github/infused/dbf)
6
+ [![Dependency Status](http://img.shields.io/gemnasium/infused/dbf.svg?style=flat)](https://gemnasium.com/infused/dbf)
6
7
 
7
8
  DBF is a small fast library for reading dBase, xBase, Clipper and FoxPro
8
9
  database files
9
10
 
10
11
  * Project page: <http://github.com/infused/dbf>
11
- * API Documentation: <http://rubydoc.info/github/infused/dbf/frames>
12
+ * API Documentation: <http://rubydoc.info/github/infused/dbf/>
12
13
  * Report bugs: <http://github.com/infused/dbf/issues>
13
14
  * Questions: Email <mailto:keithm@infused.org> and put DBF somewhere in the
14
15
  subject line
@@ -17,32 +18,40 @@ database files
17
18
 
18
19
  DBF is tested to work with the following versions of ruby:
19
20
 
20
- * MRI Ruby 1.8.6, 1.8.7, 1.9.1, 1.9.2, 1.9.3, 2.0.0
21
- * JRuby 1.6.x, 1.7.x
21
+ * MRI Ruby 1.8.6, 1.8.7, 1.9.1, 1.9.2, 1.9.3, 2.0.x, 2.1.x
22
+ * JRuby 1.7.x (1.8 and 1.9 modes), JRuby head
22
23
  * REE 1.8.7
23
- * Rubinius (1.8 and 1.9 modes)
24
+ * Rubinius 2.1+
24
25
 
25
26
  ## Installation
26
27
 
27
- gem install dbf
28
+ ```
29
+ gem install dbf
30
+ ```
28
31
 
29
32
  ## Basic Usage
30
33
 
31
34
  Open a DBF file:
32
35
 
33
- require 'dbf'
34
- widgets = DBF::Table.new("widgets.dbf")
36
+ ```ruby
37
+ require 'dbf'
38
+ widgets = DBF::Table.new("widgets.dbf")
39
+ ```
35
40
 
36
41
  Enumerate all records
37
42
 
38
- widgets.each do |record|
39
- puts record.name
40
- puts record.email
41
- end
43
+ ```ruby
44
+ widgets.each do |record|
45
+ puts record.name
46
+ puts record.email
47
+ end
48
+ ```
42
49
 
43
50
  Find a single record
44
51
 
45
- widget = widgets.find(6)
52
+ ```ruby
53
+ widget = widgets.find(6)
54
+ ```
46
55
 
47
56
  Note that find() will return nil if the requested record has been deleted
48
57
  and not yet pruned from the database.
@@ -50,32 +59,44 @@ and not yet pruned from the database.
50
59
  The value for a attribute can be accessed via element reference in one of three
51
60
  ways
52
61
 
53
- widget["SlotNumber"] # original field name in dbf file
54
- widget['slot_number'] # underscored field name string
55
- widget[:slot_number] # underscored field name symbol
62
+ ```ruby
63
+ widget["SlotNumber"] # original field name in dbf file
64
+ widget['slot_number'] # underscored field name string
65
+ widget[:slot_number] # underscored field name symbol
66
+ ```
67
+
68
+ Attributes can also be accessed as method using the underscored field name
69
+
70
+ ```ruby
71
+ widget.slot_number
72
+ ```
56
73
 
57
74
  Get a hash of all attributes. The keys are the original column names.
58
75
 
59
- widgets.attributes
60
- => {"Name" => "Thing1", "SlotNumber" => 1}
76
+ ```ruby
77
+ widget.attributes
78
+ # => {"Name" => "Thing1", "SlotNumber" => 1}
79
+ ```
61
80
 
62
81
  Search for records using a simple hash format. Multiple search criteria are
63
82
  ANDed. Use the block form if the resulting recordset could be large, otherwise
64
83
  all records will be loaded into memory.
65
84
 
66
- # find all records with slot_number equal to s42
67
- widgets.find(:all, :slot_number => 's42') do |widget|
68
- # the record will be nil if deleted, but not yet pruned from the database
69
- if widget
70
- puts widget.serial_number
71
- end
72
- end
85
+ ```ruby
86
+ # find all records with slot_number equal to s42
87
+ widgets.find(:all, :slot_number => 's42') do |widget|
88
+ # the record will be nil if deleted, but not yet pruned from the database
89
+ if widget
90
+ puts widget.serial_number
91
+ end
92
+ end
73
93
 
74
- # find the first record with slot_number equal to s42
75
- widgets.find :first, :slot_number => 's42'
94
+ # find the first record with slot_number equal to s42
95
+ widgets.find :first, :slot_number => 's42'
76
96
 
77
- # find record number 10
78
- widgets.find(10)
97
+ # find record number 10
98
+ widgets.find(10)
99
+ ```
79
100
 
80
101
  ## Encodings (Code Pages)
81
102
 
@@ -84,7 +105,9 @@ Unfortunately, the format used is not always set, so you may have to specify it
84
105
  manually. For example, you have a DBF file from Russia and you are getting bad
85
106
  data. Try using the 'Russion OEM' encoding:
86
107
 
87
- table = DBF::Table.new('dbf/books.dbf', nil, 'cp866')
108
+ ```ruby
109
+ table = DBF::Table.new('dbf/books.dbf', nil, 'cp866')
110
+ ```
88
111
 
89
112
  See
90
113
  [doc/supported_encodings.csv](docs/supported_encodings.csv)
@@ -94,25 +117,27 @@ for a full list of supported encodings.
94
117
 
95
118
  An example of migrating a DBF book table to ActiveRecord using a migration:
96
119
 
97
- require 'dbf'
98
-
99
- class Book < ActiveRecord::Base; end
120
+ ```ruby
121
+ require 'dbf'
100
122
 
101
- class CreateBooks < ActiveRecord::Migration
102
- def self.up
103
- table = DBF::Table.new('db/dbf/books.dbf')
104
- eval(table.schema)
123
+ class Book < ActiveRecord::Base; end
105
124
 
106
- Book.reset_column_information
107
- table.each do |record|
108
- Book.create(:title => record.title, :author => record.author)
109
- end
110
- end
125
+ class CreateBooks < ActiveRecord::Migration
126
+ def self.up
127
+ table = DBF::Table.new('db/dbf/books.dbf')
128
+ eval(table.schema)
111
129
 
112
- def self.down
113
- drop_table :books
114
- end
130
+ Book.reset_column_information
131
+ table.each do |record|
132
+ Book.create(:title => record.title, :author => record.author)
115
133
  end
134
+ end
135
+
136
+ def self.down
137
+ drop_table :books
138
+ end
139
+ end
140
+ ```
116
141
 
117
142
  ## Command-line utility
118
143
 
@@ -152,7 +177,7 @@ for a full list of supported column types.
152
177
 
153
178
  ## License
154
179
 
155
- Copyright (c) 2006-2013 Keith Morrison <<keithm@infused.org>>
180
+ Copyright (c) 2006-2014 Keith Morrison <<keithm@infused.org>>
156
181
 
157
182
  Permission is hereby granted, free of charge, to any person
158
183
  obtaining a copy of this software and associated documentation