trinamo 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -5
- data/lib/trinamo/converter/base_converter.rb +10 -2
- data/lib/trinamo/converter.rb +8 -10
- data/lib/trinamo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db69701cc52386eb208707e1140e5175e8d03189
|
4
|
+
data.tar.gz: 146681b611611fde087a1c4b3c02a8dd1a84e8a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26ab74658efe62586153b2ddaaff0de883d88e28a017a4c4d1ef76490ecf0cb0715130cea791e92cd6c13ca2190d9a8da672fb65f2515be78896c74998e4dc22
|
7
|
+
data.tar.gz: cccb9b72a8da804015b864c639c5dbeb3e1485dfef0630251e8602fd4effa66651df3e4eb13af81f79c98a1ddfe4410fb1f1ff0532aebfb1950ec984b7088bb0
|
data/README.md
CHANGED
@@ -5,9 +5,17 @@ module Trinamo
|
|
5
5
|
class BaseConverter
|
6
6
|
attr_accessor :ddl_yaml_path, :ddl
|
7
7
|
|
8
|
-
def initialize(ddl_yaml_path)
|
8
|
+
def initialize(ddl_yaml_path, ddl = nil)
|
9
9
|
@ddl_yaml_path = ddl_yaml_path
|
10
|
-
@ddl =
|
10
|
+
@ddl = if ddl
|
11
|
+
ddl
|
12
|
+
else
|
13
|
+
ddl_yaml_path ? YAML.load_file(ddl_yaml_path).deep_symbolize_keys : nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def convert(format)
|
18
|
+
Trinamo::Converter.load(@ddl_yaml_path, format, @ddl).convert
|
11
19
|
end
|
12
20
|
end
|
13
21
|
end
|
data/lib/trinamo/converter.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'unindent'
|
2
|
+
require_relative './converter/base_converter'
|
2
3
|
require_relative './converter/dynamodb_converter'
|
3
4
|
require_relative './converter/hdfs_converter'
|
4
5
|
require_relative './converter/s3_converter'
|
@@ -7,20 +8,17 @@ require_relative './converter/option_converter'
|
|
7
8
|
module Trinamo
|
8
9
|
class Converter
|
9
10
|
class << self
|
10
|
-
def load(ddl_yaml_path, format)
|
11
|
+
def load(ddl_yaml_path, format = nil, ddl = nil)
|
11
12
|
case format
|
12
|
-
when :hdfs then HdfsConverter.new(ddl_yaml_path)
|
13
|
-
when :s3 then S3Converter.new(ddl_yaml_path)
|
14
|
-
when :dynamodb then DynamodbConverter.new(ddl_yaml_path)
|
15
|
-
when :option
|
16
|
-
|
13
|
+
when :hdfs then HdfsConverter.new(ddl_yaml_path, ddl)
|
14
|
+
when :s3 then S3Converter.new(ddl_yaml_path, ddl)
|
15
|
+
when :dynamodb then DynamodbConverter.new(ddl_yaml_path, ddl)
|
16
|
+
when :option then OptionConverter.new(ddl_yaml_path, ddl)
|
17
|
+
when nil then BaseConverter.new(ddl_yaml_path, ddl)
|
18
|
+
else raise "[ERROR] Unknown format: #{format}"
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
def load_options(options_yaml_path)
|
21
|
-
OptionConverter.new(options_yaml_path)
|
22
|
-
end
|
23
|
-
|
24
22
|
def generate_ddl_template(out_file_path = nil)
|
25
23
|
template = <<-TEMPLATE.unindent
|
26
24
|
tables:
|
data/lib/trinamo/version.rb
CHANGED