GithubHelp home page GithubHelp logo

notiffany's Introduction

Guard

Gem Version Build Status Code Climate Test Coverage Inline docs Reviewed by Hound

Guard Icon

Guard automates various tasks by running custom rules whenever file or directories are modified.

It's frequently used by software developers, web designers, writers and other specialists to avoid mundane, repetitive actions and commands such as "relaunching" tools after changing source files or configurations.

Common use cases include: an IDE replacement, web development tools, designing "smart" and "responsive" build systems/workflows, automating various project tasks and installing/monitoring various system services.

For a full categorized list of known Guard plugins, look here: https://github.com/guard/guard/wiki/Guard-Plugins

If you have any questions about Guard or want to share some information with the Guard community, please go to one of the following places:

Before you file an issue, make sure you have read the known issues and file an issue sections that contains some important information.

Features

  • File system changes handled by our awesome Listen gem.
  • Support for visual system notifications.
  • Huge eco-system with more than 300 Guard plugins.
  • Tested against the latest Ruby 2.4.x, 2.5.x, 2.6.x, JRuby & Rubinius. See .travis-ci.yml for the exact versions.

Screencast

Two nice screencasts are available to help you get started:

Installation

The simplest way to install Guard is to use Bundler.

Add Guard (and any other dependencies) to a Gemfile in your project’s root:

group :development do
  gem 'guard'
end

then install it by running Bundler:

$ bundle

Generate an empty Guardfile with:

$ bundle exec guard init

Run Guard through Bundler with:

$ bundle exec guard

If you are on Mac OS X and have problems with either Guard not reacting to file changes or Pry behaving strange, then you should add proper Readline support to Ruby on macOS.

Avoiding gem/dependency problems

It's important that you always run Guard through Bundler to avoid errors.

If you're getting sick of typing bundle exec all the time, try one of the following:

  • (Recommended) Running bundle binstub guard will create bin/guard in your project, which means running bin/guard (tab completion will save you a key stroke or two) will have the exact same result as bundle exec guard.

  • Or, you can alias be="bundle exec" in your .bashrc or similar and the execute only be guard. Protip: It will work for all comands executed in bundle exec context!

  • Or, for RubyGems >= 2.2.0 (at least, though the more recent the better), simply set the RUBYGEMS_GEMDEPS environment variable to - (for autodetecting the Gemfile in the current or parent directories) or set it to the path of your Gemfile.

(To upgrade RubyGems from RVM, use the rvm rubygems command).

NOTE: this Rubygems feature is still under development still lacks many features of bundler

Add Guard plugins

Guard is now ready to use and you should add some Guard plugins for your specific use. Start exploring the many Guard plugins available by browsing the Guard organization on GitHub or by searching for guard- on RubyGems.

When you have found a Guard plugin of your interest, add it to your Gemfile:

group :development do
  gem '<guard-plugin-name>'
end

See the init section of the Guard usage below to see how to install the supplied plugin template that you can install and to suit your needs.

Usage

Guard is run from the command line. Please open your terminal and go to your project work directory.

Look here for a full list of Guard commands

Start

Just launch Guard inside your Ruby or Rails project with:

$ bundle exec guard

Guard will look for a Guardfile or guardfile.rb in your current directory. If it does not find one, it will look in your $HOME directory for a .Guardfile.

Please look here to see all the command line options for Guard

Interactions

Please read how to interact with Guard on the console and which signals Guard accepts

Guardfile DSL

For details on extending your Guardfile look at Guardfile examples or look at a list of commands Guardfile-DSL / Configuring-Guard

Issues

Before reporting a problem, please read how to File an issue.

Development / Contributing

See the Contributing Guide.

Releasing

Prerequisites

  • You must have commit rights to the GitHub repository.
  • You must have push rights for rubygems.org.

How to release

  1. Determine which would be the correct next version number according to semver.
  2. Update the version in ./lib/guard/version.rb.
  3. Commit the version in a single commit, the message should be "Bump VERSION to X.Y.Z".
  4. Push and open a pull request.
  5. Once CI is green, merge the pull request.
  6. Pull the changes locally and run bundle exec rake release:full; this will tag, push to GitHub, publish to rubygems.org, and publish the release notes .

