diff --git a/.gitignore b/.gitignore index 518227b3..303c301b 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,11 @@ coverage.xml docs/_build/ # PyBuilder -target/ \ No newline at end of file +target/ + +# Node specific exclusions +.bin +grunt/ +grunt-cli/ +grunt-contrib-watch/ +grunt-touch/ \ No newline at end of file diff --git a/Contributing.md b/Contributing.md index 2c74e85f..ae921c99 100644 --- a/Contributing.md +++ b/Contributing.md @@ -143,24 +143,24 @@ You will need [Nodejs](http://nodejs.org/download/) installed. When developing Dependents, I have a cloned copy of this repo in `/Users/YOUR_USER_NAME/Library/Application Support/Sublime Text 3/Packages/Dependents`. -* I renamed the repo after cloning for clarity - This means that you will only be able to run the development version while developing the plugin – as the production version is installed to that location as well. -Any time I make a change to a file, I (unfortunately) have to re-save -either Dependents.py or JumpToDependency.py (depending on which feature I'm -modifying). Modifying a dependency of those files and saving does not -reload the command files. Only the reload of the command files seems to -make the changes take effect. +Run `npm install` in the root directory to pull down the dependencies. + +* Since the node tools are already committed via node_modules, you're really only pulling down +the development dependencies (which are gitignored to avoid bloating the package). + +Run `grunt` in the root of the repo to start the watcher. -* A file system watcher that resaves the command files on any file modification -should resolve this pain. +* Any time you change a file, the command files are reloaded. Otherwise, you won't see new code being used; +it's a sublime text thing. Once the command files are updated, you can test your live changes in an open instance of Sublime Text. * I'll typically keep one window open with the Dependents codebase and another window open with a test project. +* Keep the console open `CMD + `` or `View -> Show Console` to see print statements and debug information. diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 00000000..23decb51 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,37 @@ +module.exports = function(grunt) { + grunt.initConfig({ + commandFiles: [ + 'Dependents.py', + 'JumpToDependency.py', + 'FindDriver.py', + 'TreeCommand.py' + ], + + touch: { + options: { + force: true, + mtime: true + }, + src: ['<%= commandFiles %>'] + }, + + watch: { + files: [ + '*.py', + 'vendor/**/.py', + 'lib/**/*.py', + '!changelogs/**', + '!<%= commandFiles %>', + '!tests/**', + '!node_modules/**', + '!.git/**' + ], + tasks: ['touch'] + } + }); + + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-touch'); + + grunt.registerTask('default', ['watch']); +}; \ No newline at end of file diff --git a/package.json b/package.json index 7b4a31ed..6e37845e 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,12 @@ "taxicab": "~2.0.3" }, "private": true, - "devDependencies": {}, + "devDependencies": { + "grunt": "~0.4.5", + "grunt-cli": "~0.1.13", + "grunt-contrib-watch": "~0.6.1", + "grunt-touch": "~0.1.0" + }, "scripts": { "test": "nosetests" },