diff options
Diffstat (limited to 'node_modules/glob-parent')
-rw-r--r-- | node_modules/glob-parent/.travis.yml | 8 | ||||
-rw-r--r-- | node_modules/glob-parent/README.md | 22 | ||||
-rw-r--r-- | node_modules/glob-parent/appveyor.yml | 25 | ||||
-rw-r--r-- | node_modules/glob-parent/index.js | 5 | ||||
-rw-r--r-- | node_modules/glob-parent/node_modules/is-extglob/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/glob-parent/node_modules/is-extglob/README.md | 107 | ||||
-rw-r--r-- | node_modules/glob-parent/node_modules/is-extglob/index.js | 20 | ||||
-rw-r--r-- | node_modules/glob-parent/node_modules/is-extglob/package.json | 69 | ||||
-rw-r--r-- | node_modules/glob-parent/node_modules/is-glob/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/glob-parent/node_modules/is-glob/README.md | 142 | ||||
-rw-r--r-- | node_modules/glob-parent/node_modules/is-glob/index.js | 25 | ||||
-rw-r--r-- | node_modules/glob-parent/node_modules/is-glob/package.json | 80 | ||||
-rw-r--r-- | node_modules/glob-parent/package.json | 16 | ||||
-rw-r--r-- | node_modules/glob-parent/test.js | 103 |
14 files changed, 16 insertions, 648 deletions
diff --git a/node_modules/glob-parent/.travis.yml b/node_modules/glob-parent/.travis.yml index a404ceb22..18fc42f69 100644 --- a/node_modules/glob-parent/.travis.yml +++ b/node_modules/glob-parent/.travis.yml @@ -1,8 +1,8 @@ language: node_js node_js: - - "6" - - "5" - "4" + - "iojs-v3" + - "iojs-v2" + - "iojs-v1" + - "0.12" - "0.10" -script: - - npm run ci-test diff --git a/node_modules/glob-parent/README.md b/node_modules/glob-parent/README.md index 243ff9ccf..ff5310d3b 100644 --- a/node_modules/glob-parent/README.md +++ b/node_modules/glob-parent/README.md @@ -11,8 +11,6 @@ Usage npm install glob-parent --save ``` -**Examples** - ```js var globParent = require('glob-parent'); @@ -33,27 +31,7 @@ globParent('path/**/*'); // 'path' globParent('path/foo/bar.js'); // 'path/foo' globParent('path/foo/'); // 'path/foo' globParent('path/foo'); // 'path' (see issue #3 for details) -``` - -## Escaping - -The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: -- `?` (question mark) -- `*` (star) -- `|` (pipe) -- `(` (opening parenthesis) -- `)` (closing parenthesis) -- `{` (opening curly brace) -- `}` (closing curly brace) -- `[` (opening bracket) -- `]` (closing bracket) - -**Example** - -```js -globParent('foo/[bar]/') // 'foo' -globParent('foo/\\[bar]/') // 'foo/[bar]' ``` Change Log diff --git a/node_modules/glob-parent/appveyor.yml b/node_modules/glob-parent/appveyor.yml deleted file mode 100644 index eb932544d..000000000 --- a/node_modules/glob-parent/appveyor.yml +++ /dev/null @@ -1,25 +0,0 @@ - -# Test against this version of Node.js -environment: - matrix: - - nodejs_version: "6" - - nodejs_version: "5" - - nodejs_version: "4" - -# Install scripts. (runs after repo cloning) -install: - # Get the latest stable version of Node.js or io.js - - ps: Install-Product node $env:nodejs_version - # install modules - - npm install - -# Post-install test scripts. -test_script: - # Output useful info for debugging. - - node --version - - npm --version - # run tests - - npm test - -# Don't actually build. -build: off diff --git a/node_modules/glob-parent/index.js b/node_modules/glob-parent/index.js index 9a7e59375..61615f1ac 100644 --- a/node_modules/glob-parent/index.js +++ b/node_modules/glob-parent/index.js @@ -2,10 +2,9 @@ var path = require('path'); var isglob = require('is-glob'); -var pathDirname = require('path-dirname'); module.exports = function globParent(str) { str += 'a'; // preserves full path in case of trailing path separator - do {str = pathDirname.posix(str)} while (isglob(str)); - return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1'); + do {str = path.dirname(str)} while (isglob(str)); + return str; }; diff --git a/node_modules/glob-parent/node_modules/is-extglob/LICENSE b/node_modules/glob-parent/node_modules/is-extglob/LICENSE deleted file mode 100644 index 842218cf0..000000000 --- a/node_modules/glob-parent/node_modules/is-extglob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2016, Jon Schlinkert - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/glob-parent/node_modules/is-extglob/README.md b/node_modules/glob-parent/node_modules/is-extglob/README.md deleted file mode 100644 index 0416af5c3..000000000 --- a/node_modules/glob-parent/node_modules/is-extglob/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# is-extglob [![NPM version](https://img.shields.io/npm/v/is-extglob.svg?style=flat)](https://www.npmjs.com/package/is-extglob) [![NPM downloads](https://img.shields.io/npm/dm/is-extglob.svg?style=flat)](https://npmjs.org/package/is-extglob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-extglob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-extglob) - -> Returns true if a string has an extglob. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-extglob -``` - -## Usage - -```js -var isExtglob = require('is-extglob'); -``` - -**True** - -```js -isExtglob('?(abc)'); -isExtglob('@(abc)'); -isExtglob('!(abc)'); -isExtglob('*(abc)'); -isExtglob('+(abc)'); -``` - -**False** - -Escaped extglobs: - -```js -isExtglob('\\?(abc)'); -isExtglob('\\@(abc)'); -isExtglob('\\!(abc)'); -isExtglob('\\*(abc)'); -isExtglob('\\+(abc)'); -``` - -Everything else... - -```js -isExtglob('foo.js'); -isExtglob('!foo.js'); -isExtglob('*.js'); -isExtglob('**/abc.js'); -isExtglob('abc/*.js'); -isExtglob('abc/(aaa|bbb).js'); -isExtglob('abc/[a-z].js'); -isExtglob('abc/{a,b}.js'); -isExtglob('abc/?.js'); -isExtglob('abc.js'); -isExtglob('abc/def/ghi.js'); -``` - -## History - -**v2.0** - -Adds support for escaping. Escaped exglobs no longer return true. - -## About - -### Related projects - -* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.") -* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") -* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Building docs - -_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ - -To generate the readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm install -g verb verb-generate-readme && verb -``` - -### Running tests - -Install dev dependencies: - -```sh -$ npm install -d && npm test -``` - -### Author - -**Jon Schlinkert** - -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -### License - -Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._
\ No newline at end of file diff --git a/node_modules/glob-parent/node_modules/is-extglob/index.js b/node_modules/glob-parent/node_modules/is-extglob/index.js deleted file mode 100644 index c1d986fc5..000000000 --- a/node_modules/glob-parent/node_modules/is-extglob/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * is-extglob <https://github.com/jonschlinkert/is-extglob> - * - * Copyright (c) 2014-2016, Jon Schlinkert. - * Licensed under the MIT License. - */ - -module.exports = function isExtglob(str) { - if (typeof str !== 'string' || str === '') { - return false; - } - - var match; - while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { - if (match[2]) return true; - str = str.slice(match.index + match[0].length); - } - - return false; -}; diff --git a/node_modules/glob-parent/node_modules/is-extglob/package.json b/node_modules/glob-parent/node_modules/is-extglob/package.json deleted file mode 100644 index ccfd41fa4..000000000 --- a/node_modules/glob-parent/node_modules/is-extglob/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "is-extglob", - "description": "Returns true if a string has an extglob.", - "version": "2.1.0", - "homepage": "https://github.com/jonschlinkert/is-extglob", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/is-extglob", - "bugs": { - "url": "https://github.com/jonschlinkert/is-extglob/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^0.1.10", - "mocha": "^3.0.2" - }, - "keywords": [ - "bash", - "braces", - "check", - "exec", - "expression", - "extglob", - "glob", - "globbing", - "globstar", - "is", - "match", - "matches", - "pattern", - "regex", - "regular", - "string", - "test" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "has-glob", - "is-glob", - "micromatch" - ] - }, - "reflinks": [ - "verb", - "verb-generate-readme" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/glob-parent/node_modules/is-glob/LICENSE b/node_modules/glob-parent/node_modules/is-glob/LICENSE deleted file mode 100644 index 39245ac1c..000000000 --- a/node_modules/glob-parent/node_modules/is-glob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2016, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/glob-parent/node_modules/is-glob/README.md b/node_modules/glob-parent/node_modules/is-glob/README.md deleted file mode 100644 index 6f4404fec..000000000 --- a/node_modules/glob-parent/node_modules/is-glob/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-glob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-glob) - -> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-glob -``` - -You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob). - -## Usage - -```js -var isGlob = require('is-glob'); -``` - -**True** - -Patterns that have glob characters or regex patterns will return `true`: - -```js -isGlob('!foo.js'); -isGlob('*.js'); -isGlob('**/abc.js'); -isGlob('abc/*.js'); -isGlob('abc/(aaa|bbb).js'); -isGlob('abc/[a-z].js'); -isGlob('abc/{a,b}.js'); -isGlob('abc/?.js'); -//=> true -``` - -Extglobs - -```js -isGlob('abc/@(a).js'); -isGlob('abc/!(a).js'); -isGlob('abc/+(a).js'); -isGlob('abc/*(a).js'); -isGlob('abc/?(a).js'); -//=> true -``` - -**False** - -Escaped globs or extglobs return `false`: - -```js -isGlob('abc/\\@(a).js'); -isGlob('abc/\\!(a).js'); -isGlob('abc/\\+(a).js'); -isGlob('abc/\\*(a).js'); -isGlob('abc/\\?(a).js'); -isGlob('\\!foo.js'); -isGlob('\\*.js'); -isGlob('\\*\\*/abc.js'); -isGlob('abc/\\*.js'); -isGlob('abc/\\(aaa|bbb).js'); -isGlob('abc/\\[a-z].js'); -isGlob('abc/\\{a,b}.js'); -isGlob('abc/\\?.js'); -//=> false -``` - -Patterns that do not have glob patterns return `false`: - -```js -isGlob('abc.js'); -isGlob('abc/def/ghi.js'); -isGlob('foo.js'); -isGlob('abc/@.js'); -isGlob('abc/+.js'); -isGlob(); -isGlob(null); -//=> false -``` - -Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)): - -```js -isGlob(['**/*.js']); -isGlob(['foo.js']); -//=> false -``` - -## About - -### Related projects - -* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit") -* [base](https://www.npmjs.com/package/base): base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://github.com/node-base/base) | [homepage](https://github.com/node-base/base "base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting with a handful of common methods, like `set`, `get`, `del` and `use`.") -* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.") -* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Contributors - -| **Commits** | **Contributor**<br/> | -| --- | --- | -| 40 | [jonschlinkert](https://github.com/jonschlinkert) | -| 1 | [tuvistavie](https://github.com/tuvistavie) | - -### Building docs - -_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ - -To generate the readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm install -g verb verb-generate-readme && verb -``` - -### Running tests - -Install dev dependencies: - -```sh -$ npm install -d && npm test -``` - -### Author - -**Jon Schlinkert** - -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -### License - -Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT license](https://github.com/jonschlinkert/is-glob/blob/master/LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._
\ No newline at end of file diff --git a/node_modules/glob-parent/node_modules/is-glob/index.js b/node_modules/glob-parent/node_modules/is-glob/index.js deleted file mode 100644 index 2ecbe2a74..000000000 --- a/node_modules/glob-parent/node_modules/is-glob/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/*! - * is-glob <https://github.com/jonschlinkert/is-glob> - * - * Copyright (c) 2014-2016, Jon Schlinkert. - * Licensed under the MIT License. - */ - -var isExtglob = require('is-extglob'); - -module.exports = function isGlob(str) { - if (typeof str !== 'string' || str === '') { - return false; - } - - if (isExtglob(str)) return true; - - var regex = /(\\).|([*?]|\[.*\]|\{.*\}|\(.*\|.*\)|^!)/; - var match; - - while ((match = regex.exec(str))) { - if (match[2]) return true; - str = str.slice(match.index + match[0].length); - } - return false; -}; diff --git a/node_modules/glob-parent/node_modules/is-glob/package.json b/node_modules/glob-parent/node_modules/is-glob/package.json deleted file mode 100644 index 53a137d8c..000000000 --- a/node_modules/glob-parent/node_modules/is-glob/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "is-glob", - "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.", - "version": "3.1.0", - "homepage": "https://github.com/jonschlinkert/is-glob", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Daniel Perez <daniel@claudetech.com> (http://tuvistavie.com)", - "Jon Schlinkert <jon.schlinkert@sellside.com> (http://twitter.com/jonschlinkert)" - ], - "repository": "jonschlinkert/is-glob", - "bugs": { - "url": "https://github.com/jonschlinkert/is-glob/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "is-extglob": "^2.1.0" - }, - "devDependencies": { - "gulp-format-md": "^0.1.10", - "mocha": "^3.0.2" - }, - "keywords": [ - "bash", - "braces", - "check", - "exec", - "expression", - "extglob", - "glob", - "globbing", - "globstar", - "is", - "match", - "matches", - "pattern", - "regex", - "regular", - "string", - "test" - ], - "verb": { - "layout": "default", - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "assemble", - "base", - "update", - "verb" - ] - }, - "reflinks": [ - "assemble", - "bach", - "base", - "composer", - "gulp", - "has-glob", - "is-valid-glob", - "micromatch", - "npm", - "scaffold", - "verb", - "vinyl" - ] - } -} diff --git a/node_modules/glob-parent/package.json b/node_modules/glob-parent/package.json index 61b91bcee..5499007fb 100644 --- a/node_modules/glob-parent/package.json +++ b/node_modules/glob-parent/package.json @@ -1,11 +1,10 @@ { "name": "glob-parent", - "version": "3.0.1", - "description": "Strips glob magic from a string to provide the parent directory path", + "version": "2.0.0", + "description": "Strips glob magic from a string to provide the parent path", "main": "index.js", "scripts": { - "test": "istanbul test node_modules/mocha/bin/_mocha", - "ci-test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls" + "test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls" }, "repository": { "type": "git", @@ -16,20 +15,17 @@ "parent", "strip", "path", - "dirname", "directory", - "base", - "wildcard" + "base" ], - "author": "Elan Shanker (https://github.com/es128)", + "author": "Elan Shanker", "license": "ISC", "bugs": { "url": "https://github.com/es128/glob-parent/issues" }, "homepage": "https://github.com/es128/glob-parent", "dependencies": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" + "is-glob": "^2.0.0" }, "devDependencies": { "coveralls": "^2.11.2", diff --git a/node_modules/glob-parent/test.js b/node_modules/glob-parent/test.js index 6548261b3..01156d2ff 100644 --- a/node_modules/glob-parent/test.js +++ b/node_modules/glob-parent/test.js @@ -5,119 +5,24 @@ var assert = require('assert'); describe('glob-parent', function() { it('should strip glob magic to return parent path', function() { - assert.equal(gp('.'), '.'); - assert.equal(gp('.*'), '.'); - assert.equal(gp('/.*'), '/'); - assert.equal(gp('/.*/'), '/'); - assert.equal(gp('a/.*/b'), 'a'); - assert.equal(gp('a*/.*/b'), '.'); - assert.equal(gp('*/a/b/c'), '.'); - assert.equal(gp('*'), '.'); - assert.equal(gp('*/'), '.'); - assert.equal(gp('*/*'), '.'); - assert.equal(gp('*/*/'), '.'); - assert.equal(gp('**'), '.'); - assert.equal(gp('**/'), '.'); - assert.equal(gp('**/*'), '.'); - assert.equal(gp('**/*/'), '.'); + assert.equal(gp('path/to/*.js'), 'path/to'); + assert.equal(gp('/root/path/to/*.js'), '/root/path/to'); assert.equal(gp('/*.js'), '/'); assert.equal(gp('*.js'), '.'); assert.equal(gp('**/*.js'), '.'); - assert.equal(gp('{a,b}'), '.'); - assert.equal(gp('/{a,b}'), '/'); - assert.equal(gp('/{a,b}/'), '/'); - assert.equal(gp('(a|b)'), '.'); - assert.equal(gp('/(a|b)'), '/'); - assert.equal(gp('./(a|b)'), '.'); - assert.equal(gp('a/(b c)'), 'a', 'not an extglob'); - assert.equal(gp('a/(b c)/d'), 'a/(b c)', 'not an extglob'); - assert.equal(gp('path/to/*.js'), 'path/to'); - assert.equal(gp('/root/path/to/*.js'), '/root/path/to'); - assert.equal(gp('chapter/foo [bar]/'), 'chapter'); - assert.equal(gp('path/[a-z]'), 'path'); assert.equal(gp('path/{to,from}'), 'path'); - assert.equal(gp('path/(to|from)'), 'path'); - assert.equal(gp('path/(foo bar)/subdir/foo.*'), 'path/(foo bar)/subdir'); assert.equal(gp('path/!(to|from)'), 'path'); assert.equal(gp('path/?(to|from)'), 'path'); assert.equal(gp('path/+(to|from)'), 'path'); assert.equal(gp('path/*(to|from)'), 'path'); assert.equal(gp('path/@(to|from)'), 'path'); - assert.equal(gp('path/!/foo'), 'path/!'); - assert.equal(gp('path/?/foo'), 'path', 'qmarks must be escaped'); - assert.equal(gp('path/+/foo'), 'path/+'); - assert.equal(gp('path/*/foo'), 'path'); - assert.equal(gp('path/@/foo'), 'path/@'); - assert.equal(gp('path/!/foo/'), 'path/!/foo'); - assert.equal(gp('path/?/foo/'), 'path', 'qmarks must be escaped'); - assert.equal(gp('path/+/foo/'), 'path/+/foo'); - assert.equal(gp('path/*/foo/'), 'path'); - assert.equal(gp('path/@/foo/'), 'path/@/foo'); assert.equal(gp('path/**/*'), 'path'); assert.equal(gp('path/**/subdir/foo.*'), 'path'); - assert.equal(gp('path/subdir/**/foo.js'), 'path/subdir'); - assert.equal(gp('path/!subdir/foo.js'), 'path/!subdir'); - }); - - it('should respect escaped characters', function() { - assert.equal(gp('path/\\*\\*/subdir/foo.*'), 'path/**/subdir'); - assert.equal(gp('path/\\[\\*\\]/subdir/foo.*'), 'path/[*]/subdir'); - assert.equal(gp('path/\\*(a|b)/subdir/foo.*'), 'path'); - assert.equal(gp('path/\\*/(a|b)/subdir/foo.*'), 'path/*'); - assert.equal(gp('path/\\*\\(a\\|b\\)/subdir/foo.*'), 'path/*(a|b)/subdir'); - assert.equal(gp('path/\\[foo bar\\]/subdir/foo.*'), 'path/[foo bar]/subdir'); - assert.equal(gp('path/\\[bar]/'), 'path/[bar]'); - assert.equal(gp('path/foo \\[bar]/'), 'path/foo [bar]'); }); it('should return parent dirname from non-glob paths', function() { - assert.equal(gp('path'), '.'); - assert.equal(gp('path/foo'), 'path'); - assert.equal(gp('path/foo/'), 'path/foo'); assert.equal(gp('path/foo/bar.js'), 'path/foo'); - }); -}); - -describe('glob2base test patterns', function() { - it('should get a base name', function() { - assert.equal(gp('js/*.js'), 'js'); - }); - - it('should get a base name from a nested glob', function() { - assert.equal(gp('js/**/test/*.js'), 'js'); - }); - - it('should get a base name from a flat file', function() { - assert.equal(gp('js/test/wow.js'), 'js/test'); - assert.equal(gp('js/test/wow.js'), 'js/test'); - }); - - it('should get a base name from character class pattern', function() { - assert.equal(gp('js/t[a-z]st}/*.js'), 'js'); - }); - - it('should get a base name from brace , expansion', function() { - assert.equal(gp('js/{src,test}/*.js'), 'js'); - }); - - it('should get a base name from brace .. expansion', function() { - assert.equal(gp('js/test{0..9}/*.js'), 'js'); - }); - - it('should get a base name from extglob', function() { - assert.equal(gp('js/t+(wo|est)/*.js'), 'js'); - }); - - it('should get a base name from a path with non-exglob parens', function() { - assert.equal(gp('js/t(wo|est)/*.js'), 'js'); - assert.equal(gp('js/t/(wo|est)/*.js'), 'js/t'); - }); - - it('should get a base name from a complex brace glob', function() { - assert.equal(gp('lib/{components,pages}/**/{test,another}/*.txt'), 'lib'); - - assert.equal(gp('js/test/**/{images,components}/*.js'), 'js/test'); - - assert.equal(gp('ooga/{booga,sooga}/**/dooga/{eooga,fooga}'), 'ooga'); + assert.equal(gp('path/foo/'), 'path/foo'); + assert.equal(gp('path/foo'), 'path'); }); }); |