table_maker 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/lib/table_maker.rb +1 -1
- data/test/test_table_maker.rb +44 -0
- metadata +104 -84
data/Gemfile.lock
CHANGED
@@ -2,7 +2,6 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
git (1.2.5)
|
5
|
-
jdbc-sqlite3 (3.6.14.2.056-java)
|
6
5
|
jeweler (1.5.2)
|
7
6
|
bundler (~> 1.0.0)
|
8
7
|
git (>= 1.2.5)
|
@@ -11,6 +10,7 @@ GEM
|
|
11
10
|
rcov (0.9.9)
|
12
11
|
rcov (0.9.9-java)
|
13
12
|
sequel (3.20.0)
|
13
|
+
sqlite3 (1.3.3)
|
14
14
|
|
15
15
|
PLATFORMS
|
16
16
|
java
|
@@ -18,7 +18,7 @@ PLATFORMS
|
|
18
18
|
|
19
19
|
DEPENDENCIES
|
20
20
|
bundler (~> 1.0.0)
|
21
|
-
jdbc-sqlite3
|
22
21
|
jeweler (~> 1.5.2)
|
23
22
|
rcov
|
24
23
|
sequel
|
24
|
+
sqlite3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/lib/table_maker.rb
CHANGED
data/test/test_table_maker.rb
CHANGED
@@ -28,4 +28,48 @@ class TestTableMaker < Test::Unit::TestCase
|
|
28
28
|
]
|
29
29
|
assert_equal expected, ds.select(:id, :foo, :bar, :baz).order(:id).all
|
30
30
|
end
|
31
|
+
|
32
|
+
def test_manually_specified_id
|
33
|
+
db = Sequel.connect("#{RUBY_PLATFORM == 'java' ? "jdbc:" : ""}sqlite::memory:")
|
34
|
+
TableMaker.new(db, :foo, <<-EOF)
|
35
|
+
+-------------+-------------+-------------+--------------+
|
36
|
+
| id(Integer) | foo(String) | bar(String) | baz(Integer) |
|
37
|
+
+=============+=============+=============+==============+
|
38
|
+
| 31 | abc | def | 123 |
|
39
|
+
| 33 | ghi | jkl | 456 |
|
40
|
+
| 73 | mno | pqr | 789 |
|
41
|
+
| 13 | stu | vwx | 000 |
|
42
|
+
+-------------+-------------+-------------+--------------+
|
43
|
+
EOF
|
44
|
+
ds = db[:foo]
|
45
|
+
expected = [
|
46
|
+
{:id => 13, :foo => 'stu', :bar => 'vwx', :baz => 000},
|
47
|
+
{:id => 31, :foo => 'abc', :bar => 'def', :baz => 123},
|
48
|
+
{:id => 33, :foo => 'ghi', :bar => 'jkl', :baz => 456},
|
49
|
+
{:id => 73, :foo => 'mno', :bar => 'pqr', :baz => 789}
|
50
|
+
]
|
51
|
+
assert_equal expected, ds.select(:id, :foo, :bar, :baz).order(:id).all
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_blank_cells_are_null
|
55
|
+
db = Sequel.connect("#{RUBY_PLATFORM == 'java' ? "jdbc:" : ""}sqlite::memory:")
|
56
|
+
TableMaker.new(db, :foo, <<-EOF)
|
57
|
+
+-------------+-------------+--------------+
|
58
|
+
| foo(String) | bar(String) | baz(Integer) |
|
59
|
+
+=============+=============+==============+
|
60
|
+
| abc | | 123 |
|
61
|
+
| ghi | jkl | 456 |
|
62
|
+
| | pqr | |
|
63
|
+
| stu | vwx | 000 |
|
64
|
+
+-------------+-------------+--------------+
|
65
|
+
EOF
|
66
|
+
ds = db[:foo]
|
67
|
+
expected = [
|
68
|
+
{:id => 1, :foo => 'abc', :bar => nil, :baz => 123},
|
69
|
+
{:id => 2, :foo => 'ghi', :bar => 'jkl', :baz => 456},
|
70
|
+
{:id => 3, :foo => nil, :bar => 'pqr', :baz => nil},
|
71
|
+
{:id => 4, :foo => 'stu', :bar => 'vwx', :baz => 000}
|
72
|
+
]
|
73
|
+
assert_equal expected, ds.select(:id, :foo, :bar, :baz).order(:id).all
|
74
|
+
end
|
31
75
|
end
|
metadata
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
|
-
|
12
|
+
- Jeremy Stephens
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
@@ -13,61 +17,75 @@ cert_chain: []
|
|
13
17
|
date: 2011-03-01 00:00:00 -06:00
|
14
18
|
default_executable:
|
15
19
|
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: sequel
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
prerelease: false
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 1
|
42
|
+
- 0
|
43
|
+
- 0
|
44
|
+
version: 1.0.0
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: jeweler
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 1
|
57
|
+
- 5
|
58
|
+
- 2
|
59
|
+
version: 1.5.2
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rcov
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
type: :development
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: sqlite3
|
78
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: *id005
|
71
89
|
description: Simple ASCII table importer for Sequel
|
72
90
|
email: viking@pillageandplunder.net
|
73
91
|
executables: []
|
@@ -75,50 +93,52 @@ executables: []
|
|
75
93
|
extensions: []
|
76
94
|
|
77
95
|
extra_rdoc_files:
|
78
|
-
|
79
|
-
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.rdoc
|
80
98
|
files:
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
99
|
+
- .document
|
100
|
+
- Gemfile
|
101
|
+
- Gemfile.lock
|
102
|
+
- LICENSE.txt
|
103
|
+
- README.rdoc
|
104
|
+
- Rakefile
|
105
|
+
- VERSION
|
106
|
+
- lib/table_maker.rb
|
107
|
+
- test/helper.rb
|
108
|
+
- test/test_table_maker.rb
|
91
109
|
has_rdoc: true
|
92
110
|
homepage: http://github.com/viking/table_maker
|
93
111
|
licenses:
|
94
|
-
|
112
|
+
- MIT
|
95
113
|
post_install_message:
|
96
114
|
rdoc_options: []
|
97
115
|
|
98
116
|
require_paths:
|
99
|
-
|
117
|
+
- lib
|
100
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
119
|
none: false
|
102
120
|
requirements:
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
hash: 3180758858338140348
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
version: "0"
|
109
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
128
|
none: false
|
111
129
|
requirements:
|
112
|
-
|
113
|
-
|
114
|
-
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
115
135
|
requirements: []
|
116
136
|
|
117
137
|
rubyforge_project:
|
118
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.3.7
|
119
139
|
signing_key:
|
120
140
|
specification_version: 3
|
121
141
|
summary: Simple ASCII table importer for Sequel
|
122
142
|
test_files:
|
123
|
-
|
124
|
-
|
143
|
+
- test/helper.rb
|
144
|
+
- test/test_table_maker.rb
|