Comparing version 0.3.4 to 0.3.5
@@ -195,3 +195,3 @@ /* | ||
task('createTests, function () { | ||
if (!path.existsSync('./tests')) { | ||
if (!fs.existsSync('./tests')) { | ||
fail('Test directory does not exist.'); | ||
@@ -198,0 +198,0 @@ } |
@@ -21,7 +21,6 @@ /* | ||
, minimatch // Lazy-required | ||
, glob = {}; | ||
, globSync; | ||
glob.globSync = function (pat) { | ||
// path.dirname can't handle paths with globstar (**) | ||
var dirname = path.dirname(pat).split(/\/|\\/)[0] | ||
globSync = function (pat) { | ||
var dirname = jake.basedir(pat) | ||
, files = jake.readdirR(dirname) | ||
@@ -147,3 +146,3 @@ , matches; | ||
var _addMatching = function (pat) { | ||
var matches = glob.globSync(pat); | ||
var matches = globSync(pat); | ||
this.items = this.items.concat(matches); | ||
@@ -172,3 +171,3 @@ } | ||
if (/[*?]/.test(pat)) { | ||
matches = glob.globSync(pat); | ||
matches = globSync(pat); | ||
excl = excl.concat(matches); | ||
@@ -175,0 +174,0 @@ } |
@@ -21,2 +21,4 @@ /* | ||
, fs = require('fs') | ||
, existsSync = typeof fs.existsSync == 'function' ? | ||
fs.existsSync : path.existsSync | ||
, fileUtils = require('./utils/file') | ||
@@ -41,4 +43,4 @@ , Loader; | ||
var cwd = process.cwd(); | ||
if (path.existsSync(jakefile) || path.existsSync(jakefile + '.js') || | ||
path.existsSync(jakefile + '.coffee')) { | ||
if (existsSync(jakefile) || existsSync(jakefile + '.js') || | ||
existsSync(jakefile + '.coffee')) { | ||
return true; | ||
@@ -59,3 +61,3 @@ } | ||
isCoffee = path.existsSync(jakefile + '.coffee'); | ||
isCoffee = existsSync(jakefile + '.coffee'); | ||
if (isCoffee) { | ||
@@ -71,3 +73,3 @@ CoffeeScript = _requireCoffee(); | ||
dirname = fileUtils.absolutize(dirname); | ||
if (path.existsSync(dirname)) { | ||
if (existsSync(dirname)) { | ||
dirlist = fs.readdirSync(dirname); | ||
@@ -74,0 +76,0 @@ dirlist.forEach(function (filePath) { |
@@ -21,4 +21,3 @@ /* | ||
, fs = require('fs') | ||
, exec = require('child_process').exec | ||
, currDir = process.cwd(); | ||
, exec = require('child_process').exec; | ||
@@ -245,3 +244,6 @@ /** | ||
var cmd | ||
, opts = _compressOpts[p]; | ||
, opts = _compressOpts[p] | ||
// Save the current dir so it's possible to pop back up | ||
// after compressing | ||
, currDir = process.cwd(); | ||
@@ -274,3 +276,3 @@ // Move into the package dir to compress (see below, after | ||
// Return back up to the project directory (see above, | ||
// Return back up to the starting directory (see above, | ||
// before exec) | ||
@@ -277,0 +279,0 @@ process.chdir(currDir); |
var fs = require('fs') | ||
, path = require('path') | ||
, existsSync = typeof fs.existsSync == 'function' ? | ||
fs.existsSync : path.existsSync | ||
, EventEmitter = require('events').EventEmitter | ||
@@ -144,3 +146,3 @@ , Task | ||
// Create a dummy FileTask if file actually exists | ||
if (path.existsSync(filePath)) { | ||
if (existsSync(filePath)) { | ||
stats = fs.statSync(filePath); | ||
@@ -147,0 +149,0 @@ prereq = new jake.FileTask(name); |
@@ -227,4 +227,5 @@ var fs = require('fs') | ||
this.isAbsolute = function (p) { | ||
if (p.indexOf('/') == 0 || /^[A-Za-z]+:\\/.test(p)) { | ||
return true; | ||
var match = /^[A-Za-z]+:\\|^\//.exec(p); | ||
if (match && match.length) { | ||
return match[0]; | ||
} | ||
@@ -243,2 +244,20 @@ return false; | ||
this.basedir = function (p) { | ||
var str = p || '' | ||
, abs = this.isAbsolute(p); | ||
if (abs) { | ||
return abs; | ||
} | ||
// Split into segments | ||
str = str.split(/\\|\//)[0]; | ||
// If the path has a leading asterisk, basedir is the current dir | ||
if (str.indexOf('*') > -1) { | ||
return '.'; | ||
} | ||
// Otherwise it's the first segment in the path | ||
else { | ||
return str; | ||
} | ||
}; | ||
})(); | ||
@@ -245,0 +264,0 @@ |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", | ||
@@ -13,0 +13,0 @@ "bin": { |
@@ -683,9 +683,4 @@ ### Jake -- JavaScript build tool for Node.js | ||
PackageTask requires NodeJS's minimatch module | ||
(https://github.com/isaacs/minimatch). It is used in FileList, which is used to | ||
specify the list of files to include in your PackageTask (the packageFiles | ||
property). (See FileList, below.) | ||
### FileList | ||
## FileList | ||
Jake's FileList takes a list of glob-patterns and file-names, and lazy-creates a | ||
@@ -697,4 +692,3 @@ list of files to include. Instead of immediately searching the filesystem to | ||
called on the FileList, the pending patterns are resolved into an actual list of | ||
file-names. FileList uses NodeJS's minimatchmodule | ||
(https://github.com/isaacs/minimatch). | ||
file-names. FileList uses the [minimatch](https://github.com/isaacs/minimatch) module. | ||
@@ -701,0 +695,0 @@ To build the list of files, use FileList's `include` and `exclude` methods: |
@@ -41,2 +41,38 @@ var assert = require('assert') | ||
// TODO: Need Windows test with c:\\ | ||
, 'test basedir with Unix absolute path': function () { | ||
var p = '/foo/bar/baz'; | ||
assert.equal('/', fileUtils.basedir(p)); | ||
} | ||
, 'test basedir with Unix absolute path and double-asterisk': function () { | ||
var p = '/**/foo/bar/baz'; | ||
assert.equal('/', fileUtils.basedir(p)); | ||
} | ||
, 'test basedir with leading double-asterisk': function () { | ||
var p = '**/foo'; | ||
assert.equal('.', fileUtils.basedir(p)); | ||
} | ||
, 'test basedir with leading asterisk': function () { | ||
var p = '*.js'; | ||
assert.equal('.', fileUtils.basedir(p)); | ||
} | ||
, 'test basedir with leading dot-slash and double-asterisk': function () { | ||
var p = './**/foo'; | ||
assert.equal('.', fileUtils.basedir(p)); | ||
} | ||
, 'test basedir with leading dirname and double-asterisk': function () { | ||
var p = 'a/**/*.js'; | ||
assert.equal('a', fileUtils.basedir(p)); | ||
} | ||
, 'test basedir with leading dot-dot-slash and double-asterisk': function () { | ||
var p = '../test/**/*.js'; | ||
assert.equal('..', fileUtils.basedir(p)); | ||
} | ||
}; | ||
@@ -43,0 +79,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131244
3177
841