Skip to content

Commit

Permalink
Grunt watcher for command files
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjoelkemp committed Feb 27, 2015
1 parent 99a5db0 commit 3677f95
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 11 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,11 @@ coverage.xml
docs/_build/

# PyBuilder
target/
target/

# Node specific exclusions
.bin
grunt/
grunt-cli/
grunt-contrib-watch/
grunt-touch/
18 changes: 9 additions & 9 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

37 changes: 37 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -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']);
};
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 3677f95

Please sign in to comment.