atom-hooks

Execute commands depending on file path and editor events (e.g. save)

SleepWalker

119

2

0.3.2

MIT

GitHub

This package consumes the following services:

Atom hooks package

Build Status (osx, linux) Build status (windows) Dependency Status

This is still beta, so no docs are available

'scripts':
    'sync': 'node foo'
'hooks':
    'onSave':
        '{bar, baz}': 'sync'
        '{bar, baz}': ['lint', 'sync']
        '{bar, baz}':conf
            '*.scss': 'compile'
            '*.js': ['lint', 'compile']

Supported hooks

Create an issue if you want some more hooks

Usage

Rsync file on save

If you are working with remote server, you probably need a way to upload changed files back to the server. This can be done using onSave hook with rsync and ssh:

"*":
  "atom-hooks":
    hooks:
        "~/path/to/project/**": "rsync -rltvzR -e ssh ${project}/./${relative} user@host:~/path/to/remote/project"

Available script variables

For the following path /path/to/the/project/src/file.js you will get the next variables to use in your scripts:

{
  project: '/path/to/the/project',
  root: '/',
  path: '/path/to/the/project/src/file.js',
  relative: 'src/file.js',
  dir: '/path/to/the/project/src',
  base: 'file.js',
  ext: '.js',
  name: 'file'
}