Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

honor .gitignore

  • Loading branch information...
commit 601c24c6b8dfa162142e809191d8864bbfcd05a0 1 parent 1a06f05
@crcn authored
View
BIN  .DS_Store
Binary file not shown
View
5 .cupboard
@@ -1,2 +1,7 @@
[commands]
proj = subl --project project.sublime-project
+
+
+[ignore]
+project.sublime-project
+project.sublime-workspace
View
9 .gitignore
@@ -1,9 +1,4 @@
node_modules
data
-node_modules
-beanpole node_modules
-beanpole node_modules
-beanpoll node_modules
-beanpoll node_modules
-.DS_Store
-
+project.sublime-project
+project.sublime-workspace
View
BIN  conf/.DS_Store
Binary file not shown
View
BIN  lib/beans/.DS_Store
Binary file not shown
View
47 lib/beans/cbd.projects/getUpdatedFiles.js
@@ -1,7 +1,31 @@
var findit = require('findit'),
relativeDate = require('relative-date'),
exec = require('child_process').exec,
-fs = require('fs');
+fs = require('fs'),
+_ = require('underscore'),
+ini = require('ini');
+
+
+function getIgnore(path, file) {
+ try {
+ return fs.readFileSync(path + "/" + file, "utf8").split(/\n+/g);
+ } catch(e) {
+ return [];
+ }
+}
+
+function getCbdIgnore(path) {
+
+ try {
+ var cfg = ini.parse(fs.readFileSync(path + "/.cupboard", "utf8"));
+
+ return cfg.ignore ? Object.keys(cfg.ignore) : [];
+ } catch(e) {
+ return [];
+ }
+
+ return [];
+}
module.exports = function(path, sinceDate, callback) {
@@ -10,6 +34,16 @@ module.exports = function(path, sinceDate, callback) {
var updatedFiles = [],
count = 0;
+
+ var ignore = getIgnore(path, '.gitignore').concat(getCbdIgnore(path)).filter(function(search) {
+ return search.match(/\w+/);
+ })
+
+ ignore = _.map(ignore, function(search) {
+ return new RegExp('(^|[^\\w])' + search + '([^\\w]|$)');
+ })
+
+
exec(__dirname + '/mostRecent ' + Math.round(sinceDate/1000) + ' ' + path, { cwd: path }, function(err, stdout) {
if(err) return callback(err);
@@ -17,9 +51,14 @@ module.exports = function(path, sinceDate, callback) {
var files = [];
stdout.split(/[\n\r]+/g).forEach(function(file) {
-
-
- if(!file.match(/\w+/g) || file.match(/\/(node_modules|\.)/)) return;
+
+
+ var intersect = ignore.filter(function(search) {
+ return search.test(file);
+ });
+
+
+ if(!file.match(/\w+/g) || file.match(/\/(node_modules|\.)/) || intersect.length) return;
file = file.substr(2);
View
4 package.json
@@ -2,7 +2,7 @@
"author": "Craig Condon <craig@crcn.com>",
"name": "cupboard",
"description": "Reverse Repo System",
- "version": "0.2.2",
+ "version": "0.2.3",
"repository": {
"type": "git",
"url": "git://github.com/crcn/cupboard.git"
@@ -31,4 +31,4 @@
},
"nexe-main": "./bin/cupboard.js",
"devDependencies": {}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.