alvid 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/alvid.rb +7 -1
- data/lib/alvid/version.rb +1 -1
- data/spec/alvid_spec.rb +7 -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: dcc72011a777293a8ae3d23d9f02ecd860e76303
|
4
|
+
data.tar.gz: 32724cf9ffa8d48f701c484c7334d47f3c3004f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 081e1100123ba66b7eac6141ce1815876034d387d5dbc187f92cd36292eea4393f20c54d20aec06416a38e7e2b95e9a76cebb24accc9f840f3dc277d2adc4c72
|
7
|
+
data.tar.gz: e66314bd2c45c1970e4ed001688446be0bc2264a76f1a096e307305e5d9f2759fe11c81b2260be0d82271e0666f4584fc0198a45370f61d2b39010003dc4ebe3
|
data/README.md
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
|
1
|
+
[![Code Climate](https://codeclimate.com/github/bonzofenix/alvid/badges/gpa.svg)](https://codeclimate.com/github/bonzofenix/alvid)
|
2
|
+
[![Test Coverage](https://codeclimate.com/github/bonzofenix/alvid/badges/coverage.svg)](https://codeclimate.com/github/bonzofenix/alvid/coverage)
|
3
|
+
[![Issue Count](https://codeclimate.com/github/bonzofenix/alvid/badges/issue_count.svg)](https://codeclimate.com/github/bonzofenix/alvid)
|
4
|
+
[![Build Status](https://travis-ci.org/bonzofenix/alvid.svg)](https://travis-ci.org/bonzofenix/alvid)
|
data/lib/alvid.rb
CHANGED
@@ -7,7 +7,13 @@ module Alvid
|
|
7
7
|
require 'dm-sqlite-adapter'
|
8
8
|
'sqlite::memory:'
|
9
9
|
else
|
10
|
-
JSON.parse(ENV['VCAP_SERVICES']).first
|
10
|
+
product_name, service = JSON.parse(ENV['VCAP_SERVICES']).first
|
11
|
+
case product_name
|
12
|
+
when /mysql/
|
13
|
+
service.first.first[1]['uri']
|
14
|
+
when /cleardb/
|
15
|
+
service.first['credentials']['uri']
|
16
|
+
end
|
11
17
|
end
|
12
18
|
DataMapper.setup(:default, db_uri)
|
13
19
|
end
|
data/lib/alvid/version.rb
CHANGED
data/spec/alvid_spec.rb
CHANGED
@@ -7,12 +7,18 @@ describe Alvid do
|
|
7
7
|
|
8
8
|
describe 'init' do
|
9
9
|
describe 'when VCAP_SERVICES provided' do
|
10
|
-
it '
|
10
|
+
it 'supports p-mysql' do
|
11
11
|
ENV["VCAP_SERVICES"] = '{ "p-mysql-n/a": [ { "credentials": { "uri":"cool-mysql-uri" }, "label": "p-mysql-n/a", "name": "p-mysql", "syslog_drain_url": "", "tags": ["postgres","postgresql","relational"] } ] } '
|
12
12
|
expect(DataMapper).to receive(:setup).with(:default, "cool-mysql-uri")
|
13
13
|
Alvid.init
|
14
14
|
ENV.clear
|
15
15
|
end
|
16
|
+
it 'supports cleardb' do
|
17
|
+
ENV["VCAP_SERVICES"] = ' { "cleardb": [ { "name": "alvid", "label": "cleardb", "tags": [], "plan": "spark", "credentials": { "uri": "mysql://USER:PASSWORD@cleardb.net:3306/DBNAME?reconnect=true" } } ] }'
|
18
|
+
expect(DataMapper).to receive(:setup).with(:default, "mysql://USER:PASSWORD@cleardb.net:3306/DBNAME?reconnect=true")
|
19
|
+
Alvid.init
|
20
|
+
ENV.clear
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
24
|
describe 'when VCAP_SERVICES is empty' do
|