Author

Thibaud Guillaume-Gentil (@thibaudgg)

Core Team

Contributors

https://github.com/guard/guard/graphs/contributors

notiffany's People

Contributors

amiel avatar anithri avatar cablegram avatar codechips avatar d1 avatar e2 avatar eitoball avatar etehtsea avatar jamesdabbs avatar jgrocho avatar johnbintz avatar juanitofatas avatar kaosf avatar lucasau avatar maher4ever avatar mattgreen avatar matthijsgroen avatar mbranch avatar netzpirat avatar nickmabry avatar nicksieger avatar pskocik avatar rudicode avatar rymai avatar scottdavis avatar stereobooster avatar thibaudgg avatar viking avatar wadetandy avatar yannlugrin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

notiffany's Issues

Emacs notifier stops guard dead if emacs-server isn't running

We have a few developers on our team who use Emacs and some who don't even have it installed on their machines.

We have had notification :emacs in our project's Guardfile for a while, and it would display a message but guard would continue running if Emacs (specifically, Emacs + Emacs-server) wasn't running.

Now, though, it hits the error on https://github.com/guard/notiffany/blob/master/lib/notiffany/notifier/emacs.rb#L51 and aborts.

14:45:52 guard.1         | /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier/emacs.rb:51:in `_check_available': Emacs client failed (Notiffany::Notifier::Base::UnavailableError)
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier/base.rb:58:in `initialize'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier/detected.rb:91:in `new'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier/detected.rb:91:in `add'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier.rb:102:in `block in initialize'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier.rb:101:in `each'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier.rb:101:in `initialize'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier.rb:42:in `new'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/notiffany-0.0.3/lib/notiffany/notifier.rb:42:in `connect'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/guard-2.11.1/lib/guard/notifier.rb:11:in `connect'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/guard-2.11.1/lib/guard.rb:61:in `setup'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/guard-2.11.1/lib/guard/commander.rb:32:in `start'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/guard-2.11.1/lib/guard/cli/environments/valid.rb:16:in `start_guard'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/guard-2.11.1/lib/guard/cli.rb:113:in `start'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/guard-2.11.1/lib/guard/aruba_adapter.rb:32:in `execute'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/guard-2.11.1/lib/guard/aruba_adapter.rb:19:in `execute!'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/gems/guard-2.11.1/bin/guard:11:in `<top (required)>'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/bin/guard:23:in `load'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-2.1.2@project/bin/guard:23:in `<main>'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-.1.2@project/bin/ruby_executable_hooks:15:in `eval'
14:45:52 guard.1         |      from /Users/r4v5/.rvm/gems/ruby-.1.2@project/bin/ruby_executable_hooks:15:in `<main>'
14:45:52 guard.1         | exited with code 1

Review request

@rymai , @thibaudgg - I've extracted the notifiers from Guard to this gem.

If you have any comments, feedback - just list whatever you'd want changed (you can add as many issues as you want).

Feel free to add yourself as authors/contributors (I preserved the repository history as much as possible) and feel free to unwatch, etc.

But if you don't have time, don't bother ;)

Reason behind such large images?

I run a mimimalist window manager with dunst as my notification daemon. That daemon currently does not currently support resizing icons via a maximum size. That being said, what is the reasoning for such large icons? It makes Guard's notifications essentially unusable for me, since they're not resized by the daemon.

It seems like they should be smaller by default, particularly since the size they currently are requires resizing for any sort of notification.

Note: I also filed a feature request with them, so I'm following up on both fronts.

Title passed into Notiffany.connect is not used by terminal title notifier

README.md says to do this:

notifier = Notiffany.connect(title: "A message")
notifier.notify("Hello there!", image: :success)

but when I do this, the title in my terminal window is set to "[Notiffany] Hello there!".

If I read the code correctly, only four options can be passed into Notifier.connect (namespace, logger, notify, and notifiers); other options are not passed to the notifier constructors, which means they always get the default title ("Notiffany"):

2.1.7 :026 > notifier.available
 => [#<Notiffany::Notifier::Tmux:0x00000002552a38 @options={:title=>"Notiffany", :tmux_environment=>"TMUX", :success=>"green", :failed=>"red", :pending=>"yellow", :default=>"green", :timeout=>5, :display_message=>false, :default_message_format=>"%s - %s", :default_message_color=>"white", :display_on_all_clients=>false, :display_title=>false, :default_title_format=>"%s - %s", :line_separator=>" - ", :change_color=>true, :color_location=>"status-left-bg"}, @images_path=#<Pathname:/home/pbrannan/.rvm/gems/ruby-2.1.7/gems/notiffany-0.1.1/images>, @session=nil>, #<Notiffany::Notifier::TerminalTitle:0x00000002550c10 @options={:title=>"Notiffany"}, @images_path=#<Pathname:/home/pbrannan/.rvm/gems/ruby-2.1.7/gems/notiffany-0.1.1/images>>]
2.1.7 :027 > notifier.available.first.options[:title]

Guard hangs in tmux?

This is the output I am getting:

❯ be guard -d
13:55:43 - DEBUG - Notiffany: gntp not available (Please add "gem 'ruby_gntp'" to your Gemfile and run your app with "bundle exec".).
13:55:43 - DEBUG - Notiffany: growl not available (Unsupported platform "linux").
13:55:43 - DEBUG - Notiffany: terminal_notifier not available (Unsupported platform "linux").
13:55:43 - DEBUG - Notiffany: libnotify not available (Please add "gem 'libnotify'" to your Gemfile and run your app with "bundle exec".).
13:55:43 - DEBUG - Command execution: which notify-send
13:55:43 - DEBUG - Command execution: {"ALTERNATE_EDITOR"=>"false"} emacsclient --eval '1'
13:55:43 - DEBUG - Notiffany: emacs not available (Emacs client failed).
13:55:43 - DEBUG - Command execution: tmux -V
13:55:43 - DEBUG - Notiffany: file not available (No :path option given).
13:55:43 - DEBUG - Command execution: which notify-send
13:55:43 - DEBUG - Command execution: tmux -V
13:55:43 - DEBUG - Notiffany is using NotifySend to send notifications.
13:55:43 - DEBUG - Notiffany is using Tmux to send notifications.
13:55:43 - DEBUG - Command execution: tmux list-clients -F '#{client_tty}'

:type appears to be a symbol, not a string

Type is documented in several places as being a string:

And sometimes referenced as a string:

urgency: opts[:urgency] || (opts[:type] == "failed" ? :normal : :low)

Whenver I snoop on the values of type, they look like a symbol though. You may wish to update the docs and tweak that libnotify priority switch if they're intended to always be symbols.

Setting foreground color of status

Is there a way of setting the status foreground color? I know it's possible to specify the background color using success, failure and pending. Is there a equivalent for foreground color?

If not, I'm happy to submit a pull request for it. I'm thinking that we introduce default_status_color, success_status_color, failed_status_color and pending_status_color. This will be inline with how you specify the message foreground colors.

Sounds good? @e2

Emacs notifications with `notification :off`

I have an issue where the default emacs notification gets run even with notification(:off) in my ~/.guard.rb.

I'd like to use a custom Emacs script like this one in the wiki but when I allow notifications to be on at all, my mode-line background color changes with every guard run.

Here's my setup.

# ~/.guard.rb

notification(
  :emacs,
  elisp_file: '~/.dotfiles/ruby/notiffany.erb',
  success: 'ok',
  failed: 'error',
  default: 'Black',
  fontcolor: 'White'
)

# ~/.dotfiles/ruby/notiffany.erb

(progn
  (if (string= "<%= bgcolor %>" "ok")
      (setq mode-line-guard-status 'ok)
    (setq mode-line-guard-status 'error))
  (force-mode-line-update))

When I run bundle exec guard -d, I can see that my elisp file is being run, and I'm seeing what I expect, but the default elisp snippet is also run.

If I set notification(:off) in ~/.guard.rb and run bundle exec guard -d I don't see any notification output in the terminal, but the default elisp snippet is run anyways.

The only way I've been able to get the default elisp snippet to stop running is to use guard with --no-notify or to set GUARD_NOTIFY=false in my terminal, which means I can't get any notifications.

Can you help me only get my custom emacs notification, and turn the default one off?

tmux/client.rb:12:in `Float': can't convert nil into Float (TypeError)

