athena 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,9 +54,7 @@ module Athena
54
54
  attr_reader :struct, :block, :id
55
55
 
56
56
  def initialize(id = nil, block = nil, add = !block)
57
- @id = id || object_id.map_positive
58
- @block = block
59
- @struct = {}
57
+ @id, @block, @struct = id || object_id.map_positive, block, {}
60
58
 
61
59
  add_record if add
62
60
 
@@ -4,7 +4,7 @@ module Athena
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 2
7
- TINY = 1
7
+ TINY = 2
8
8
 
9
9
  class << self
10
10
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: athena
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jens Wille
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-27 00:00:00 Z
18
+ date: 2012-04-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder
@@ -53,12 +53,12 @@ dependencies:
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- hash: 11
56
+ hash: 61
57
57
  segments:
58
58
  - 0
59
- - 7
60
- - 4
61
- version: 0.7.4
59
+ - 8
60
+ - 1
61
+ version: 0.8.1
62
62
  type: :runtime
63
63
  version_requirements: *id003
64
64
  description: Convert database files to various formats.
@@ -72,41 +72,41 @@ extra_rdoc_files:
72
72
  - COPYING
73
73
  - ChangeLog
74
74
  files:
75
- - lib/athena/record.rb
76
- - lib/athena/cli.rb
77
- - lib/athena/formats/xml.rb
75
+ - lib/athena/version.rb
76
+ - lib/athena/formats.rb
78
77
  - lib/athena/formats/lingo.rb
79
- - lib/athena/formats/ferret.rb
80
78
  - lib/athena/formats/dbm.rb
81
79
  - lib/athena/formats/sql.rb
80
+ - lib/athena/formats/xml.rb
82
81
  - lib/athena/formats/sisis.rb
83
- - lib/athena/version.rb
84
- - lib/athena/parser.rb
85
- - lib/athena/formats.rb
82
+ - lib/athena/formats/ferret.rb
83
+ - lib/athena/cli.rb
84
+ - lib/athena/record.rb
86
85
  - lib/athena.rb
87
86
  - bin/athena
88
- - README
89
87
  - ChangeLog
90
- - Rakefile
91
88
  - COPYING
89
+ - README
90
+ - Rakefile
92
91
  - example/dump-my.sql
93
- - example/config.yaml
92
+ - example/sisis-ex.txt
94
93
  - example/dump-pg.sql
94
+ - example/config.yaml
95
95
  - example/example.xml
96
- - example/sisis-ex.txt
96
+ - example/athena_plugin.rb
97
97
  homepage: http://prometheus.rubyforge.org/athena
98
98
  licenses: []
99
99
 
100
100
  post_install_message:
101
101
  rdoc_options:
102
- - --all
103
- - --main
104
- - README
105
102
  - --charset
106
103
  - UTF-8
107
104
  - --title
108
- - athena Application documentation (v0.2.1)
105
+ - athena Application documentation (v0.2.2)
106
+ - --main
107
+ - README
109
108
  - --line-numbers
109
+ - --all
110
110
  require_paths:
111
111
  - lib
112
112
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  requirements: []
131
131
 
132
132
  rubyforge_project: prometheus
133
- rubygems_version: 1.8.6
133
+ rubygems_version: 1.8.23
134
134
  signing_key:
135
135
  specification_version: 3
136
136
  summary: Convert database files to various formats.
@@ -1,90 +0,0 @@
1
- #--
2
- ###############################################################################
3
- # #
4
- # A component of athena, the database file converter. #
5
- # #
6
- # Copyright (C) 2007-2011 University of Cologne, #
7
- # Albertus-Magnus-Platz, #
8
- # 50923 Cologne, Germany #
9
- # #
10
- # Authors: #
11
- # Jens Wille <jens.wille@uni-koeln.de> #
12
- # #
13
- # athena is free software; you can redistribute it and/or modify it under the #
14
- # terms of the GNU Affero 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
- # athena is distributed in the hope that it will be useful, but WITHOUT ANY #
19
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
20
- # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for #
21
- # more details. #
22
- # #
23
- # You should have received a copy of the GNU Affero General Public License #
24
- # along with athena. If not, see <http://www.gnu.org/licenses/>. #
25
- # #
26
- ###############################################################################
27
- #++
28
-
29
- require 'athena'
30
-
31
- module Athena
32
-
33
- class Parser
34
-
35
- DEFAULT_SEPARATOR = ', '
36
- DEFAULT_EMPTY = '<<EMPTY>>'
37
-
38
- attr_reader :config, :spec
39
-
40
- def initialize(config, spec)
41
- @config = build_config(config)
42
- @spec = Formats[:in, spec].new(self)
43
- end
44
-
45
- def parse(source, &block)
46
- res = spec.parse(source, &block)
47
- res.is_a?(Numeric) ? res : Record.records
48
- end
49
-
50
- private
51
-
52
- def build_config(config)
53
- hash = {}
54
-
55
- config.each { |field, value|
56
- if field.to_s =~ /\A__/
57
- hash[field] = value
58
- else
59
- case value
60
- when String, Array
61
- elements, value = [*value], {}
62
- when Hash
63
- elements = value[:elements] || value[:element].to_a
64
-
65
- raise ArgumentError, "no elements specified for field #{field}" unless elements.is_a?(Array)
66
- else
67
- raise ArgumentError, "illegal value for field #{field}"
68
- end
69
-
70
- separator = value[:separator] || DEFAULT_SEPARATOR
71
-
72
- elements.each { |element|
73
- (hash[element] ||= {})[field] = {
74
- :string => value[:string] || ['%s'] * elements.size * separator,
75
- :empty => value[:empty] || DEFAULT_EMPTY,
76
- :elements => elements
77
- }
78
- }
79
- end
80
- }
81
-
82
- hash
83
- end
84
-
85
- class ConfigError < StandardError
86
- end
87
-
88
- end
89
-
90
- end