Permalink
Browse files

[databases][fix] fixes for handle the new providers

  • Loading branch information...
1 parent 3877174 commit e7f19ac4ea488db44c80f15a4a3a7daae9d76ab7 @cronopio cronopio committed Nov 8, 2012
Showing with 13 additions and 6 deletions.
  1. +13 −6 lib/jitsu/commands/databases.js
@@ -21,7 +21,7 @@ databases.usage = [
'Valid database types are: ' + 'couch'.magenta + ', ' + 'redis'.magenta + ', or ' + 'mongo'.magenta
];
-databases.available = ['couch', 'redis', 'mongo'];
+databases.available = ['couch', 'redis', 'mongo', 'mongohq', 'redistogo'];
//
// Micro aliasing for databases command
@@ -35,7 +35,9 @@ databases.available = ['couch', 'redis', 'mongo'];
databases.aliases = {
couch : ['c', 'couchdb'],
redis : ['r'],
- mongo : ['m', 'mongodb']
+ mongo : ['m', 'mongodb'],
+ mongohq: [],
+ redistogo: []
};
//
@@ -167,7 +169,9 @@ databases.create.usage = [
'',
'jitsu databases create couch <database name>',
'jitsu databases create mongo <database name>',
- 'jitsu databases create redis <database name>'
+ 'jitsu databases create redis <database name>',
+ 'jitsu databases create mongohq <database name>',
+ 'jitsu databases create redistogo <database name>',
];
databases.get = function (databaseName, callback) {
@@ -309,8 +313,9 @@ var printDatabase = function (database) {
break;
case 'mongo':
+ case 'mongohq':
printBase(database);
- jitsu.log.data('Connection url: ' + database.metadata.uri.grey + database.metadata.dbname.grey);
+ jitsu.log.data('Connection url: ' + database.metadata.uri.grey + '/'.grey + database.metadata.dbname.grey);
break;
case 'redis':
@@ -357,7 +362,8 @@ var printDbHelp = function (database) {
break;
case 'mongo':
- var parsed = require('url').parse(database.metadata.uri + database.metadata.dbname),
+ case 'mongohq':
+ var parsed = require('url').parse(database.metadata.uri + '/' + database.metadata.dbname),
auth = [database.metadata.username, database.metadata.password];
// TODO: Only write this if in some "verbose" mode.
@@ -383,13 +389,14 @@ var printDbHelp = function (database) {
'Connect with the `' + 'mongoose'.magenta + '` module:',
'',
' var mongoose = require(\'mongoose\');',
- ' mongoose.connect(\'' + database.metadata.uri + database.metadata.dbname + '\');',
+ ' mongoose.connect(\'' + database.metadata.uri + '/' + database.metadata.dbname + '\');',
''
].forEach(printHelp);
break;
case 'redis':
+ case 'redistogo':
var port = database.metadata.port,
password = database.metadata.password,
server = database.metadata.label.split('-')[0] + '.redistogo.com';

0 comments on commit e7f19ac

Please sign in to comment.