db_meta 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/db_meta/abstract.rb +35 -0
- data/lib/db_meta/oracle/oracle.rb +7 -0
- data/lib/db_meta/version.rb +1 -1
- data/lib/db_meta.rb +8 -19
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8887a183a25b6272667070306efb1984a7801a51
|
4
|
+
data.tar.gz: 65ff06a084c42b17c3298808543a7309ac83ece8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db74f4213879ce983a1f85a1dc7e0eed34f1005493520ba78714399ec17a80265e8f55374514ddd7d54cbad770f6158eb3f428f2e1d96c6c944186e13663f698
|
7
|
+
data.tar.gz: c051dc8ee2b358d3d7953f3dc692233873c1abb8271afadd7dacab65eb26975eb121be68e5c5ec9cdde6f8adbeb4bed45c9f4e71acbf673d7efd3db3e9cbb6fd
|
data/Gemfile.lock
CHANGED
data/lib/db_meta/abstract.rb
CHANGED
@@ -2,6 +2,41 @@ module DbMeta
|
|
2
2
|
|
3
3
|
class Abstract
|
4
4
|
|
5
|
+
TYPES = {}
|
6
|
+
|
7
|
+
def self.register_type(type)
|
8
|
+
TYPES[type] = self
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.from_type(type, args)
|
12
|
+
raise "type [#{type}] is unknown" unless TYPES.keys.include?(type)
|
13
|
+
TYPES[type].new(args)
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(**args)
|
17
|
+
@username = args[:username]
|
18
|
+
@password = args[:password]
|
19
|
+
@instance = args[:instance]
|
20
|
+
|
21
|
+
raise 'username is mandatory, pass a username argument during initialization' if @username.nil?
|
22
|
+
raise 'password is mandatory, pass a password argument during initialization' if @password.nil?
|
23
|
+
raise 'instance is mandatory, pass a instance argument during initialization' if @instance.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
def fetch(**args)
|
27
|
+
raise 'Needs to be implemented in derived class'
|
28
|
+
end
|
29
|
+
|
30
|
+
def extract(**args)
|
31
|
+
raise 'Needs to be implemented in derived class'
|
32
|
+
end
|
33
|
+
|
5
34
|
end
|
6
35
|
|
7
36
|
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
data/lib/db_meta/version.rb
CHANGED
data/lib/db_meta.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require_relative 'db_meta/version'
|
2
2
|
require_relative 'db_meta/abstract'
|
3
3
|
|
4
|
+
require_relative 'db_meta/oracle/oracle'
|
5
|
+
|
4
6
|
module DbMeta
|
5
7
|
|
6
8
|
DATABASE_TYPES = [:oracle]
|
@@ -8,30 +10,17 @@ module DbMeta
|
|
8
10
|
class DbMeta
|
9
11
|
|
10
12
|
def initialize(**args)
|
11
|
-
@args = args
|
12
|
-
|
13
|
-
@username = args[:username]
|
14
|
-
@password = args[:password]
|
15
|
-
@instance = args[:instance]
|
16
|
-
|
17
13
|
@database_type = args[:database_type] || DATABASE_TYPES[0]
|
14
|
+
raise "allowed database types are [#{DATABASE_TYPES.join(', ')}], but provided was [#{@database_type}]" unless DATABASE_TYPES.include?(@database_type)
|
15
|
+
@abstract = Abstract.from_type(@database_type, args)
|
18
16
|
end
|
19
17
|
|
20
|
-
def fetch
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
def extract
|
25
|
-
validate
|
18
|
+
def fetch(**args)
|
19
|
+
abstract.fetch(args)
|
26
20
|
end
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
def validate
|
31
|
-
raise 'username is mandatory, pass a username argument during initialization' if @username.nil?
|
32
|
-
raise 'password is mandatory, pass a password argument during initialization' if @password.nil?
|
33
|
-
raise 'instance is mandatory, pass a instance argument during initialization' if @instance.nil?
|
34
|
-
raise "allowed database types are [#{DATABASE_TYPES.join(', ')}], but provided was [#{@database_type}]" unless DATABASE_TYPES.include?(@database_type)
|
22
|
+
def extract(**args)
|
23
|
+
abstract.extract(args)
|
35
24
|
end
|
36
25
|
|
37
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomi
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- examples/simple.rb
|
88
88
|
- lib/db_meta.rb
|
89
89
|
- lib/db_meta/abstract.rb
|
90
|
+
- lib/db_meta/oracle/oracle.rb
|
90
91
|
- lib/db_meta/version.rb
|
91
92
|
homepage: https://github.com/thomis/db_meta
|
92
93
|
licenses: []
|