Permalink
Browse files

Adds proxy option for pushing.

  mobify push -x http://proxy:8888/
  • Loading branch information...
1 parent 44a8455 commit d31cceaa7b9e022a3b4492da504dee7543c98332 Ryan J Daw committed Oct 9, 2012
Showing with 10 additions and 0 deletions.
  1. +1 −0 src/api.coffee
  2. +1 −0 src/mobify.coffee
  3. +8 −0 src/utils.coffee
View
@@ -13,6 +13,7 @@ exports.post = post = (options, path, data, callback) ->
headers:
'Content-Length': dataBuffer.length
'User-Agent': Utils.getUserAgent()
+ proxy: options.proxy || Utils.getProxy()
request = Request opts, (err, response, body) ->
if err
View
@@ -32,6 +32,7 @@ program
.option('-e, --endpoint <endpoint>', 'set the API endpoint eg. https://cloud.mobify.com/api/')
.option('-u, --auth <auth>', 'username and API Key eg. username:apikey')
.option('-p, --project <project>', 'override the project name in project.json for the push destination')
+ .option('-x, --proxy <proxy url>', 'use the specified proxy. URL in the format http://[username:password@]PROXY_HOST:PROXY_PORT/')
.action Commands.push
program
View
@@ -369,3 +369,11 @@ exports.compressJs = compressJs = (js) ->
ast = Uglify.uglify.ast_mangle ast
ast = Uglify.uglify.ast_squeeze ast
Uglify.uglify.gen_code ast
+
+
+###
+Gets the system proxy
+
+###
+exports.getProxy = () ->
+ return process.env['http_proxy'] or process.env['HTTP_PROXY']

0 comments on commit d31ccea

Please sign in to comment.