Run in on macOS.

Ruby: 2.3.1
Guard: 2.14.1

guard start                                                                                                                                     

Warning: you have a Gemfile, but you're not using bundler or RUBYGEMS_GEMDEPS
01:04:14 - INFO - Guard here! It looks like your project has a Gemfile, yet you are running
> [#] `guard` outside of Bundler. If this is your intent, feel free to ignore this
> [#] message. Otherwise, consider using `bundle exec guard` to ensure your
> [#] dependencies are loaded correctly.
> [#] (You can run `guard` with --no-bundler-warning to get rid of this message.)

/Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/tmux/client.rb:12:in `Float': can't convert nil into Float (TypeError)

        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/tmux/client.rb:12:in `version'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/tmux.rb:69:in `_check_available'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/base.rb:59:in `initialize'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/detected.rb:100:in `new'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/detected.rb:100:in `_add'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/detected.rb:62:in `block (2 levels) in detect'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/detected.rb:60:in `each'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/detected.rb:60:in `detect'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/detected.rb:60:in `block in detect'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/detected.rb:59:in `each'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier/detected.rb:59:in `detect'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier.rb:180:in `_detect_or_add_notifiers'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier.rb:198:in `_activate'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier.rb:87:in `initialize'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier.rb:42:in `new'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/notiffany-0.1.1/lib/notiffany/notifier.rb:42:in `connect'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/lib/guard/notifier.rb:11:in `connect'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/lib/guard.rb:61:in `setup'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/lib/guard/commander.rb:32:in `start'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/lib/guard/cli/environments/valid.rb:16:in `start_guard'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/lib/guard/cli.rb:122:in `start'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/lib/guard/aruba_adapter.rb:32:in `execute'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/lib/guard/aruba_adapter.rb:19:in `execute!'
        from /Users/zx1986/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-2.14.1/bin/_guard-core:11:in `<main>'

Test failures with rspec 3

Hi. We are getting some test failures when packaging notiffany for Arch Linux. Some of them look like related to rspec 3, but I am not sure.

Failures:

  1) Notiffany::Notifier::TerminalNotifier#notify should allow the title to be customized
     Failure/Error: ::TerminalNotifier::Guard.execute(false, opts)

       #<Double (anonymous)> received :execute with unexpected arguments
         expected: (false, {:message=>"any message", :title=>"any title", :type=>:error})
              got: (false, {:message=>"any message", :title=>"any title", :type=>:error})
     # ./lib/notiffany/notifier/terminal_notifier.rb:55:in `_perform_notify'
     # ./lib/notiffany/notifier/base.rb:72:in `notify'
     # ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:74:in `block (3 levels) in <module:Notiffany>'

  2) Notiffany::Notifier::TerminalNotifier#notify should call the notifier.
     Failure/Error: ::TerminalNotifier::Guard.execute(false, opts)

       #<Double (anonymous)> received :execute with unexpected arguments
         expected: (false, {:message=>"any message", :title=>"any title", :type=>:success})
              got: (false, {:message=>"any message", :title=>"any title", :type=>:success})
     # ./lib/notiffany/notifier/terminal_notifier.rb:55:in `_perform_notify'
     # ./lib/notiffany/notifier/base.rb:72:in `notify'
     # ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:64:in `block (3 levels) in <module:Notiffany>'

  3) Notiffany::Notifier::TerminalNotifier#notify without a title set should show the app name in the title
     Failure/Error: ::TerminalNotifier::Guard.execute(false, opts)

       #<Double (anonymous)> received :execute with unexpected arguments
         expected: (false, {:message=>"any message", :title=>"FooBar Success", :type=>:success})
              got: (false, {:message=>"any message", :title=>"FooBar Success", :type=>:success})
     # ./lib/notiffany/notifier/terminal_notifier.rb:55:in `_perform_notify'
     # ./lib/notiffany/notifier/base.rb:72:in `notify'
     # ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:87:in `block (4 levels) in <module:Notiffany>'

  4) Notiffany::Notifier::TerminalNotifier#notify with options passed at initialization uses these options by default
     Failure/Error: ::TerminalNotifier::Guard.execute(false, opts)

       #<Double (anonymous)> received :execute with unexpected arguments
         expected: (false, {:message=>"any message", :title=>"Hello", :type=>:success})
              got: (false, {:message=>"any message", :title=>"Hello", :type=>:success})
     # ./lib/notiffany/notifier/terminal_notifier.rb:55:in `_perform_notify'
     # ./lib/notiffany/notifier/base.rb:72:in `notify'
     # ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:42:in `block (4 levels) in <module:Notiffany>'

  5) Notiffany::Notifier::TerminalNotifier#notify with options passed at initialization overwrites object options with passed options
     Failure/Error: ::TerminalNotifier::Guard.execute(false, opts)

       #<Double (anonymous)> received :execute with unexpected arguments
         expected: (false, {:message=>"any message", :title=>"Welcome", :type=>:success})
              got: (false, {:message=>"any message", :title=>"Welcome", :type=>:success})
     # ./lib/notiffany/notifier/terminal_notifier.rb:55:in `_perform_notify'
     # ./lib/notiffany/notifier/base.rb:72:in `notify'
     # ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:53:in `block (4 levels) in <module:Notiffany>'

  6) Notiffany::Notifier::Detected#add with manually configured notifiers when not available does not add the library
     Failure/Error: klass.new(opts) # raises if unavailable

       #<Double "foo_mod"> received :new with unexpected arguments
         expected: ({:foo=>:bar})
              got: ({:foo=>:bar})
        Please stub a default value first if message might be received with other args as well.
     # ./lib/notiffany/notifier/detected.rb:100:in `_add'
     # ./lib/notiffany/notifier/detected.rb:83:in `add'
     # ./spec/lib/notiffany/notifier/detected_spec.rb:105:in `block (5 levels) in <class:Notifier>'

  7) Notiffany::Notifier::Detected#add with manually configured notifiers when not available does not raise an error
     Failure/Error: expect { subject.add(:foo, foo: :bar) }.to_not raise_error

       expected no Exception, got #<RSpec::Mocks::MockExpectationError: #<Double "foo_mod"> received :new with unexpected arguments
         e...=>:bar})
        Please stub a default value first if message might be received with other args as well.
       > with backtrace:
         # ./lib/notiffany/notifier/detected.rb:100:in `_add'
         # ./lib/notiffany/notifier/detected.rb:83:in `add'
         # ./spec/lib/notiffany/notifier/detected_spec.rb:109:in `block (6 levels) in <class:Notifier>'
         # ./spec/lib/notiffany/notifier/detected_spec.rb:109:in `block (5 levels) in <class:Notifier>'
     # ./spec/lib/notiffany/notifier/detected_spec.rb:109:in `block (5 levels) in <class:Notifier>'

  8) Notiffany::Notifier::Detected#add with manually configured notifiers when not available shows a warning
     Failure/Error: klass.new(opts) # raises if unavailable

       #<Double "foo_mod"> received :new with unexpected arguments
         expected: ({:foo=>:bar})
              got: ({:foo=>:bar})
        Please stub a default value first if message might be received with other args as well.
     # ./lib/notiffany/notifier/detected.rb:100:in `_add'
     # ./lib/notiffany/notifier/detected.rb:83:in `add'
     # ./spec/lib/notiffany/notifier/detected_spec.rb:115:in `block (5 levels) in <class:Notifier>'

  9) Notiffany::Notifier::Notifu#notify with additional options can override the default options
     Failure/Error: ::Notifu.show(options) {}

       #<Double (anonymous)> received :show with unexpected arguments
         expected: ({:baloon=>true, :icon=>true, :image=>"/tmp/wait.png", :message=>"Waiting for something", :noquiet=>true, :nosound=>true, :time=>5, :title=>"Waiting", :type=>:warn, :xp=>true})
              got: ({:baloon=>true, :icon=>true, :image=>"/tmp/wait.png", :message=>"Waiting for something", :noquiet=>true, :nosound=>true, :time=>5, :title=>"Waiting", :type=>:warn, :xp=>true})
     # ./lib/notiffany/notifier/rb_notifu.rb:68:in `_perform_notify'
     # ./lib/notiffany/notifier/base.rb:72:in `notify'
     # ./spec/lib/notiffany/notifier/rb_notifu_spec.rb:115:in `block (4 levels) in <class:Notifier>'

  10) Notiffany::Notifier::Notifu#notify without additional options shows the notification with the default options
      Failure/Error: ::Notifu.show(options) {}

        #<Double (anonymous)> received :show with unexpected arguments
          expected: ({:baloon=>false, :icon=>false, :image=>"/tmp/welcome.png", :message=>"Welcome to Guard", :noquiet=>false, :nosound=>false, :time=>3, :title=>"Welcome", :type=>:info, :xp=>false})
               got: ({:baloon=>false, :icon=>false, :image=>"/tmp/welcome.png", :message=>"Welcome to Guard", :noquiet=>false, :nosound=>false, :time=>3, :title=>"Welcome", :type=>:info, :xp=>false})
      # ./lib/notiffany/notifier/rb_notifu.rb:68:in `_perform_notify'
      # ./lib/notiffany/notifier/base.rb:72:in `notify'
      # ./spec/lib/notiffany/notifier/rb_notifu_spec.rb:94:in `block (4 levels) in <class:Notifier>'

  11) Notiffany::Notifier::Notifu#notify with options passed at initialization uses these options by default
      Failure/Error: ::Notifu.show(options) {}

        #<Double (anonymous)> received :show with unexpected arguments
          expected: ({:baloon=>false, :icon=>false, :image=>"/tmp/welcome.png", :message=>"Welcome to Guard", :noquiet=>false, :nosound=>false, :time=>3, :title=>"Hello", :type=>:info, :xp=>false})
               got: ({:baloon=>false, :icon=>false, :image=>"/tmp/welcome.png", :message=>"Welcome to Guard", :noquiet=>false, :nosound=>false, :time=>3, :title=>"Hello", :type=>:info, :xp=>false})
      # ./lib/notiffany/notifier/rb_notifu.rb:68:in `_perform_notify'
      # ./lib/notiffany/notifier/base.rb:72:in `notify'
      # ./spec/lib/notiffany/notifier/rb_notifu_spec.rb:54:in `block (4 levels) in <class:Notifier>'

  12) Notiffany has a version number
      Failure/Error: expect(Notiffany::VERSION).not_to be nil

      NameError:
        uninitialized constant Notiffany::VERSION
      # ./spec/notiffany_spec.rb:3:in `block (2 levels) in <top (required)>'

