Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

Commit

Permalink
Check if finder path has gruntfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Lind committed Jun 9, 2015
1 parent e5d7714 commit 27f4b93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 9 additions & 0 deletions lib/Grunt.js
Expand Up @@ -3,9 +3,18 @@
const spawn = require('child_process').spawn
const notifier = require('node-notifier')
const getGruntTasks = require('get-grunt-tasks')
const fs = require('fs')
const path = require('path')

global.processes = {}

exports.hasFile = function (p, cb) {
fs.stat(path.join(p, 'gruntfile.js'), function (err, stats) {
if (err) return cb(false)
return cb(true)
})
}

exports.getTasks = function () {
return new Promise(function (resolve, reject) {
let current = window.localStorage.getItem('current')
Expand Down
10 changes: 6 additions & 4 deletions src/tray.js
Expand Up @@ -105,11 +105,13 @@ void (function () {
if (window.localStorage.getItem('followFinder') === 'true') {
finderInterval = setInterval(function () {
currentPath(function (err, path) {
if (!err && window.localStorage.getItem('current') !== path) {
window.localStorage.setItem('current', path)
grunt.hasFile(path, function (status) {
if (!err && window.localStorage.getItem('current') !== path && status) {
window.localStorage.setItem('current', path)

rebuild()
}
rebuild()
}
})
})
}, FINDER_UPDATE)
}
Expand Down

0 comments on commit 27f4b93

Please sign in to comment.