capistrano-ssh-wrapper
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -9,3 +9,3 @@ { | ||
"description": "[![Greenkeeper badge](https://badges.greenkeeper.io/grrr-amsterdam/capistrano-ssh-wrapper.svg)](https://greenkeeper.io/)", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "wrapper.js", | ||
@@ -12,0 +12,0 @@ "devDependencies": {}, |
@@ -23,29 +23,62 @@ #!/usr/bin/env node | ||
if (line.startsWith('server')) { | ||
var userhost = /server ['"]+(.*)@(.*)['"]+/g; | ||
var match = userhost.exec(line); | ||
if (match.length < 2) { | ||
var e = 'Could not find SSH config.' | ||
error.exit(e) | ||
var parsed = parser._parseSshServerLine(line) | ||
if (!parsed) { | ||
parsed = parser._parseSshServerSeparateUserLine(line) | ||
} | ||
return { | ||
user: match[1], | ||
host: match[2] | ||
} | ||
return parsed | ||
} | ||
if (line.startsWith('set :deploy_to')) { | ||
var dir = /:deploy_to, ['"]+(.*)['"]+/g; | ||
var match = dir.exec(line); | ||
if (match.length < 1) { | ||
var e = 'Could not find SSH deploy dir config.' | ||
error.exit(e) | ||
} | ||
return parser._parseSshDeployLine(line) | ||
} | ||
}, | ||
return { | ||
dir: match[1] | ||
} | ||
_parseSshServerLine: function(line) { | ||
var userhost = /server ['"]+(.*)@(.*)['"]+/g; | ||
var match = userhost.exec(line); | ||
if ( | ||
!('length' in match) || | ||
match.length < 2 | ||
) { | ||
return | ||
} | ||
return { | ||
user: match[1], | ||
host: match[2] | ||
} | ||
}, | ||
_parseSshServerSeparateUserLine: function(line) { | ||
var userhost = /server ['"]+(.*)['"]+user: ['"]+(.*)['"]/g; | ||
var match = userhost.exec(line); | ||
if ( | ||
!('length' in match) || | ||
match.length < 2 | ||
) { | ||
return | ||
} | ||
return { | ||
host: match[1], | ||
user: match[2] | ||
} | ||
}, | ||
_parseSshDeployLine: function(line) { | ||
var dir = /:deploy_to, ['"]+(.*)['"]+/g; | ||
var match = dir.exec(line); | ||
if (match.length < 1) { | ||
var e = 'Could not find SSH deploy dir config.' | ||
error.exit(e) | ||
} | ||
return { | ||
dir: match[1] | ||
} | ||
} | ||
}; | ||
11076
127