Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created February 19, 2014 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowboy/9097410 to your computer and use it in GitHub Desktop.
Save cowboy/9097410 to your computer and use it in GitHub Desktop.
globule: work in progress

Script

var globule = require('./lib/globule');

globule.find([
  '**/*.js',
  '!**/*built.js',
  '**/*.js',
  '**/*.js',
  '**/*.fail',
  '**/q*.css',
  '**/*.css',
], {
  cwd: 'test',
})
.on('match', function(filepath) {
  console.log('Match: %s', filepath);
})
.on('hit', function(data) {
  console.log('Hit (%d/%d) %s\n', data.matches.length, data.dupes.length, data.pattern);
})
.on('miss', function(data) {
  console.log('Miss %s\n', data.pattern);
})
.on('end', function(filepaths) {
  console.log('Matches', filepaths);
});

Output

Match: ctor_test.js
Match: fixtures/expand/js/bar.js
Match: fixtures/expand/js/foo.js
Match: globule_test.js
Match: mapping_test.js
Match: match_test.js
Match: path-custom_test.js
Hit (7/0) **/*.js

Match: globule_sync_test.built.js
Match: mapping_sync_test.built.js
Hit (2/7) **/*.js

Hit (0/9) **/*.js

Miss **/*.fail

Match: fixtures/expand/css/qux.css
Hit (1/0) **/q*.css

Match: fixtures/expand/css/baz.css
Hit (1/1) **/*.css

Matches [ 'ctor_test.js',
  'fixtures/expand/js/bar.js',
  'fixtures/expand/js/foo.js',
  'globule_test.js',
  'mapping_test.js',
  'match_test.js',
  'path-custom_test.js',
  'globule_sync_test.built.js',
  'mapping_sync_test.built.js',
  'fixtures/expand/css/qux.css',
  'fixtures/expand/css/baz.css' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment