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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 880ceb639ab19b1a6eed98d9ec684c802a0fe0f9
4
- data.tar.gz: c0ceccc792d5850e643a9e9b3bb13db4077d1a51
3
+ metadata.gz: dcc72011a777293a8ae3d23d9f02ecd860e76303
4
+ data.tar.gz: 32724cf9ffa8d48f701c484c7334d47f3c3004f8
5
5
  SHA512:
6
- metadata.gz: 79821070f18dfcbc4dfc4148dc6d6408d1cec223e9c79137573d2b293f765401398380638ebcbcaa810fdfeef9828b78e0c9a4c2f3af290cbf713688dd81e320
7
- data.tar.gz: f8a0f6023ff54d67976fd63c9486937247a967e1662e031a95fffd64b750efe80df055a83388edd3caad13d34769818c3506357eec1a5ee47c95bcdca5ddd9f1
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)
@@ -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[1].first.first[1]['uri']
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
@@ -1,3 +1,3 @@
1
1
  module Alvid
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -7,12 +7,18 @@ describe Alvid do
7
7
 
8
8
  describe 'init' do
9
9
  describe 'when VCAP_SERVICES provided' do
10
- it 'uses provided db' do
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alvid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Moran