Permalink
Browse files

Replace shellwords with 3rd-party module

  • Loading branch information...
1 parent fe3a4ef commit a84b6c88a95fba79f2c0d20ba0134f7888e1448d @ixti ixti committed Jul 24, 2012
Showing with 7 additions and 29 deletions.
  1. +2 −2 bin/mincer.js
  2. +0 −23 lib/mincer/common.js
  3. +3 −3 lib/mincer/processors/directive_processor.js
  4. +2 −1 package.json
View
@@ -9,12 +9,12 @@ var path = require('path');
// 3rd-party
-var ArgumentParser = require('argparse').ArgumentParser;
+var ArgumentParser = require('argparse').ArgumentParser;
+var shellwords = require('shellwords').split;
// internal
var Mincer = require('..');
-var shellwords = require('../lib/mincer/common').shellwords;
////////////////////////////////////////////////////////////////////////////////
View
@@ -46,29 +46,6 @@ module.exports.normalizeExtension = function (extension) {
-// parse string in a BASH style
-// inspired by Shellwords module of Ruby
-var SHELLWORDS_PATTERN = /\s*(?:([^\s\\\'\"]+)|'((?:[^\'\\]|\\.)*)'|"((?:[^\"\\]|\\.)*)")/;
-module.exports.shellwords = function (line) {
- var words = [], match, field;
-
- while (line) {
- match = SHELLWORDS_PATTERN.exec(line);
-
- if (!match || !match[0]) {
- line = false;
- } else {
- line = line.substr(match[0].length);
- field = (match[1] || match[2] || match[3] || '').replace(/\\(.)/, '$1');
-
- words.push(field);
- }
- }
-
- return words;
-};
-
-
// Dummy alternative to Ruby's Pathname#is_absolute
var ABSOLUTE_PATH_PATTERN = /^\//;
module.exports.isAbsolute = function (pathname) {
@@ -31,15 +31,15 @@ var path = require('path');
// 3rd-party
-var _ = require('underscore');
-var async = require('async');
+var _ = require('underscore');
+var async = require('async');
+var shellwords = require('shellwords').split;
// internal
var Template = require('../template');
var prop = require('../common').prop;
var getter = require('../common').getter;
-var shellwords = require('../common').shellwords;
var isAbsolute = require('../common').isAbsolute;
var isRelative = require('../common').isRelative;
View
@@ -22,7 +22,8 @@
"argparse" : "~ 0.1.3",
"fs-tools" : "~ 0.2.2",
"async" : "~ 0.1.22",
- "underscore" : "~ 1.3.3"
+ "underscore" : "~ 1.3.3",
+ "shellwords" : "~ 0.1.0"
},
"devDependencies" : { "mocha": "~> 1.3.0" },
"engines" : { "node": ">= 0.6.0" }

0 comments on commit a84b6c8

Please sign in to comment.