cranium 0.3.1 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Vagrantfile +0 -1
- data/cranium.gemspec +1 -1
- data/lib/cranium/configuration.rb +2 -0
- data/lib/cranium/database.rb +5 -1
- data/spec/cranium/configuration_spec.rb +4 -0
- data/spec/cranium/database_spec.rb +23 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c2f2dafaa2fa2a74a492f6fafe5b3c5db0ab138
|
4
|
+
data.tar.gz: a5f0901f553a33798f95f3bf038f9147be60ab28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb4e76b8484db568fd8a035b839cf7f1e3f0a8b702bf624668020378496d6318d61d5250077cecf84434d388ebfa8f516d9eb41b4fd2f9a74ff9c873b1a9521e
|
7
|
+
data.tar.gz: 7ac3455809cafffc7defa83778dea64f635a2d92a9971313ef4cf5d392389c7f7495345e677ee004de492298d6db0add03d076530866fb22ea77c9fcc212ca32
|
data/Vagrantfile
CHANGED
@@ -9,7 +9,6 @@ VAGRANTFILE_API_VERSION = "2"
|
|
9
9
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
10
10
|
config.vm.box = "si-build.v2"
|
11
11
|
config.vm.box_url = "http://vboxes.ett.local/si-build.v2.box"
|
12
|
-
config.vbguest.auto_update = false
|
13
12
|
|
14
13
|
config.vm.hostname = 'cranium-build'
|
15
14
|
config.vm.network :private_network, ip: "192.168.56.43"
|
data/cranium.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'cranium'
|
3
|
-
spec.version = '0.
|
3
|
+
spec.version = '0.4'
|
4
4
|
spec.authors = ['Emarsys Technologies']
|
5
5
|
spec.email = ['smart-insight-dev@emarsys.com']
|
6
6
|
spec.description = %q{Provides Extract, Transform and Load functionality for loading data from CSV files to a Greenplum database.}
|
data/lib/cranium/database.rb
CHANGED
@@ -27,7 +27,11 @@ module Cranium::Database
|
|
27
27
|
|
28
28
|
|
29
29
|
def self.setup_connection(connection_string)
|
30
|
-
connection =
|
30
|
+
connection = if Cranium.configuration.log_queries
|
31
|
+
Sequel.connect(connection_string, loggers: Cranium.configuration.loggers)
|
32
|
+
else
|
33
|
+
Sequel.connect(connection_string)
|
34
|
+
end
|
31
35
|
connection.extension :connection_validator
|
32
36
|
connection.pool.connection_validation_timeout = -1
|
33
37
|
return connection
|
@@ -4,6 +4,10 @@ describe Cranium::Configuration do
|
|
4
4
|
|
5
5
|
let(:config) { Cranium::Configuration.new }
|
6
6
|
|
7
|
+
describe '#log_queries' do
|
8
|
+
it { is_expected.to be_truthy }
|
9
|
+
end
|
10
|
+
|
7
11
|
describe "#upload_path" do
|
8
12
|
it "should return the full upload path" do
|
9
13
|
config.gpfdist_home_directory = "/gpfdist/home/dir"
|
@@ -7,14 +7,15 @@ describe Cranium::Database do
|
|
7
7
|
let(:database) { Cranium::Database }
|
8
8
|
let(:connection) { Sequel::Mock::Database.new }
|
9
9
|
let(:other_connection) { Sequel::Mock::Database.new }
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end)
|
10
|
+
let(:config) do
|
11
|
+
Cranium::Configuration.new.tap do |config|
|
12
|
+
config.greenplum_connection_string = "connection string"
|
13
|
+
config.loggers = "loggers"
|
14
|
+
end
|
16
15
|
end
|
17
16
|
|
17
|
+
before(:each) { allow(Cranium).to receive(:configuration).and_return(config) }
|
18
|
+
|
18
19
|
|
19
20
|
describe ".connection" do
|
20
21
|
before { Cranium::Database.instance_variable_set :@connection, nil }
|
@@ -30,6 +31,22 @@ describe Cranium::Database do
|
|
30
31
|
|
31
32
|
expect(database.connection).to eq database.connection
|
32
33
|
end
|
34
|
+
|
35
|
+
context 'when query logging is turned off' do
|
36
|
+
let(:config) do
|
37
|
+
Cranium::Configuration.new.tap do |config|
|
38
|
+
config.greenplum_connection_string = "connection string"
|
39
|
+
config.loggers = "loggers"
|
40
|
+
config.log_queries = false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should connect to the DB without any loggers" do
|
45
|
+
expect(Sequel).to receive(:connect).with("connection string").and_return connection
|
46
|
+
|
47
|
+
expect(database.connection).to eq connection
|
48
|
+
end
|
49
|
+
end
|
33
50
|
end
|
34
51
|
|
35
52
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cranium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emarsys Technologies
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
297
|
version: '0'
|
298
298
|
requirements: []
|
299
299
|
rubyforge_project:
|
300
|
-
rubygems_version: 2.
|
300
|
+
rubygems_version: 2.5.1
|
301
301
|
signing_key:
|
302
302
|
specification_version: 4
|
303
303
|
summary: Pure Ruby ETL framework
|