flattendb 0.0.1.96 → 0.0.2.162
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/Rakefile +17 -19
- data/bin/flattendb +98 -36
- data/bin/flattendb.mdb +54 -0
- data/bin/flattendb.mysql +4 -11
- data/lib/flattendb/base.rb +41 -1
- data/lib/flattendb/cli.rb +79 -0
- data/lib/flattendb/types/mdb.rb +53 -0
- data/lib/flattendb/{mysql.rb → types/mysql.rb} +3 -33
- data/lib/flattendb/version.rb +1 -1
- metadata +87 -68
data/README
CHANGED
data/Rakefile
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'hen'
|
3
|
+
rescue LoadError
|
4
|
+
abort "Please install the 'hen' gem first."
|
5
|
+
end
|
2
6
|
|
3
|
-
|
4
|
-
EXECS = FileList['bin/*'].to_a
|
5
|
-
RDOCS = %w[README COPYING ChangeLog]
|
6
|
-
OTHER = FileList['[A-Z]*', 'example/*'].to_a
|
7
|
+
require 'lib/flattendb/version'
|
7
8
|
|
8
|
-
|
9
|
-
:
|
10
|
-
|
11
|
-
}
|
9
|
+
Hen.lay! {{
|
10
|
+
:rubyforge => {
|
11
|
+
:package => 'flattendb'
|
12
|
+
},
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
:executables => EXECS,
|
21
|
-
:extra_rdoc_files => RDOCS,
|
22
|
-
:dependencies => %w[highline mysql libxml-ruby builder]
|
14
|
+
:gem => {
|
15
|
+
:version => FlattenDB::VERSION,
|
16
|
+
:summary => 'Flatten relational databases.',
|
17
|
+
:files => FileList['lib/**/*.rb', 'bin/*'].to_a,
|
18
|
+
:extra_files => FileList['[A-Z]*', 'example/*'].to_a,
|
19
|
+
:dependencies => %w[highline libxml-ruby builder ruby-nuggets]
|
20
|
+
}
|
23
21
|
}}
|
data/bin/flattendb
CHANGED
@@ -32,98 +32,160 @@ require 'optparse'
|
|
32
32
|
|
33
33
|
require 'rubygems'
|
34
34
|
require 'highline/import'
|
35
|
+
require 'nuggets/array/flatten_once'
|
35
36
|
|
36
37
|
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
37
38
|
|
38
39
|
require 'flattendb'
|
40
|
+
require 'flattendb/cli'
|
39
41
|
|
40
|
-
|
42
|
+
include FlattenDB::CLI
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
+
USAGE = "Usage: #{$0} [-h|--help] [options]"
|
45
|
+
abort USAGE if ARGV.empty?
|
46
|
+
|
47
|
+
$global_options = {
|
48
|
+
:type => :mysql,
|
49
|
+
:infiles => [],
|
50
|
+
:outfile => nil,
|
51
|
+
:confile => nil,
|
52
|
+
:keep => false,
|
53
|
+
:mysql => {
|
54
|
+
:intype => :xml
|
55
|
+
},
|
56
|
+
:mdb => {
|
57
|
+
:intype => :mdb
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
$opts_by_type = {
|
44
62
|
:mysql => {
|
45
|
-
:
|
46
|
-
:
|
63
|
+
:title => 'MySQL',
|
64
|
+
:opts => lambda { |opts|
|
65
|
+
opts.on('-x', '--mysql-xml', "Input file is of type XML [This is the default]") {
|
66
|
+
$global_options[:mysql][:intype] = :xml
|
67
|
+
}
|
68
|
+
opts.on('-s', '--sql', "Input file is of type SQL") {
|
69
|
+
$global_options[:mysql][:intype] = :sql
|
70
|
+
}
|
71
|
+
}
|
72
|
+
},
|
73
|
+
:mdb => {
|
74
|
+
:title => 'MS Access',
|
75
|
+
:opts => lambda { |opts|
|
76
|
+
opts.on('-m', '--mdb', "Input file is of type MDB [This is the default]") {
|
77
|
+
$global_options[:mdb][:intype] = :mdb
|
78
|
+
}
|
79
|
+
opts.on('-y', '--mdb-xml', "Input file is of type XML") {
|
80
|
+
$global_options[:mdb][:intype] = :xml
|
81
|
+
}
|
82
|
+
}
|
47
83
|
}
|
48
84
|
}
|
49
85
|
|
50
86
|
def type_options(type, opts, with_heading = true)
|
51
|
-
|
87
|
+
if type == :all
|
88
|
+
$opts_by_type.keys.sort_by { |t| t.to_s }.each { |t|
|
89
|
+
type_options(t, opts, with_heading)
|
90
|
+
}
|
91
|
+
else
|
92
|
+
opt = $opts_by_type[type.to_sym]
|
93
|
+
|
52
94
|
if with_heading
|
53
95
|
opts.separator ''
|
54
|
-
opts.separator "- #{
|
96
|
+
opts.separator " - [#{type}] #{opt[:title]}"
|
55
97
|
end
|
56
|
-
}
|
57
|
-
|
58
|
-
case type.to_sym
|
59
|
-
when :mysql
|
60
|
-
heading['MySQL']
|
61
98
|
|
62
|
-
|
63
|
-
$options[:mysql][:intype] = :xml
|
64
|
-
}
|
65
|
-
opts.on('-s', '--sql', "Input file is of type SQL") {
|
66
|
-
$options[:mysql][:intype] = :sql
|
67
|
-
}
|
68
|
-
opts.on('-k', '--keep', "Keep intermediate XML dump; only applies if input type is 'sql'") {
|
69
|
-
$options[:mysql][:keep] = true
|
70
|
-
}
|
99
|
+
opt[:opts][opts]
|
71
100
|
end
|
72
101
|
end
|
73
102
|
|
74
103
|
OptionParser.new { |opts|
|
75
104
|
opts.banner = USAGE
|
76
|
-
opts.separator ''
|
77
105
|
|
106
|
+
opts.separator ''
|
78
107
|
opts.separator 'Options:'
|
108
|
+
|
79
109
|
if $type
|
80
110
|
opts.separator " [-t, --type] TYPE OVERRIDE IN EFFECT (#{$type})"
|
81
111
|
else
|
82
|
-
opts.on('-t', '--type TYPE', "Type of database at hand [Default: #{$
|
83
|
-
$
|
112
|
+
opts.on('-t', '--type TYPE', "Type of database at hand [Default: #{$global_options[:type]}]") { |t|
|
113
|
+
$global_options[:type] = t.downcase.to_sym
|
84
114
|
}
|
85
115
|
end
|
86
116
|
|
117
|
+
opts.separator ''
|
118
|
+
|
119
|
+
opts.on('-i', '--input-files FILES...', "Input file(s); depending on the database type, multiple files may be given [REQUIRED]") { |f|
|
120
|
+
$global_options[:infiles] = f
|
121
|
+
}
|
122
|
+
|
123
|
+
opts.on('-o', '--output-file FILE', "Output file (flat XML) [REQUIRED]") { |f|
|
124
|
+
$global_options[:outfile] = f
|
125
|
+
}
|
126
|
+
|
127
|
+
opts.on('-c', '--config-file FILE', "Configuration file (YAML) [REQUIRED]") { |f|
|
128
|
+
$global_options[:confile] = f
|
129
|
+
}
|
130
|
+
|
131
|
+
opts.separator ''
|
132
|
+
|
133
|
+
opts.on('-k', '--keep', "Keep any intermediate files (generated XML dumps, etc.)") {
|
134
|
+
$global_options[:keep] = true
|
135
|
+
}
|
136
|
+
|
87
137
|
opts.separator ''
|
88
138
|
opts.separator 'Database-specific Options:'
|
89
139
|
|
90
140
|
if $type
|
91
141
|
type_options($type, opts, false)
|
92
142
|
else
|
93
|
-
|
94
|
-
type_options(t, opts)
|
95
|
-
}
|
143
|
+
type_options(:all, opts)
|
96
144
|
end
|
97
145
|
|
98
146
|
opts.separator ''
|
99
147
|
opts.separator 'Generic options:'
|
148
|
+
|
100
149
|
opts.on('-h', '--help', 'Print this help message and exit') {
|
101
150
|
abort opts.to_s
|
102
151
|
}
|
152
|
+
|
103
153
|
opts.on('--version', 'Print program version and exit') {
|
104
154
|
abort "#{File.basename($0)} v#{FlattenDB::VERSION}"
|
105
155
|
}
|
106
156
|
}.parse!
|
107
157
|
|
108
|
-
$type ||= $
|
109
|
-
$options = $
|
158
|
+
$type ||= $global_options[:type]
|
159
|
+
$options = $global_options[$type] || {}
|
110
160
|
|
111
161
|
# Load corresponding module
|
112
162
|
begin
|
113
|
-
require "flattendb/#{$type}"
|
163
|
+
require "flattendb/types/#{$type}"
|
114
164
|
rescue LoadError
|
115
165
|
abort "Database type '#{$type}' is not supported at the moment."
|
116
166
|
end
|
117
167
|
|
118
|
-
abort
|
168
|
+
abort "No output file specified" unless $global_options[:outfile]
|
169
|
+
abort "No configuration file specified" unless $global_options[:confile]
|
170
|
+
abort "Configuration file not found: #{confile}" unless File.readable?(confile)
|
119
171
|
|
120
|
-
$
|
172
|
+
$global_options[:infiles].each { |infile|
|
173
|
+
abort "Input file not found: #{infile}" unless File.readable?(infile)
|
174
|
+
}
|
121
175
|
|
122
|
-
|
176
|
+
$infiles = $global_options[:infiles]
|
177
|
+
$outfile = $global_options[:outfile]
|
178
|
+
$confile = $global_options[:confile]
|
123
179
|
|
124
180
|
# Load type-specific script
|
125
|
-
|
181
|
+
begin
|
182
|
+
load File.join(File.dirname(__FILE__), "flattendb.#{$type}")
|
183
|
+
rescue LoadError
|
184
|
+
# silently ignore
|
185
|
+
end
|
126
186
|
|
127
|
-
FlattenDB[$type].new($infile, $outfile,
|
187
|
+
FlattenDB[$type].new($infile || $infiles, $outfile, $confile).flatten!.to_xml
|
128
188
|
|
129
|
-
|
189
|
+
unless $global_options[:keep]
|
190
|
+
File.delete($dump_file) if $dump_file
|
191
|
+
end
|
data/bin/flattendb.mdb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#! /usr/bin/ruby
|
2
|
+
|
3
|
+
# vi:ft=ruby
|
4
|
+
|
5
|
+
#--
|
6
|
+
###############################################################################
|
7
|
+
# #
|
8
|
+
# flattendb -- Flatten relational databases #
|
9
|
+
# #
|
10
|
+
# Copyright (C) 2007 University of Cologne, #
|
11
|
+
# Albertus-Magnus-Platz, #
|
12
|
+
# 50932 Cologne, Germany #
|
13
|
+
# #
|
14
|
+
# Authors: #
|
15
|
+
# Jens Wille <jens.wille@uni-koeln.de> #
|
16
|
+
# #
|
17
|
+
# flattendb is free software; you can redistribute it and/or modify it under #
|
18
|
+
# the terms of the GNU General Public License as published by the Free #
|
19
|
+
# Software Foundation; either version 3 of the License, or (at your option) #
|
20
|
+
# any later version. #
|
21
|
+
# #
|
22
|
+
# flattendb is distributed in the hope that it will be useful, but WITHOUT #
|
23
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
24
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
25
|
+
# more details. #
|
26
|
+
# #
|
27
|
+
# You should have received a copy of the GNU General Public License along #
|
28
|
+
# with flattendb. If not, see <http://www.gnu.org/licenses/>. #
|
29
|
+
# #
|
30
|
+
###############################################################################
|
31
|
+
#++
|
32
|
+
|
33
|
+
if $0 == __FILE__
|
34
|
+
$type = :mdb
|
35
|
+
load File.join(File.dirname(__FILE__), 'flattendb')
|
36
|
+
else
|
37
|
+
case $options[:intype]
|
38
|
+
when :xml
|
39
|
+
$infiles.each { |infile|
|
40
|
+
abort "Input file doesn't seem to be a valid XML file, XML declaration missing: #{infile}" \
|
41
|
+
unless IO.read(infile, 6) == '<?xml '
|
42
|
+
}
|
43
|
+
when :mdb
|
44
|
+
tables_cmd = 'mdb-tables'
|
45
|
+
export_cmd = 'mdb-export'
|
46
|
+
|
47
|
+
require_commands(tables_cmd, export_cmd, :pkg => 'mdbtools')
|
48
|
+
require_libraries('fastercsv')
|
49
|
+
|
50
|
+
$infiles.map! { |infile|
|
51
|
+
$dump_file
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
data/bin/flattendb.mysql
CHANGED
@@ -34,25 +34,18 @@ if $0 == __FILE__
|
|
34
34
|
$type = :mysql
|
35
35
|
load File.join(File.dirname(__FILE__), 'flattendb')
|
36
36
|
else
|
37
|
+
$infile = $infiles.first
|
38
|
+
|
37
39
|
case $options[:intype]
|
38
40
|
when :xml
|
39
41
|
abort "Input file doesn't seem to be a valid XML file, XML declaration missing" \
|
40
42
|
unless IO.read($infile, 6) == '<?xml '
|
41
43
|
when :sql
|
42
|
-
require 'mysql'
|
43
|
-
|
44
44
|
mysql_cmd = 'mysql'
|
45
45
|
dump_cmd = 'mysqldump'
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
ENV['PATH'].split(':').each { |path|
|
50
|
-
throw :cmd_found if File.executable?(File.join(path, cmd))
|
51
|
-
}
|
52
|
-
|
53
|
-
abort "Command not found: #{cmd}"
|
54
|
-
end
|
55
|
-
}
|
47
|
+
require_commands(mysql_cmd, dump_cmd, :pkg => 'a suitable MySQL client')
|
48
|
+
require_libraries('mysql')
|
56
49
|
|
57
50
|
mysql_user = ask('Please enter the MySQL user name: ') \
|
58
51
|
{ |q| q.default = ENV['USER'] }
|
data/lib/flattendb/base.rb
CHANGED
@@ -26,6 +26,8 @@
|
|
26
26
|
###############################################################################
|
27
27
|
#++
|
28
28
|
|
29
|
+
require 'yaml'
|
30
|
+
|
29
31
|
require 'rubygems'
|
30
32
|
require 'builder'
|
31
33
|
|
@@ -58,9 +60,47 @@ module FlattenDB
|
|
58
60
|
protected
|
59
61
|
|
60
62
|
def inherited(klass)
|
61
|
-
types[klass.name.split('::')[1..-1].downcase.to_sym] = klass
|
63
|
+
types[klass.name.split('::')[1..-1].join('/').downcase.to_sym] = klass
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
attr_reader :root, :config, :input, :output
|
69
|
+
|
70
|
+
def initialize(infiles, outfile, config)
|
71
|
+
config = case config
|
72
|
+
when Hash
|
73
|
+
config
|
74
|
+
when String
|
75
|
+
# assume file name
|
76
|
+
YAML.load_file(config)
|
77
|
+
else
|
78
|
+
raise ArgumentError, "invalid config argument of type '#{config.class}'"
|
62
79
|
end
|
80
|
+
raise ArgumentError, "can't have more than one primary (root) table" if config.size > 1
|
81
|
+
|
82
|
+
(@root, @config), _ = *config # get "first" (and only) hash element
|
83
|
+
|
84
|
+
@input = [*infiles].map { |infile|
|
85
|
+
case infile
|
86
|
+
when String
|
87
|
+
infile
|
88
|
+
when File
|
89
|
+
infile.path
|
90
|
+
else
|
91
|
+
raise ArgumentError, "invalid infile argument of type '#{infile.class}'"
|
92
|
+
end
|
93
|
+
}
|
63
94
|
|
95
|
+
@output = case outfile
|
96
|
+
when IO
|
97
|
+
outfile
|
98
|
+
when String
|
99
|
+
# assume file name
|
100
|
+
File.open(outfile, 'w')
|
101
|
+
else
|
102
|
+
raise ArgumentError, "invalid outfile argument of type '#{outfile.class}'"
|
103
|
+
end
|
64
104
|
end
|
65
105
|
|
66
106
|
def flatten!(*args)
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#--
|
2
|
+
###############################################################################
|
3
|
+
# #
|
4
|
+
# A component of flattendb, the relational database flattener. #
|
5
|
+
# #
|
6
|
+
# Copyright (C) 2007 University of Cologne, #
|
7
|
+
# Albertus-Magnus-Platz, #
|
8
|
+
# 50932 Cologne, Germany #
|
9
|
+
# #
|
10
|
+
# Authors: #
|
11
|
+
# Jens Wille <jens.wille@uni-koeln.de> #
|
12
|
+
# #
|
13
|
+
# flattendb is free software; you can redistribute it and/or modify it under #
|
14
|
+
# the terms of the GNU General Public License as published by the Free #
|
15
|
+
# Software Foundation; either version 3 of the License, or (at your option) #
|
16
|
+
# any later version. #
|
17
|
+
# #
|
18
|
+
# flattendb is distributed in the hope that it will be useful, but WITHOUT #
|
19
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
21
|
+
# more details. #
|
22
|
+
# #
|
23
|
+
# You should have received a copy of the GNU General Public License along #
|
24
|
+
# with flattendb. If not, see <http://www.gnu.org/licenses/>. #
|
25
|
+
# #
|
26
|
+
###############################################################################
|
27
|
+
#++
|
28
|
+
|
29
|
+
module FlattenDB
|
30
|
+
|
31
|
+
module CLI
|
32
|
+
|
33
|
+
def require_libraries(*libraries)
|
34
|
+
parse_arguments(libraries, :gem).each { |lib, gem|
|
35
|
+
begin
|
36
|
+
require lib
|
37
|
+
rescue LoadError
|
38
|
+
abort_with_msg('Ruby library not found: %s', lib, 'Please install gem %s first', gem)
|
39
|
+
end
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def require_commands(*commands)
|
44
|
+
parse_arguments(commands, :pkg).each { |cmd, pkg|
|
45
|
+
catch :cmd_found do
|
46
|
+
ENV['PATH'].split(':').each { |path|
|
47
|
+
throw :cmd_found if File.executable?(File.join(path, cmd))
|
48
|
+
}
|
49
|
+
|
50
|
+
abort_with_msg("Command not found: #{cmd}", "Please install #{pkg} first", pkg || cmd)
|
51
|
+
end
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def abort_with_msg(msg1, arg1, msg2, arg2)
|
56
|
+
msg = msg1 % arg1
|
57
|
+
msg += " (#{msg2})" % (arg2 || arg1)
|
58
|
+
|
59
|
+
abort msg
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def parse_arguments(arguments, option)
|
65
|
+
options = arguments.last.is_a?(Hash) ? arguments.pop : {}
|
66
|
+
special = options.delete(option)
|
67
|
+
|
68
|
+
arguments.map { |arg|
|
69
|
+
[arg, special]
|
70
|
+
} + options.map { |args, spx|
|
71
|
+
[*args].map { |arg|
|
72
|
+
[arg, spx]
|
73
|
+
}
|
74
|
+
}.flatten_once
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#--
|
2
|
+
###############################################################################
|
3
|
+
# #
|
4
|
+
# A component of flattendb, the relational database flattener. #
|
5
|
+
# #
|
6
|
+
# Copyright (C) 2007 University of Cologne, #
|
7
|
+
# Albertus-Magnus-Platz, #
|
8
|
+
# 50932 Cologne, Germany #
|
9
|
+
# #
|
10
|
+
# Authors: #
|
11
|
+
# Jens Wille <jens.wille@uni-koeln.de> #
|
12
|
+
# #
|
13
|
+
# flattendb is free software; you can redistribute it and/or modify it under #
|
14
|
+
# the terms of the GNU General Public License as published by the Free #
|
15
|
+
# Software Foundation; either version 3 of the License, or (at your option) #
|
16
|
+
# any later version. #
|
17
|
+
# #
|
18
|
+
# flattendb is distributed in the hope that it will be useful, but WITHOUT #
|
19
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
21
|
+
# more details. #
|
22
|
+
# #
|
23
|
+
# You should have received a copy of the GNU General Public License along #
|
24
|
+
# with flattendb. If not, see <http://www.gnu.org/licenses/>. #
|
25
|
+
# #
|
26
|
+
###############################################################################
|
27
|
+
#++
|
28
|
+
|
29
|
+
require 'xml/libxml'
|
30
|
+
|
31
|
+
require 'flattendb/base'
|
32
|
+
|
33
|
+
module FlattenDB
|
34
|
+
|
35
|
+
class MDB < Base
|
36
|
+
|
37
|
+
JOIN_KEY = '@key'
|
38
|
+
|
39
|
+
def initialize(infiles, outfile, config)
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
43
|
+
def flatten!(options = {}, builder_options = {})
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_xml(output = output, builder_options = {})
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -26,7 +26,6 @@
|
|
26
26
|
###############################################################################
|
27
27
|
#++
|
28
28
|
|
29
|
-
require 'yaml'
|
30
29
|
require 'xml/libxml'
|
31
30
|
|
32
31
|
require 'flattendb/base'
|
@@ -37,41 +36,12 @@ module FlattenDB
|
|
37
36
|
|
38
37
|
JOIN_KEY = '@key'
|
39
38
|
|
40
|
-
attr_reader :
|
39
|
+
attr_reader :document, :database, :name, :tables, :builder
|
41
40
|
|
42
41
|
def initialize(infile, outfile, config)
|
43
|
-
|
44
|
-
when Hash
|
45
|
-
config
|
46
|
-
when String
|
47
|
-
# assume file name
|
48
|
-
YAML.load_file(config)
|
49
|
-
else
|
50
|
-
raise ArgumentError, "invalid config argument of type '#{config.class}'"
|
51
|
-
end
|
52
|
-
raise ArgumentError, "can't have more than one primary (root) table" if config.size > 1
|
53
|
-
|
54
|
-
(@root, @config), _ = *config # get "first" (and only) hash element
|
55
|
-
|
56
|
-
@output = case outfile
|
57
|
-
when IO
|
58
|
-
outfile
|
59
|
-
when String
|
60
|
-
# assume file name
|
61
|
-
File.open(outfile, 'w')
|
62
|
-
else
|
63
|
-
raise ArgumentError, "invalid outfile argument of type '#{outfile.class}'"
|
64
|
-
end
|
65
|
-
|
66
|
-
@document = XML::Document.file(case infile
|
67
|
-
when String
|
68
|
-
infile
|
69
|
-
when File
|
70
|
-
infile.path
|
71
|
-
else
|
72
|
-
raise ArgumentError, "invalid infile argument of type '#{infile.class}'"
|
73
|
-
end)
|
42
|
+
super
|
74
43
|
|
44
|
+
@document = XML::Document.file(@input.first)
|
75
45
|
@database = @document.root.find_first('database[@name]')
|
76
46
|
@name = @database[:name]
|
77
47
|
@tables = {}
|
data/lib/flattendb/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,116 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: flattendb
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-10-11 00:00:00 +02:00
|
8
|
-
summary: Flatten relational databases
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: jens.wille@uni-koeln.de
|
12
|
-
homepage:
|
13
|
-
rubyforge_project:
|
14
|
-
description:
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.0.2.162
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Jens Wille
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- lib/flattendb/mysql.rb
|
35
|
-
- lib/flattendb/base.rb
|
36
|
-
- bin/flattendb
|
37
|
-
- bin/flattendb.mysql
|
38
|
-
- COPYING
|
39
|
-
- README
|
40
|
-
- ChangeLog
|
41
|
-
- Rakefile
|
42
|
-
- example/mysql-sample.sql
|
43
|
-
- example/mysql-sample2flat.yaml
|
44
|
-
- example/mysql-sample.flat.xml
|
45
|
-
- example/mysql-sample.xml
|
46
|
-
test_files: []
|
47
|
-
|
48
|
-
rdoc_options: []
|
49
|
-
|
50
|
-
extra_rdoc_files:
|
51
|
-
- README
|
52
|
-
- COPYING
|
53
|
-
- ChangeLog
|
54
|
-
executables:
|
55
|
-
- flattendb
|
56
|
-
- flattendb.mysql
|
57
|
-
extensions: []
|
58
|
-
|
59
|
-
requirements: []
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
60
11
|
|
12
|
+
date: 2008-01-08 00:00:00 +01:00
|
13
|
+
default_executable:
|
61
14
|
dependencies:
|
62
15
|
- !ruby/object:Gem::Dependency
|
63
16
|
name: highline
|
64
17
|
version_requirement:
|
65
|
-
version_requirements: !ruby/object:Gem::
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
19
|
requirements:
|
67
|
-
- - "
|
20
|
+
- - ">="
|
68
21
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0
|
22
|
+
version: "0"
|
70
23
|
version:
|
71
24
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
25
|
+
name: libxml-ruby
|
73
26
|
version_requirement:
|
74
|
-
version_requirements: !ruby/object:Gem::
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
28
|
requirements:
|
76
|
-
- - "
|
29
|
+
- - ">="
|
77
30
|
- !ruby/object:Gem::Version
|
78
|
-
version: 0
|
31
|
+
version: "0"
|
79
32
|
version:
|
80
33
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
34
|
+
name: builder
|
82
35
|
version_requirement:
|
83
|
-
version_requirements: !ruby/object:Gem::
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
37
|
requirements:
|
85
|
-
- - "
|
38
|
+
- - ">="
|
86
39
|
- !ruby/object:Gem::Version
|
87
|
-
version: 0
|
40
|
+
version: "0"
|
88
41
|
version:
|
89
42
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
43
|
+
name: ruby-nuggets
|
91
44
|
version_requirement:
|
92
|
-
version_requirements: !ruby/object:Gem::
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
46
|
requirements:
|
94
|
-
- - "
|
47
|
+
- - ">="
|
95
48
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0
|
49
|
+
version: "0"
|
97
50
|
version:
|
51
|
+
description: Flatten relational databases.
|
52
|
+
email: jens.wille@uni-koeln.de
|
53
|
+
executables:
|
54
|
+
- flattendb
|
55
|
+
- flattendb.mysql
|
56
|
+
- flattendb.mdb
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- README
|
61
|
+
- COPYING
|
62
|
+
- ChangeLog
|
63
|
+
files:
|
64
|
+
- lib/flattendb/version.rb
|
65
|
+
- lib/flattendb/base.rb
|
66
|
+
- lib/flattendb/cli.rb
|
67
|
+
- lib/flattendb/types/mysql.rb
|
68
|
+
- lib/flattendb/types/mdb.rb
|
69
|
+
- lib/flattendb.rb
|
70
|
+
- bin/flattendb
|
71
|
+
- bin/flattendb.mysql
|
72
|
+
- bin/flattendb.mdb
|
73
|
+
- COPYING
|
74
|
+
- README
|
75
|
+
- ChangeLog
|
76
|
+
- Rakefile
|
77
|
+
- example/mysql-sample.sql
|
78
|
+
- example/mysql-sample2flat.yaml
|
79
|
+
- example/mysql-sample.flat.xml
|
80
|
+
- example/mysql-sample.xml
|
81
|
+
has_rdoc: true
|
82
|
+
homepage: http://prometheus.rubyforge.org/flattendb
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options:
|
85
|
+
- --all
|
86
|
+
- --inline-source
|
87
|
+
- --charset
|
88
|
+
- UTF-8
|
89
|
+
- --main
|
90
|
+
- README
|
91
|
+
- --title
|
92
|
+
- flattendb Application documentation
|
93
|
+
- --line-numbers
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: "0"
|
101
|
+
version:
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: "0"
|
107
|
+
version:
|
108
|
+
requirements: []
|
109
|
+
|
110
|
+
rubyforge_project: prometheus
|
111
|
+
rubygems_version: 1.0.1
|
112
|
+
signing_key:
|
113
|
+
specification_version: 2
|
114
|
+
summary: Flatten relational databases.
|
115
|
+
test_files: []
|
116
|
+
|