diff --git a/package.json b/package.json index 1131f2c..8cbd32b 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "latest-version": "^2.0.0", "lodash": "^3.10.1", "minimatch": "^3.0.0", + "parse-gitignore": "^0.3.1", "prompt": "^0.2.14", "rsync": "^0.4.0", "untildify": "^2.1.0", diff --git a/src/local/index.js b/src/local/index.js index a98b31b..d7f482e 100644 --- a/src/local/index.js +++ b/src/local/index.js @@ -5,6 +5,8 @@ */ import _ from 'lodash'; import os from 'os'; +import untildify from 'untildify'; +import gitignore from 'parse-gitignore'; import constants from '../../conf/constants'; import text from '../../conf/text'; import eventsConf from '../../conf/events'; @@ -47,6 +49,9 @@ function startProject (config, projectConf) { let destinationLocation = util.ensureTrailingSlash(projectConf.destinationLocation); let secret = util.getId(); + // parse excludesFile + projectConf.excludes = [].concat.apply(projectConf.excludes, projectConf.excludesFile.map(untildify).map(gitignore)); + let fsHelper = new FSHelper({ sourceLocation: sourceLocation, excludes: projectConf.excludes, diff --git a/src/project-helper.js b/src/project-helper.js index b62b50e..e992305 100644 --- a/src/project-helper.js +++ b/src/project-helper.js @@ -53,6 +53,11 @@ export default { return csv.split(','); } }, + excludesFile: { + description: 'Would you like to load excludes from file?', + default: '.gitignore,~/.gitignore', + before: csv => csv.split(','), + }, prefersEncrypted: { description: 'Would you like to encrypt the sync messages? (yes/no):', before: util.toBoolean, diff --git a/test/local/index.mspec.js b/test/local/index.mspec.js index 60f9d66..7f60d40 100644 --- a/test/local/index.mspec.js +++ b/test/local/index.mspec.js @@ -26,6 +26,7 @@ var testConfig = { myProject: { project: 'myProject', excludes: ['.git'], + excludesFile: ['.gitignore'], sourceLocation: '~/wat', destinationLocation: '~/wat', hostname: 'yo-dawg', diff --git a/test/project-helper.mspec.js b/test/project-helper.mspec.js index e0ed0d1..412581a 100644 --- a/test/project-helper.mspec.js +++ b/test/project-helper.mspec.js @@ -34,6 +34,7 @@ describe('Project-Helper', function () { 'sourceLocation', 'destinationLocation', 'excludes', + 'excludesFile', 'prefersEncrypted', 'websocketPort', 'followSymLinks', @@ -52,6 +53,7 @@ describe('Project-Helper', function () { 'sourceLocation', 'destinationLocation', 'excludes', + 'excludesFile', 'prefersEncrypted', 'websocketPort', 'followSymLinks'