Finished in 0.12728 seconds (files took 0.09119 seconds to load)
183 examples, 12 failures, 2 pending

Failed examples:

rspec ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:67 # Notiffany::Notifier::TerminalNotifier#notify should allow the title to be customized
rspec ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:57 # Notiffany::Notifier::TerminalNotifier#notify should call the notifier.
rspec ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:78 # Notiffany::Notifier::TerminalNotifier#notify without a title set should show the app name in the title
rspec ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:38 # Notiffany::Notifier::TerminalNotifier#notify with options passed at initialization uses these options by default
rspec ./spec/lib/notiffany/notifier/terminal_notifier_spec.rb:45 # Notiffany::Notifier::TerminalNotifier#notify with options passed at initialization overwrites object options with passed options
rspec ./spec/lib/notiffany/notifier/detected_spec.rb:103 # Notiffany::Notifier::Detected#add with manually configured notifiers when not available does not add the library
rspec ./spec/lib/notiffany/notifier/detected_spec.rb:108 # Notiffany::Notifier::Detected#add with manually configured notifiers when not available does not raise an error
rspec ./spec/lib/notiffany/notifier/detected_spec.rb:112 # Notiffany::Notifier::Detected#add with manually configured notifiers when not available shows a warning
rspec ./spec/lib/notiffany/notifier/rb_notifu_spec.rb:101 # Notiffany::Notifier::Notifu#notify with additional options can override the default options
rspec ./spec/lib/notiffany/notifier/rb_notifu_spec.rb:80 # Notiffany::Notifier::Notifu#notify without additional options shows the notification with the default options
rspec ./spec/lib/notiffany/notifier/rb_notifu_spec.rb:40 # Notiffany::Notifier::Notifu#notify with options passed at initialization uses these options by default
rspec ./spec/notiffany_spec.rb:2 # Notiffany has a version number

