athena 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c029a5754a067e303b4c673f9904c91531fe1504
4
+ data.tar.gz: acc964603b8637cb8b1700225d50881a0d6e1b52
5
+ SHA512:
6
+ metadata.gz: c25e93d4cca0744459fa0650036eea7ce7ba4e20d14b1774234cb241ff0ac7d1c96a3cd1e34dfcbc18dbd2d4dcb16ce7450e28c1c12fdb282a3d7962c6297460
7
+ data.tar.gz: a5f9d1e45d874eaab1b1e0a952b9cc9ae8e648e63bb064aa2fcbb821aa763bc31b8b86c0463d47197ac4e310a615d75351389bd8a7a95a8171c3b9b315986177
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to athena version 0.2.3
5
+ This documentation refers to athena version 0.2.4
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -30,14 +30,16 @@ RubyForge project:: http://rubyforge.org/projects/prometheus
30
30
 
31
31
  == AUTHORS
32
32
 
33
- * Jens Wille <mailto:jens.wille@uni-koeln.de>
33
+ * Jens Wille <mailto:jens.wille@gmail.com>
34
34
 
35
35
 
36
36
  == LICENSE AND COPYRIGHT
37
37
 
38
- Copyright (C) 2007-2011 University of Cologne,
38
+ Copyright (C) 2007-2012 University of Cologne,
39
39
  Albertus-Magnus-Platz, 50923 Cologne, Germany
40
40
 
41
+ Copyright (C) 2013 Jens Wille
42
+
41
43
  athena is free software: you can redistribute it and/or modify it under the
42
44
  terms of the GNU Affero General Public License as published by the Free
43
45
  Software Foundation, either version 3 of the License, or (at your option)
data/Rakefile CHANGED
@@ -13,8 +13,8 @@ begin
13
13
  :version => Athena::VERSION,
14
14
  :summary => %q{Convert database files to various formats.},
15
15
  :author => %q{Jens Wille},
16
- :email => %q{jens.wille@uni-koeln.de},
17
- :dependencies => %w[builder xmlstreamin] << ['ruby-nuggets', '>= 0.8.1']
16
+ :email => %q{jens.wille@gmail.com},
17
+ :dependencies => %w[builder highline xmlstreamin] << ['ruby-nuggets', '>= 0.9.1']
18
18
  }
19
19
  }}
20
20
  rescue LoadError => err
data/bin/athena CHANGED
@@ -5,12 +5,14 @@
5
5
  # #
6
6
  # athena -- Convert database files to various formats #
7
7
  # #
8
- # Copyright (C) 2007-2011 University of Cologne, #
8
+ # Copyright (C) 2007-2012 University of Cologne, #
9
9
  # Albertus-Magnus-Platz, #
10
10
  # 50923 Cologne, Germany #
11
11
  # #
12
+ # Copyright (C) 2013 Jens Wille #
13
+ # #
12
14
  # Authors: #
13
- # Jens Wille <jens.wille@uni-koeln.de> #
15
+ # Jens Wille <jens.wille@gmail.com> #
14
16
  # #
15
17
  # athena is free software; you can redistribute it and/or modify it under the #
16
18
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # athena -- Convert database files to various formats #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -26,7 +28,6 @@
26
28
  ###############################################################################
27
29
  #++
28
30
 
29
- require 'strscan'
30
31
  require 'athena'
31
32
 
32
33
  module Athena::Formats
@@ -36,35 +37,25 @@ module Athena::Formats
36
37
  attr_reader :sql_parser
37
38
 
38
39
  def parse(input, &block)
39
- columns, table, num = Hash.new { |h, k| h[k] = [] }, nil, 0
40
-
41
- input.each { |line|
42
- case line = line.chomp
43
- when /\ACREATE\s+TABLE\s+`(.+?)`/i
44
- table = $1
45
- when /\A\s+`(.+?)`/i
46
- columns[table] << $1 if table
47
- when /\A\).*;\z/
48
- table = nil
49
- when /\AINSERT\s+INTO\s+`(.+?)`\s+VALUES\s*(.*);\z/i
50
- _columns = columns[$1]
51
- next if _columns.empty?
40
+ num = 0
52
41
 
