mode 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/mode/connector/data_source.rb +39 -6
- data/lib/mode/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6e7dfdced45c21a2992a258d76219a9f1e074b9
|
4
|
+
data.tar.gz: d653e073e515a1b67797277c6e09bb9e37617c76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 760f91c587df41b6114b9f3b63de64c99e1472a0e31b1527895074f6c6f4ea378a5b5a7079d223bb5dd4ea30ad073043bea862329b93443e4ca184b72732146c
|
7
|
+
data.tar.gz: 5bab71e471ea96a4bce0983e3d8613ba0e3740dbde0c583d51300af246bd7de920097f1513d67bebfa7e951ff6cdff258a1e7d02b893c04463b4aa3fea40c240
|
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This gem provides command line tools for interacting with the Mode Analytics APIs.
|
4
4
|
|
5
|
+
[![Build Status](https://magnum.travis-ci.com/mode/mode-ruby.png?token=i2TyUW8sMD41B46pRCpz&branch=master)](https://magnum.travis-ci.com/mode/mode-ruby)
|
6
|
+
[![Code Climate](https://codeclimate.com/repos/52a90897f3ea0044b10034de/badges/68f57393128c9c3fe2c5/gpa.png)](https://codeclimate.com/repos/52a90897f3ea0044b10034de/feed)
|
7
|
+
|
8
|
+
|
5
9
|
## Install Mode
|
6
10
|
|
7
11
|
**Mode requires Ruby 1.9 or JRuby 1.7 or newer**
|
@@ -34,6 +38,10 @@ Choose a token name: Connector
|
|
34
38
|
Updated configuration at /Users/josh/.mode/config.yml
|
35
39
|
```
|
36
40
|
|
41
|
+
The token name is just a descriptive name that will help you remember what the token is used for.
|
42
|
+
|
43
|
+
Tokens can be renamed or deleted at any time from your account settings page in Mode.
|
44
|
+
|
37
45
|
## Adding Data Sources
|
38
46
|
|
39
47
|
Open the Mode configuration file in your favorite text editor (I'm using sublime text)
|
@@ -38,9 +38,10 @@ module Mode
|
|
38
38
|
props['database']
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
props['
|
41
|
+
def ssl
|
42
|
+
props['ssl']
|
43
43
|
end
|
44
|
+
alias_method :ssl?, :ssl
|
44
45
|
|
45
46
|
def select(query, &block)
|
46
47
|
log_connection_query(query)
|
@@ -57,13 +58,25 @@ module Mode
|
|
57
58
|
adapter.start_with?('jdbc')
|
58
59
|
end
|
59
60
|
|
60
|
-
def
|
61
|
-
|
61
|
+
def vertica?
|
62
|
+
['vertica', 'jdbc:vertica'].include?(adapter)
|
62
63
|
end
|
63
64
|
|
64
65
|
def redshift?
|
65
66
|
['redshift', 'jdbc:redshift'].include?(adapter)
|
66
67
|
end
|
68
|
+
|
69
|
+
def sqlserver?
|
70
|
+
['tiny_tds', 'jdbc:sqlserver'].include?(adapter)
|
71
|
+
end
|
72
|
+
|
73
|
+
def postgres?
|
74
|
+
['postgres', 'jdbc:postgresql'].include?(adapter)
|
75
|
+
end
|
76
|
+
|
77
|
+
def mysql?
|
78
|
+
['mysql', 'mysql2', 'jdbc:mysql'].include?(adapter)
|
79
|
+
end
|
67
80
|
|
68
81
|
private
|
69
82
|
|
@@ -77,7 +90,7 @@ module Mode
|
|
77
90
|
})
|
78
91
|
elsif postgres?
|
79
92
|
opts.merge!({
|
80
|
-
:sslmode =>
|
93
|
+
:sslmode => (ssl? ? ssl : 'prefer')
|
81
94
|
})
|
82
95
|
end
|
83
96
|
|
@@ -109,12 +122,32 @@ module Mode
|
|
109
122
|
password.nil? ? nil : ":#{password}"
|
110
123
|
end
|
111
124
|
|
125
|
+
def ssl_segment
|
126
|
+
jdbc? ? jdbc_ssl_segment : nil
|
127
|
+
end
|
128
|
+
|
129
|
+
def jdbc_ssl_segment
|
130
|
+
if ssl?
|
131
|
+
if mysql?
|
132
|
+
"&useSSL=true"
|
133
|
+
elsif sqlserver?
|
134
|
+
"&encrypt=true&trustServerCertificate=true"
|
135
|
+
elsif postgres? || vertica? || redshift?
|
136
|
+
"&ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory"
|
137
|
+
else
|
138
|
+
nil
|
139
|
+
end
|
140
|
+
else
|
141
|
+
nil
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
112
145
|
def connection_url
|
113
146
|
jdbc? ? jdbc_connection_url : standard_connection_url
|
114
147
|
end
|
115
148
|
|
116
149
|
def jdbc_connection_url
|
117
|
-
"#{adapter_segment}://#{host}#{port_segment}/#{database}?user=#{username}#{password_segment}"
|
150
|
+
"#{adapter_segment}://#{host}#{port_segment}/#{database}?user=#{username}#{password_segment}#{ssl_segment}"
|
118
151
|
end
|
119
152
|
|
120
153
|
def standard_connection_url
|
data/lib/mode/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mode Analytics
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|