Randomized with seed 36787

Reset tmux options after showing notification

Currently in Guard, if I use:

notification(
  :tmux,
  display_message: true,
  timeout: 5, # in seconds
  default_message_format: '%s >> %s',
  # the first %s will show the title, the second the message
  # Alternately you can also configure *success_message_format*,
  # *pending_message_format*, *failed_message_format*
  line_separator: ' > ', # since we are single line we need a separator
  color_location: 'status-left-bg', # to customize which tmux element will change color

  # Colors
  default_message_color: 'colour222',
  default: 'colour27',

  success_message_color: 'colour16',
  success: 'colour82',

  failed_message_color: 'colour16',
  failed: 'colour196',

  pending_message_color: 'colour16',
  pending: 'colour220',

  # Notify on all tmux clients
  display_on_all_clients: false
)

Then when I use the status line for anything else, it isn't my default global color but one of the ones above.

An example is showing the "wrong" colors is:

$ tmux command-prompt -p "ssh: " "new-window -n 'ssh/%1' 'ssh %1'"
$ tmux show-options
message-style fg=colour16,bg=colour82
status-left-style bg=colour82

I would like it after each notification that it restores the colors by doing tmux set-option -u on each of the values it set.

Cannot run both rails server and guard together

Running both guard and rails server together, forces atleast 1 of them to quit because of notiffany