53
- sql_parser.parse($2) { |row|
54
- Athena::Record.new(nil, block) { |record|
55
- row.each_with_index { |value, index|
56
- column = _columns[index] or next
42
+ sql_parser.parse(input) { |event, *args|
43
+ if event == :insert
44
+ _, _, columns, values = args
57
45
 
58
- if column == record_element
59
- record.instance_variable_set(:@id, value)
60
- end
61
-
62
- record.update(column, value.to_s, config[column])
63
- }
64
- }
46
+ Athena::Record.new(nil, block) { |record|
47
+ values.each_with_index { |value, index|
48
+ if column = columns[index]
49
+ if column == record_element
50
+ record.instance_variable_set(:@id, value)
51
+ end
65
52
 
66
- num += 1
53
+ record.update(column, value.to_s, config[column])
54
+ end
67
55
  }
56
+ }
57
+
58
+ num += 1
68
59
  end
69
60
  }
70
61
 
@@ -76,104 +67,7 @@ module Athena::Formats
76
67
  def init_in(*)
77
68
  @__record_element_ok__ = [String, nil]
78
69
  super
79
- @sql_parser = SQLParser.new
80
- end
81
-
82
- class SQLParser
83
-
84
- AST = Struct.new(:value)
85
-
86
- def self.parse(input)
87
- new.parse(input)
88
- end
89
-
90
- def parse(input)
91
- @input = StringScanner.new(input)
92
-
93
- rows, block_given = [], block_given?
94
-
95
- while result = parse_row
96
- row = result.value
97
- block_given ? yield(row) : rows << row
98
- break unless @input.scan(/,\s*/)
99
- end
100
-
101
- @input.scan(/;/) # optional
102
-
103
- error('Unexpected data') unless @input.eos?
104
-
105
- rows unless block_given
106
- end
107
-
108
- def parse_row
109
- return unless @input.scan(/\(/)
110
-
111
- row = []
112
-
113
- while result = parse_value
114
- row << result.value
115
- break unless @input.scan(/,\s*/)
116
- end
117
-
118
- error('Unclosed row') unless @input.scan(/\)/)
119
-
120
- AST.new(row)
121
- end
122
-
123
- def parse_value
124
- parse_string ||
125
- parse_number ||
126
- parse_keyword
127
- end
128
-
129
- def parse_string
130
- return unless @input.scan(/'/)
131
-
132
- string = ''
133
-
134
- while contents = parse_string_content || parse_string_escape
135
- string << contents.value
136
- end
137
-
138
- error('Unclosed string') unless @input.scan(/'/)
139
-
140
- AST.new(string)
141
- end
142
-
143
- def parse_string_content
144
- if @input.scan(/[^\\']+/)
145
- AST.new(@input.matched)
146
- end
147
- end
148
-
149
- def parse_string_escape
150
- if @input.scan(/\\[abtnvfr]/)
151
- AST.new(eval(%Q{"#{@input.matched}"}))
152
- elsif @input.scan(/\\.|''/)
153
- AST.new(@input.matched[-1, 1])
154
- end
155
- end
156
-
157
- def parse_number
158
- if @input.scan(/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/)
159
- AST.new(eval(@input.matched))
160
- end
161
- end
162
-
163
- def parse_keyword
164
- if @input.scan(/null/i)
165
- AST.new(nil)
166
- end
167
- end
168
-
169
- def error(message)
170
- if @input.eos?
171
- raise "Unexpected end of input (#{message})."
172
- else
173
- raise "#{message} at #{$.}:#{@input.pos}: #{@input.peek(16).inspect}"
174
- end
175
- end
176
-
70
+ @sql_parser = Util::MySQL::Parser.new
177
71
  end
178
72
 
179
73
  end
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -3,12 +3,14 @@
3
3
  # #
4
4
  # A component of athena, the database file converter. #
5
5
  # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
6
+ # Copyright (C) 2007-2012 University of Cologne, #
7
7
  # Albertus-Magnus-Platz, #
8
8
  # 50923 Cologne, Germany #
9
9
  # #
10
+ # Copyright (C) 2013 Jens Wille #
11
+ # #
10
12
  # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
13
+ # Jens Wille <jens.wille@gmail.com> #
12
14
  # #
13
15
  # athena is free software; you can redistribute it and/or modify it under the #
14
16
  # terms of the GNU Affero General Public License as published by the Free #
@@ -4,7 +4,7 @@ module Athena
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 2
7
- TINY = 3
7
+ TINY = 4
8
8
 
9
9
  class << self
10
10
 
metadata CHANGED
@@ -1,66 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: athena
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
5
- prerelease:
4
+ version: 0.2.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jens Wille
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-06 00:00:00.000000000 Z
11
+ date: 2013-03-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: builder
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: highline
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
28
39
  - !ruby/object:Gem::Version
29
40
  version: '0'
30
41
  - !ruby/object:Gem::Dependency
31
42
  name: xmlstreamin
32
43
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
44
  requirements:
35
- - - ! '>='
45
+ - - '>='
36
46
  - !ruby/object:Gem::Version
37
47
  version: '0'
38
48
  type: :runtime
39
49
  prerelease: false
40
50
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
51
  requirements:
43
- - - ! '>='
52
+ - - '>='
44
53
  - !ruby/object:Gem::Version
45
54
  version: '0'
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: ruby-nuggets
48
57
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
58
  requirements:
51
- - - ! '>='
59
+ - - '>='
52
60
  - !ruby/object:Gem::Version
53
- version: 0.8.1
61
+ version: 0.9.1
54
62
  type: :runtime
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
65
  requirements:
59
- - - ! '>='
66
+ - - '>='
60
67
  - !ruby/object:Gem::Version
61
- version: 0.8.1
68
+ version: 0.9.1
62
69
  description: Convert database files to various formats.
63
- email: jens.wille@uni-koeln.de
70
+ email: jens.wille@gmail.com
64
71
  executables:
65
72
  - athena
66
73
  extensions: []
@@ -69,30 +76,31 @@ extra_rdoc_files:
69
76
  - COPYING
70
77
  - ChangeLog
71
78
  files:
72
- - lib/athena/formats/sql.rb
73
- - lib/athena/formats/xml.rb
79
+ - lib/athena.rb
80
+ - lib/athena/cli.rb
81
+ - lib/athena/formats.rb
82
+ - lib/athena/formats/dbm.rb
74
83
  - lib/athena/formats/ferret.rb
75
84
  - lib/athena/formats/lingo.rb
76
- - lib/athena/formats/dbm.rb
77
85
  - lib/athena/formats/sisis.rb
78
- - lib/athena/version.rb
79
- - lib/athena/cli.rb
86
+ - lib/athena/formats/sql.rb
87
+ - lib/athena/formats/xml.rb
80
88
  - lib/athena/record.rb
81
- - lib/athena/formats.rb
82
- - lib/athena.rb
89
+ - lib/athena/version.rb
83
90
  - bin/athena
84
91
  - COPYING
85
92
  - ChangeLog
86
- - Rakefile
87
93
  - README
94
+ - Rakefile
95
+ - example/athena_plugin.rb
88
96
  - example/config.yaml
97
+ - example/dump-my.sql
89
98
  - example/dump-pg.sql
90
99
  - example/example.xml
91
- - example/athena_plugin.rb
92
- - example/dump-my.sql
93
100
  - example/sisis-ex.txt
94
101
  homepage: http://prometheus.rubyforge.org/athena
95
102
  licenses: []
103
+ metadata: {}
96
104
  post_install_message:
97
105
  rdoc_options:
98
106
  - --charset
@@ -100,27 +108,25 @@ rdoc_options:
100
108
  - --line-numbers
101
109
  - --all
102
110
  - --title
103
- - athena Application documentation (v0.2.3)
111
+ - athena Application documentation (v0.2.4)
104
112
  - --main
105
113
  - README
106
114
  require_paths:
107
115
  - lib
108
116
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
117
  requirements:
111
- - - ! '>='
118
+ - - '>='
112
119
  - !ruby/object:Gem::Version
113
120
  version: '0'
114
121
  required_rubygems_version: !ruby/object:Gem::Requirement
115
- none: false
116
122
  requirements:
117
- - - ! '>='
123
+ - - '>='
118
124
  - !ruby/object:Gem::Version
119
125
  version: '0'
120
126
  requirements: []
121
127
  rubyforge_project: prometheus
122
- rubygems_version: 1.8.24
128
+ rubygems_version: 2.0.3
123
129
  signing_key:
124
- specification_version: 3
130
+ specification_version: 4
125
131
  summary: Convert database files to various formats.
126
132
  test_files: []