mode 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 306d6b69e36902cfcfbbb337bd5fcb2a9ab34885
4
- data.tar.gz: 1e37f39443b33605cc75857b0cb29ea7a4d3f645
3
+ metadata.gz: b6e7dfdced45c21a2992a258d76219a9f1e074b9
4
+ data.tar.gz: d653e073e515a1b67797277c6e09bb9e37617c76
5
5
  SHA512:
6
- metadata.gz: cc645a00b69a3fe58d1af485d1e538c6e19cfbf36f7ce4b4964fde02125ca0abbf72b64edeb7b5a32a1083c02d2b6152d39e5fde7aba53a7396b7eece18af562
7
- data.tar.gz: 09acba6c1e90aad0627c1f71008e11da836a0fc83c02e847cef543c4c7f9bc6ef8310d76d8b544456eac0ec4051883cc17e453238bd1f90065581e16ba87263c
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 ssl_mode
42
- props['sslmode'] || 'prefer'
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 postgres?
61
- adapter == 'postgres'
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 => ssl_mode
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
@@ -1,3 +1,3 @@
1
1
  module Mode
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
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.14
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-29 00:00:00.000000000 Z
11
+ date: 2014-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor