mdb 0.0.3.rc1 → 0.0.3.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mdb/database.rb +2 -2
- data/lib/mdb/version.rb +1 -1
- data/test/data/Example2000.mdb +0 -0
- data/test/data/Example2003.mdb +0 -0
- data/test/database_test.rb +10 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac63a2b0219c152eff3d37c0029f8e3471a787f4
|
4
|
+
data.tar.gz: 7d6937a4f8ab0d8942d2c451d0eb2745bc7ad4a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1142dc53590c1242d2773d23746fdcb74299093b6ffd01ffe274017e4215883e88f17e73e8080d521fc9522ca14e94350ee99c434792fb133b7fc179311a3b1
|
7
|
+
data.tar.gz: 6720b9759d88626407d785570e1c6a9763047daeccff5d2fd7f25372952640479aca454ec229b679aa33f25e76b8348dd3757301575ef1a7133d6b25a1a96f47
|
data/lib/mdb/database.rb
CHANGED
@@ -35,7 +35,7 @@ module Mdb
|
|
35
35
|
|
36
36
|
|
37
37
|
def read_csv(table)
|
38
|
-
csv = execute "mdb-export -d \\| #{file_name} #{table}"
|
38
|
+
csv = execute "mdb-export -D '%F %T' -d \\| #{file_name} #{table}"
|
39
39
|
empty_table!(table) if csv.empty?
|
40
40
|
csv
|
41
41
|
end
|
@@ -104,7 +104,7 @@ module Mdb
|
|
104
104
|
|
105
105
|
|
106
106
|
def open_csv(table)
|
107
|
-
command = "mdb-export -d #{Shellwords.escape(delimiter)} #{file_name} #{table}"
|
107
|
+
command = "mdb-export -D '%F %T' -d #{Shellwords.escape(delimiter)} #{file_name} #{table}"
|
108
108
|
Open3.popen3(command) do |stdin, stdout, stderr|
|
109
109
|
yield CSV.new(stdout, col_sep: delimiter)
|
110
110
|
end
|
data/lib/mdb/version.rb
CHANGED
data/test/data/Example2000.mdb
CHANGED
Binary file
|
data/test/data/Example2003.mdb
CHANGED
Binary file
|
data/test/database_test.rb
CHANGED
@@ -35,10 +35,7 @@ class MdbTest < ActiveSupport::TestCase
|
|
35
35
|
test "should raise an exception when mdb-tools is not installed" do
|
36
36
|
assert_raises(Mdb::MdbToolsNotInstalledError) do
|
37
37
|
database = Mdb.open "#{File.dirname(__FILE__)}/data/Example2000.mdb"
|
38
|
-
|
39
|
-
# This test assumes that the tool `which` is in `/usr/bin`
|
40
|
-
# while `mdb-export` et al are installed elsewhere.
|
41
|
-
with_env "PATH" => "/usr/bin" do
|
38
|
+
with_env "PATH" => "/nope" do
|
42
39
|
database.read :Villains
|
43
40
|
end
|
44
41
|
end
|
@@ -60,7 +57,7 @@ class MdbTest < ActiveSupport::TestCase
|
|
60
57
|
|
61
58
|
test "should return an array of columns for at able" do
|
62
59
|
database = Mdb.open "#{File.dirname(__FILE__)}/data/Example2000.mdb"
|
63
|
-
assert_equal [:ID, :FirstName, :LastName], database.columns(:Actors)
|
60
|
+
assert_equal [:ID, :FirstName, :LastName, :Birthdate], database.columns(:Actors)
|
64
61
|
end
|
65
62
|
|
66
63
|
test "should treat quotation marks correctly" do
|
@@ -71,6 +68,14 @@ class MdbTest < ActiveSupport::TestCase
|
|
71
68
|
|
72
69
|
|
73
70
|
|
71
|
+
test "should format dates ISO 8601" do
|
72
|
+
database = Mdb.open "#{File.dirname(__FILE__)}/data/Example2000.mdb"
|
73
|
+
actor = database.read(:Actors).first
|
74
|
+
assert_equal "1981-06-13 00:00:00", actor[:Birthdate]
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
|
74
79
|
private
|
75
80
|
|
76
81
|
def with_env(new_env)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.3.
|
4
|
+
version: 0.0.3.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|