Skip to content

Instantly share code, notes, and snippets.

@johnae
Last active December 3, 2015 16:27

Revisions

  1. johnae revised this gist Dec 3, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ like so:

    ```
    cd ~
    git clone https://gist.github.com/fc803fe80124a0fe1953.git .spook/notifiers/ubuntu
    git clone https://gist.github.com/fc803fe80124a0fe1953.git ~/.spook/notifiers/ubuntu
    ```

    Also make sure you install "notify-send" through apt or this won't work.
  2. johnae created this gist Dec 3, 2015.
    16 changes: 16 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    This is an example Ubuntu notifier that can be used with [spook](https://github.com/johnae/spook) (a guard replacement - eg. watch for changes and run something). Clone this gist to:

    ```
    ~/.spook/notifiers/ubuntu
    ```

    like so:

    ```
    cd ~
    git clone https://gist.github.com/fc803fe80124a0fe1953.git .spook/notifiers/ubuntu
    ```

    Also make sure you install "notify-send" through apt or this won't work.

    and you're good to go.
    20 changes: 20 additions & 0 deletions notifier.moon
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    display_notification = (status, icon, info) ->
    {:detail, :elapsed_time} = info
    os.execute "notify-send -i #{icon} \"#{status}: #{project_name!}\" \"#{detail} - #{elapsed_time}s\""

    icon_pass = "starred"
    icon_fail = "software-update-urgent"
    pass_status = 'Tests passed'
    fail_status = 'Tests failed'

    runs = ->
    _, _, status = os.execute "which notify-send 2>&1 >/dev/null"
    status == 0

    finish = (success, info) ->
    if success
    display_notification pass_status, icon_pass, info
    else
    display_notification fail_status, icon_fail, info

    :finish, :runs