Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exclusions #20

Closed
wants to merge 6 commits into from
Closed

Fix exclusions #20

wants to merge 6 commits into from

Conversation

itsjamie
Copy link

After a minor change to grunt-contrib-watch, this would allow passing exclusions through via that task, which in turn gets added events to pop on the right files, not on every file in a directory that initially was added. Test case is included in this pull request which showcases a textfile being included on a rule that was */.js. I'll remove the other pull-request that only contained the test.

I ran the local npm test and had 42 passes on Win7, and I also tested in manually using my project and I was getting added events working as expected etc. The code will need to be reviewed and cleaned up. I'm not sure if it's entirely ready to go into Gaze, but it does what it needs to now, so I figure I might as well let you review / suggest changes. Tomorrow I'll mark up the files changed on GitHub to mark the ideas behind each modification in the hope of cleaning it up some. I'll also remove the console.logs.

@@ -477,7 +539,7 @@ Gaze.prototype._initWatched = function(done) {
var relFile = path.join(relDir, file);
if (_this._isMatch(relFile)) {
// Add to watch then emit event
_this.add(relFile, function() {
_this.add(null, function() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to null here because if we are already matching a pattern there is no need to add a single file pattern to our list. This will just make later calls take longer to figure out if they match or not.

@shama
Copy link
Owner

shama commented Jan 31, 2013

I'm going to be in and out of meetings the next couple of days. So give me a bit to review. Thanks!

@@ -8,7 +8,7 @@ module.exports = function(grunt) {
}
},
nodeunit: {
files: ['test/**/*_test.js'],
files: ['test/**/*_test.js']
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had an extra test in nodeunit to run my test in exclusion from the rest initially, must have got committed at some point.

@itsjamie
Copy link
Author

@shama Not a problem on the whole meeting thing, work has been slow for me lately, can you tell?

Sorry for the mass spam on the commit, I knew there would be places I could clean it up :)

Let me know if there is anything I can do.

@shama
Copy link
Owner

shama commented Jan 31, 2013

Also just a note, this is related to #7

@itsjamie
Copy link
Author

@shama

Sorry for making this so hard to maintain. I've gone ahead and updated your testcases so they are a little more standardized. I think it might be easier to close this pull request, and what I'll do is make this a little nicer for you. I'll make the changes to the testcases one commit, and the changes to the lib/gaze.js file one commit. And branch each seperately and submit as two seperate pull requests.

@shama
Copy link
Owner

shama commented Jan 31, 2013

No worries, it looks like you're making good progress. Just let me know when it's ready to review. Separate pull requests that each focus on one issue is a good idea. I'd just clean up the console.log's and lint by running grunt as well.

Just let me know when these are ready to review. I change my mind a lot with PRs too :) I actually started for big PRs, to push the commits and then sit on it for a little bit before opening the PR. Forcing myself to slow down gives me a chance to handle those "oh yeah" moments.

@shama
Copy link
Owner

shama commented Jan 31, 2013

oh yeah :) You also dont have to open new pull requests. Just push to the same branch and it will add the commits. Or even better do a git rebase to squash the commits then do a git push origin +branchname to force push the squashed commits onto the same pull request.

@itsjamie
Copy link
Author

Good to know in the future :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants