Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 15 commits
  • 9 files changed
  • 3 commit comments
  • 6 contributors
Commits on Mar 20, 2012
@netzpirat netzpirat Fix anchor link to shared configuration. [ci skip] 8611541
Commits on Mar 26, 2012
Thibaud Guillaume-Gentil Add @Maher4Ever to the Core Team! 4f0459f
Commits on Mar 28, 2012
@netzpirat netzpirat Change urgency for notifysend. Closes #268 17dae36
@viking viking Make urgency configurable for libnotify/notifysend
- Change default urgency for libnotify to normal and low to match
  notifysend's defaults.
a2b35eb
@viking viking Add urgency option to libnotify in README a84501e
Rémy Coutable Merge pull request #270 from viking/configure_urgency
Make urgency configurable for libnotify/notifysend
9f589cd
Rémy Coutable Add latest changes e75f802
Commits on Apr 06, 2012
Thibaud Guillaume-Gentil Update README.md 0b43108
Commits on Apr 11, 2012
@mcmire mcmire Make the Bundler warning less scary and more friendly 96fae02
Commits on Apr 12, 2012
Thibaud Guillaume-Gentil Merge pull request #275 from mcmire/better_bundler_message
Make the Bundler warning less scary and more friendly
d60e701
Thibaud Guillaume-Gentil Update CHANGELOG [ci skip] 2dd168d
Thibaud Guillaume-Gentil Fix cli spec cd82b57
Thibaud Guillaume-Gentil EOT -> EOF cbecdae
Commits on Apr 13, 2012
@Maher4Ever Maher4Ever Add @Maher4Ever's email to travis-notifications and enable travis-bui…
…lds for the listen branch
20756e9
@Maher4Ever Maher4Ever Merge branch 'master' into listen 276f006
View
2 .travis.yml
@@ -12,6 +12,7 @@ rvm:
branches:
only:
- master
+ - listen
env:
- GUARD_SLEEP=1
notifications:
@@ -20,4 +21,5 @@ notifications:
- rymai@rymai.me
- michi@netzpiraten.ch
- yann.lugrin@sans-savoir.net
+ - maher@sallam.me
irc: "irc.freenode.org#guard"
View
3 CHANGELOG.md
@@ -2,6 +2,8 @@
### Improvements
+- [#274 & #275](https://github.com/guard/guard/issues/274) Make the Bundler warning less scary and more friendly. ([@mcmire][])
+- [#270](https://github.com/guard/guard/pull/270) Make urgency configurable for libnotify/notifysend. ([@viking][])
- [#254](https://github.com/guard/guard/pull/254) Add the possibility to pause/unpause by sending OS signal. ([@steakknife][])
- [#261](https://github.com/guard/guard/pull/261) Clarify the usage of the term `guard-name` in the README. ([@spadin][])
- Add a `--no-bundler-warning` option to Guard start. ([@netzpirat][])
@@ -475,6 +477,7 @@
[@tpope]: https://github.com/tpope
[@uk-ar]: https://github.com/uk-ar
[@veged]: https://github.com/veged
+[@viking]: https://github.com/viking
[@waldo]: https://github.com/waldo
[@wereHamster]: https://github.com/wereHamster
[@yannlugrin]: https://github.com/yannlugrin
View
9 README.md
@@ -36,7 +36,7 @@ Contents
* [callback](#guardfile-dsl-callback)
* [ignore_paths](#guardfile-dsl-ignore-paths)
* [Example](#guardfile-dsl-example)
-* [Shared configurations](#shared-configuration)
+* [Shared configurations](#shared-configurations)
* [Advanced Linux system configuration](#advanced-linux-system-configuration)
* [Create a Guard](#create-a-guard)
* [Programmatic use of Guard](#programmatic-use-of-guard)
@@ -376,7 +376,7 @@ $ guard start -i
$ guard start --no-interactions
```
-### `-I`/`--no-vendor` option
+#### `-I`/`--no-vendor` option
Ignore the use of vendored gems with:
@@ -385,7 +385,7 @@ $ guard start -I
$ guard start --no-vendor
```
-### `-B`/`--no-bundler-warning` option
+#### `-B`/`--no-bundler-warning` option
Skip Bundler warning when a Gemfile exists in the project directory but Guard is not run with Bundler.
@@ -630,7 +630,7 @@ Each notifier has a slightly different set of supported options:
notification :growl, :sticky => true, :host => '192.168.1.5', :password => 'secret'
notification :gntp, :sticky => true, :host => '192.168.1.5', :password => 'secret'
notification :growl_notify, :sticky => true, :priority => 0
-notification :libnotify, :timeout => 5, :transient => true, :append => false
+notification :libnotify, :timeout => 5, :transient => true, :append => false, :urgency => :critical
notification :notifu, :time => 5, :nosound => true, :xp => true
```
@@ -972,6 +972,7 @@ For questions please join us in our [Google group](http://groups.google.com/grou
### Core Team
+* [Maher Sallam](https://github.com/Maher4Ever) ([@mahersalam](http://twitter.com/mahersalam))
* [Michael Kessler](https://github.com/netzpirat) ([@netzpirat](http://twitter.com/netzpirat), [mksoft.ch](https://mksoft.ch))
* [Rémy Coutable](https://github.com/rymai) ([@rymai](http://twitter.com/rymai), [rymai.me](http://rymai.me/))
* [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](http://twitter.com/thibaudgg), [thibaud.me](http://thibaud.me/))
View
9 lib/guard/cli.rb
@@ -159,7 +159,14 @@ def show
#
def verify_bundler_presence
if File.exists?('Gemfile') && !ENV['BUNDLE_GEMFILE']
- ::Guard::UI.warning 'You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.'
+ ::Guard::UI.info <<EOF
+
+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.)
+EOF
end
end
View
11 lib/guard/notifiers/libnotify.rb
@@ -17,7 +17,7 @@ module Notifier
# notification :libnotify
#
# @example Add the `:libnotify` notifier with configuration options to your `Guardfile`
- # notification :libnotify, :timeout => 5, :transient => true, :append => false
+ # notification :libnotify, :timeout => 5, :transient => true, :append => false, :urgency => :critical
#
module Libnotify
extend self
@@ -64,12 +64,13 @@ def available?(silent = false)
def notify(type, title, message, image, options = { })
require 'libnotify'
- ::Libnotify.show(DEFAULTS.merge(options).merge({
- :urgency => libnotify_urgency(type),
+ options = DEFAULTS.merge(options).merge({
:summary => title,
:body => message,
:icon_path => image
- }))
+ })
+ options[:urgency] ||= libnotify_urgency(type)
+ ::Libnotify.show(options)
end
private
@@ -83,8 +84,6 @@ def notify(type, title, message, image, options = { })
def libnotify_urgency(type)
case type
when 'failed'
- :critical
- when 'pending'
:normal
else
:low
View
11 lib/guard/notifiers/notifysend.rb
@@ -14,7 +14,7 @@ module NotifySend
# Default options for the notify-send program
DEFAULTS = {
- :t => 3000 # Default timeout is 3000ms
+ :t => 3000 # Default timeout is 3000ms
}
# Full list of options supported by notify-send
@@ -46,10 +46,11 @@ def available?(silent = false)
#
def notify(type, title, message, image, options = { })
command = "notify-send '#{title}' '#{message}'"
- system(to_command_string(command, SUPPORTED, DEFAULTS.merge(options).merge({
- :u => notifysend_urgency(type),
+ options = DEFAULTS.merge(options).merge({
:i => image
- })))
+ })
+ options[:u] ||= notifysend_urgency(type)
+ system(to_command_string(command, SUPPORTED, options))
end
private
@@ -61,7 +62,7 @@ def notify(type, title, message, image, options = { })
# @return [String] the notify-send urgency
#
def notifysend_urgency(type)
- {'failed' => 'critical', 'pending' => 'normal'}.fetch(type, 'low')
+ { 'failed' => 'normal', 'pending' => 'low' }.fetch(type, 'low')
end
# Build a shell command out of a command string and option hash.
View
25 spec/guard/cli_spec.rb
@@ -27,7 +27,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_not_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_not_receive(:info).with(/Guard here!/)
subject.start
end
end
@@ -41,12 +41,12 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does show the Bundler warning' do
- ui.should_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_receive(:info).with(/Guard here!/)
subject.start
end
it 'does not show the Bundler warning with the :no_bundler_warning flag' do
- ui.should_not_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_not_receive(:info).with(/Guard here!/)
subject.options = { :no_bundler_warning => true }
subject.start
end
@@ -63,7 +63,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_not_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_not_receive(:info).with(/Guard here!/)
subject.start
end
end
@@ -109,7 +109,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_not_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_not_receive(:info).with(/Guard here!/)
subject.list
end
end
@@ -123,7 +123,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_receive(:info).with(/Guard here!/)
subject.list
end
end
@@ -144,7 +144,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_not_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_not_receive(:info).with(/Guard here!/)
subject.version
end
end
@@ -158,7 +158,8 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_receive(:info).with(/Guard version/)
+ ui.should_receive(:info).with(/Guard here!/)
subject.version
end
end
@@ -211,7 +212,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_not_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_not_receive(:info).with(/Guard here!/)
subject.init
end
end
@@ -225,7 +226,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_receive(:info).with(/Guard here!/)
subject.init
end
end
@@ -248,7 +249,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_not_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_not_receive(:info).with(/Guard here!/)
subject.show
end
end
@@ -262,7 +263,7 @@
after { ENV['BUNDLE_GEMFILE'] = @bundler_env }
it 'does not show the Bundler warning' do
- ui.should_receive(:warning).with("You are using Guard outside of Bundler, this is dangerous and may not work. Using `bundle exec guard` is safer.")
+ ui.should_receive(:info).with(/Guard here!/)
subject.show
end
end
View
10 spec/guard/notifiers/libnotify_spec.rb
@@ -45,7 +45,7 @@ def self.show(options) end
end
end
- describe '.nofify' do
+ describe '.notify' do
it 'requires the library again' do
subject.should_receive(:require).with('libnotify').and_return true
subject.notify('success', 'Welcome', 'Welcome to Guard', '/tmp/welcome.png', { })
@@ -72,15 +72,16 @@ def self.show(options) end
:transient => true,
:append => false,
:timeout => 5,
- :urgency => :normal,
+ :urgency => :critical,
:summary => 'Waiting',
:body => 'Waiting for something',
:icon_path => '/tmp/wait.png'
})
subject.notify('pending', 'Waiting', 'Waiting for something', '/tmp/wait.png', {
:transient => true,
:append => false,
- :timeout => 5
+ :timeout => 5,
+ :urgency => :critical
})
end
@@ -89,13 +90,12 @@ def self.show(options) end
:transient => false,
:append => true,
:timeout => 3,
- :urgency => :critical,
+ :urgency => :normal,
:summary => 'Failed',
:body => 'Something failed',
:icon_path => '/tmp/fail.png'
})
subject.notify('failed', 'Failed', 'Something failed', '/tmp/fail.png', {
- :urgency => :extreme,
:summary => 'Duplicate title',
:body => 'Duplicate body',
:icon_path => 'Duplicate icon'
View
29 spec/guard/notifiers/notifysend_spec.rb
@@ -28,4 +28,33 @@ def self.show(options) end
end
end
end
+
+ describe '.notify' do
+ context 'without additional options' do
+ it 'shows the notification with the default options' do
+ subject.should_receive(:system).with do |command|
+ command.should include("notify-send 'Welcome' 'Welcome to Guard'")
+ command.should include("-i '/tmp/welcome.png'")
+ command.should include("-u 'low'")
+ command.should include("-t '3000'")
+ end
+ subject.notify('success', 'Welcome', 'Welcome to Guard', '/tmp/welcome.png', { })
+ end
+ end
+
+ context 'with additional options' do
+ it 'can override the default options' do
+ subject.should_receive(:system).with do |command|
+ command.should include("notify-send 'Waiting' 'Waiting for something'")
+ command.should include("-i '/tmp/wait.png'")
+ command.should include("-u 'critical'")
+ command.should include("-t '5'")
+ end
+ subject.notify('pending', 'Waiting', 'Waiting for something', '/tmp/wait.png', {
+ :t => 5,
+ :u => :critical
+ })
+ end
+ end
+ end
end

Showing you all comments on commits in this comparison.

@rymai
Guard member
rymai commented on 4f0459f Mar 26, 2012

A-W-E-S-O-M-E! And welcome!! :gift:

@netzpirat

Welkom bij Guard Maher! Goede werk... :clap:

@Maher4Ever
Guard member

Thanks guys :smile:

Something went wrong with that request. Please try again.