Stack trace for guard

/Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/notiffany-0.1.0/lib/notiffany/notifier.rb:194:in `_activate': Already connected (RuntimeError)
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/notiffany-0.1.0/lib/notiffany/notifier.rb:87:in `initialize'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/notiffany-0.1.0/lib/notiffany/notifier.rb:42:in `new'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/notiffany-0.1.0/lib/notiffany/notifier.rb:42:in `connect'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/guard-2.14.0/lib/guard/notifier.rb:11:in `connect'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/guard-2.14.0/lib/guard.rb:61:in `setup'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/guard-2.14.0/lib/guard/commander.rb:32:in `start'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/guard-2.14.0/lib/guard/cli/environments/valid.rb:16:in `start_guard'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/guard-2.14.0/lib/guard/cli.rb:122:in `start'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/guard-2.14.0/lib/guard/aruba_adapter.rb:32:in `execute'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/guard-2.14.0/lib/guard/aruba_adapter.rb:19:in `execute!'
    from /Users/ronyvarghese/.rvm/gems/ruby-2.3.1@stack_track/gems/guard-2.14.0/bin/_guard-core:11:in `<main>'

Note: Works for webrick rails server. Fails for Puma

tmux change_color doesn't work

I tried to create a workaround for #27 and discovered that change_color: false doesn't work for the tmux plugin.

The colors are still changed.

error from notiffany with ruby 2.2.0 on OSX Yosemite (darwin14.0)

Don't know whether this issue is an notiffany error or Guard error.
However, cause the error is raised by notiffany, I assume that here is the right place to report that issue.

Today I installed the latest version of Guard. When I try to start Guard, I get an error message generated by notiffany:

/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/notiffany-0.0.6/lib/notiffany/notifier/base.rb:117:in '_check_host_supported': Unsupported platform "darwin14.1.0" (Notiffany::Notifier::Base::UnsupportedPlatform)

Here's the referred config line from rbconfig.rb:

CONFIG["host_os"] = "darwin14.1.0"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.