-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
also: - resolves #26 - resolves #25 - closes #15 - closes #18 - closes #22 - closes #23 - closes #24
- Loading branch information
1 parent
3d73218
commit 93cf4a6
Showing
32 changed files
with
474 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Enforce Unix newlines | ||
*.* text eol=lf | ||
|
||
*.jpg binary | ||
*.gif binary | ||
*.png binary | ||
*.jpeg binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
/node_modules/ | ||
*.DS_Store | ||
*.sublime-* | ||
node_modules | ||
npm-debug.log | ||
test/actual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
{ | ||
"loopfunc": true, | ||
"asi": false, | ||
"boss": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"esnext": true, | ||
"immed": true, | ||
"latedef": true, | ||
"latedef": false, | ||
"laxbreak": true, | ||
"laxcomma": false, | ||
"newcap": true, | ||
"noarg": true, | ||
"node": true, | ||
"sub": true, | ||
"undef": true, | ||
"unused": true, | ||
"boss": true, | ||
"eqnull": true, | ||
"node": true | ||
} | ||
"mocha": true | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- 0.8 | ||
- '0.10' | ||
before_install: | ||
- npm update -g npm | ||
- npm install -g grunt-cli | ||
- "stable" | ||
- "5" | ||
- "4" | ||
- "0.12" | ||
- "0.10" | ||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- node_js: "0.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies | ||
*/ | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var isGlob = require('is-glob'); | ||
var resolveDir = require('resolve-dir'); | ||
var mm = require('micromatch'); | ||
|
||
/** | ||
* @param {String|Array} `pattern` Glob pattern or file path(s) to match against. | ||
* @param {Object} `options` Options to pass to [micromatch]. Note that if you want to start in a different directory than the current working directory, specify the `options.cwd` property here. | ||
* @return {String} Returns the first matching file. | ||
* @api public | ||
*/ | ||
|
||
module.exports = function(patterns, options) { | ||
if (typeof patterns === 'string') { | ||
return lookup(patterns, options); | ||
} | ||
|
||
if (!Array.isArray(patterns)) { | ||
throw new TypeError('findup-sync expects a string or array as the first argument.'); | ||
} | ||
|
||
var len = patterns.length, i = -1; | ||
while (++i < len) { | ||
var res = lookup(patterns[i], options); | ||
if (res) { | ||
return res; | ||
} | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
function lookup(pattern, options) { | ||
options = options || {}; | ||
var cwd = resolveDir(options.cwd || ''); | ||
if (isGlob(pattern)) { | ||
return matchFile(cwd, pattern, options); | ||
} else { | ||
return findFile(cwd, pattern); | ||
} | ||
} | ||
|
||
function matchFile(cwd, pattern, opts) { | ||
var isMatch = mm.matcher(pattern, opts); | ||
var files = fs.readdirSync(cwd); | ||
var len = files.length, i = -1; | ||
|
||
while (++i < len) { | ||
var name = files[i]; | ||
var fp = path.join(cwd, name); | ||
if (isMatch(name) || isMatch(fp)) { | ||
return fp; | ||
} | ||
} | ||
|
||
var dir = path.dirname(cwd); | ||
if (dir === cwd) { | ||
return null; | ||
} | ||
return matchFile(dir, pattern, opts); | ||
} | ||
|
||
function findFile(cwd, filename) { | ||
var fp = cwd ? (cwd + '/' + filename) : filename; | ||
if (fs.existsSync(fp)) { | ||
return fp; | ||
} | ||
|
||
var segs = cwd.split(path.sep); | ||
var len = segs.length; | ||
|
||
while (len--) { | ||
cwd = segs.slice(0, len).join('/'); | ||
fp = cwd + '/' + filename; | ||
if (fs.existsSync(fp)) { | ||
return fp; | ||
} | ||
} | ||
return null; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.