ember-cli-s3-sync
Advanced tools
Comparing version 0.0.7 to 0.0.8
# ember-cli-s3-sync Changelog | ||
### 0.0.8 | ||
* [FEATURE] specify multiple default cli-args inside `includeOptions` Array | ||
* [BREAKING ENHANCHEMENT] cli-args for custom commands are escaped using a proper tool [shell-escape](https://github.com/xxorax/node-shell-escape). cli-args are no longer always wrapped in double quotes | ||
* [TESTS] add tests for formatting a custom command | ||
### 0.0.5 | ||
@@ -4,0 +10,0 @@ |
'use strict'; | ||
var Promise = require('../ext/promise'); | ||
var dargs = require('dargs'); | ||
var chalk = require('chalk'); | ||
var exec = require('child_process').exec; | ||
var shellEscape = require('shell-escape'); | ||
var Promise = require('../ext/promise'); | ||
var dargs = require('dargs'); | ||
var chalk = require('chalk'); | ||
var exec = require('child_process').exec; | ||
@@ -66,18 +67,15 @@ /* | ||
args = args || []; | ||
var formattedArgs = []; | ||
var useQuotes = false; | ||
var split, formattedArgs = []; | ||
args.forEach(function(arg) { | ||
useQuotes = /\s/.test(arg); | ||
split = arg.split(/\=(.+)?/, 2); | ||
arg = arg.replace(/\=/, function() { | ||
return useQuotes ? ' "' : ' '; | ||
}); | ||
formattedArgs.push(split[0]); | ||
arg = useQuotes ? arg + '"' : arg; | ||
formattedArgs.push(arg); | ||
if (split[1]) { | ||
formattedArgs.push(split[1]); | ||
} | ||
}); | ||
return formattedArgs.join(' '); | ||
return shellEscape(formattedArgs); | ||
} | ||
@@ -98,4 +96,3 @@ | ||
includes = includes || []; | ||
var opts = {}; | ||
var key; | ||
var key, opts = {}; | ||
@@ -129,4 +126,3 @@ includes.forEach(function(arg) { | ||
includes = includes || []; | ||
var key; | ||
var incl = []; | ||
var key, incl = []; | ||
@@ -133,0 +129,0 @@ includes.forEach(function(arg, i) { |
{ | ||
"name": "ember-cli-s3-sync", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"private": false, | ||
@@ -60,3 +60,2 @@ "directories": { | ||
"dargs": "2.1.0", | ||
"sync-exec": "0.4.0", | ||
"extend": "2.0.0", | ||
@@ -66,4 +65,6 @@ "mime": "1.2.11", | ||
"requiring": "0.0.3", | ||
"rsvp": "3.0.14" | ||
"rsvp": "3.0.14", | ||
"shell-escape": "^0.2.0", | ||
"sync-exec": "0.4.0" | ||
} | ||
} |
@@ -180,7 +180,3 @@ # Ember-cli-s3-sync [](https://travis-ci.org/Vestorly/ember-cli-s3-sync) | ||
**notes:** `beforeBuild` and `afterBuild` are not run if you use `--skip-build` flag. | ||
<br> | ||
values with spaces are enclosed in double quotes ("value here") [what does that mean?](http://stackoverflow.com/a/6697781/1456738) | ||
- double quotes means that some characters (e.g., '*', '@', $', '`', '"', '\', '!') will preserve their special meaning. Some of these special characters can be taken literally when preceded by a backslash. | ||
## TODO | ||
@@ -187,0 +183,0 @@ - [ ] better test coverage |
@@ -48,4 +48,4 @@ 'use strict'; | ||
var dummyCommandsWithOptions = [ | ||
'echo "command number 4" --foo bar --num 24', | ||
'echo "command number 5" --truthy --some-option "i am a string"', | ||
"echo \"command number 4\" --foo bar --num 24", | ||
"echo \"command number 5\" --truthy --some-option 'i am a string'", | ||
]; | ||
@@ -52,0 +52,0 @@ |
@@ -60,4 +60,4 @@ 'use strict'; | ||
var expect = 'echo "command test" ' + | ||
'--truthy ' + | ||
'--some-option "i am spacey"'; | ||
"--truthy " + | ||
"--some-option 'i am spacey'"; | ||
@@ -81,3 +81,3 @@ assert.equal(actual, expect, 'Command formatted correctly'); | ||
'--truthy ' + | ||
'--not-provided "i am a default" ' + | ||
'--not-provided \'i am a default\' ' + | ||
'--foo bar'; | ||
@@ -91,6 +91,6 @@ | ||
var expect = 'echo "command test" ' + | ||
'--cookie session=abcdef ' + | ||
'--header "Content-Type: text/html" ' + | ||
'--header "Connection: keep-alive" ' + | ||
'--proxy-header "Accept-Encoding: gzip"'; | ||
"--cookie 'session=abcdef' " + | ||
"--header 'Content-Type: text/html' " + | ||
"--header 'Connection: keep-alive' " + | ||
"--proxy-header 'Accept-Encoding: gzip'"; | ||
@@ -103,9 +103,9 @@ assert.equal(actual, expect, 'Command formatted correctly'); | ||
var expect = 'echo "command test" ' + | ||
'--cookie session=abcdef ' + | ||
'--cookie GMT=-5 ' + | ||
'--header "Content-Type: text/html" ' + | ||
'--header "Connection: keep-alive" ' + | ||
'--header "X-Forwarded-For: me.com" ' + | ||
'--proxy-header "Host: me.com" ' + | ||
'--proxy-header "Accept-Encoding: gzip"'; | ||
"--cookie 'session=abcdef' " + | ||
"--cookie 'GMT=-5' " + | ||
"--header 'Content-Type: text/html' " + | ||
"--header 'Connection: keep-alive' " + | ||
"--header 'X-Forwarded-For: me.com' " + | ||
"--proxy-header 'Host: me.com' " + | ||
"--proxy-header 'Accept-Encoding: gzip'"; | ||
@@ -112,0 +112,0 @@ assert.equal(actual, expect, 'Command formatted correctly'); |
61171
12
1504
195
+ Addedshell-escape@^0.2.0
+ Addedshell-escape@0.2.0(transitive)