From e53036ad0542c2731be850d70454e4b2770e46f6 Mon Sep 17 00:00:00 2001
From: John Bintz
Date: Tue, 28 Jun 2011 16:15:14 -0400
Subject: [PATCH 01/24] add support for growl_notify
---
lib/guard/notifier.rb | 25 ++++++-
spec/guard/notifier_spec.rb | 139 +++++++++++++++++++++++++++---------
2 files changed, 128 insertions(+), 36 deletions(-)
diff --git a/lib/guard/notifier.rb b/lib/guard/notifier.rb
index eb5bd86..36d9bc2 100644
--- a/lib/guard/notifier.rb
+++ b/lib/guard/notifier.rb
@@ -45,8 +45,18 @@ module Guard
def self.notify_mac(title, message, image, options)
require_growl # need for guard-rspec formatter that is called out of guard scope
+
default_options = { :title => title, :icon => image_path(image), :name => "Guard" }
- Growl.notify message, default_options.merge(options) if enabled?
+ default_options.merge!(options)
+
+ if defined?(GrowlNotify)
+ default_options[:description] = message
+ default_options[:application_name] = default_options.delete(:name)
+
+ GrowlNotify.send_notification(default_options) if enabled?
+ else
+ Growl.notify message, default_options.merge(options) if enabled?
+ end
end
def self.notify_linux(title, message, image, options)
@@ -90,10 +100,19 @@ module Guard
end
def self.require_growl
- require 'growl'
+ begin
+ require 'growl_notify'
+
+ GrowlNotify.config do |c|
+ c.notifications = c.default_notifications = [ "Guard" ]
+ c.application_name = c.notifications.first
+ end
+ rescue LoadError
+ require 'growl'
+ end
rescue LoadError
turn_off
- UI.info "Please install growl gem for Mac OS X notification support and add it to your Gemfile"
+ UI.info "Please install growl or growl_notify gem for Mac OS X notification support and add it to your Gemfile"
end
def self.require_libnotify
diff --git a/spec/guard/notifier_spec.rb b/spec/guard/notifier_spec.rb
index c0b164e..2613d9a 100644
--- a/spec/guard/notifier_spec.rb
+++ b/spec/guard/notifier_spec.rb
@@ -20,8 +20,27 @@ describe Guard::Notifier do
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'darwin'
end
+ context "with the GrowlNotify library available" do
+ before do
+ module ::GrowlNotify
+ def self.config ; end
+ end
+ end
+
+ it "loads the library and enables the notifications" do
+ subject.should_receive(:require).with('growl_notify').and_return true
+ subject.turn_on
+ subject.should be_enabled
+ end
+
+ after do
+ Object.send(:remove_const, :GrowlNotify)
+ end
+ end
+
context "with the Growl library available" do
it "loads the library and enables the notifications" do
+ subject.should_receive(:require).with('growl_notify').and_raise LoadError
subject.should_receive(:require).with('growl').and_return true
subject.turn_on
subject.should be_enabled
@@ -30,6 +49,7 @@ describe Guard::Notifier do
context "without the Growl library available" do
it "disables the notifications" do
+ subject.should_receive(:require).with('growl_notify').and_raise LoadError
subject.should_receive(:require).with('growl').and_raise LoadError
subject.turn_on
subject.should_not be_enabled
@@ -89,46 +109,99 @@ describe Guard::Notifier do
before do
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'darwin'
subject.stub(:require_growl)
- Object.send(:remove_const, :Growl) if defined?(Growl)
- Growl = Object.new
end
- after do
- Object.send(:remove_const, :Growl)
+ context 'with growl gem' do
+ before do
+ Object.send(:remove_const, :Growl) if defined?(Growl)
+ Growl = Object.new
+ end
+
+ after do
+ Object.send(:remove_const, :Growl)
+ end
+
+ it "passes the notification to Growl" do
+ Growl.should_receive(:notify).with("great",
+ :title => "Guard",
+ :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
+ :name => "Guard"
+ )
+ subject.notify 'great', :title => 'Guard'
+ end
+
+ it "don't passes the notification to Growl if library is not available" do
+ Growl.should_not_receive(:notify)
+ subject.should_receive(:enabled?).and_return(true, false)
+ subject.notify 'great', :title => 'Guard'
+ end
+
+ it "allows additional notification options" do
+ Growl.should_receive(:notify).with("great",
+ :title => "Guard",
+ :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
+ :name => "Guard",
+ :priority => 1
+ )
+ subject.notify 'great', :title => 'Guard', :priority => 1
+ end
+
+ it "allows to overwrite a default notification option" do
+ Growl.should_receive(:notify).with("great",
+ :title => "Guard",
+ :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
+ :name => "Guard-Cucumber"
+ )
+ subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
+ end
end
- it "passes the notification to Growl" do
- Growl.should_receive(:notify).with("great",
- :title => "Guard",
- :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
- :name => "Guard"
- )
- subject.notify 'great', :title => 'Guard'
- end
+ context 'with growl_notify gem' do
+ before do
+ Object.send(:remove_const, :GrowlNotify) if defined?(GrowlNotify)
+ GrowlNotify = Object.new
+ end
- it "don't passes the notification to Growl if library is not available" do
- Growl.should_not_receive(:notify)
- subject.should_receive(:enabled?).and_return(true, false)
- subject.notify 'great', :title => 'Guard'
- end
+ after do
+ Object.send(:remove_const, :GrowlNotify)
+ end
- it "allows additional notification options" do
- Growl.should_receive(:notify).with("great",
- :title => "Guard",
- :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
- :name => "Guard",
- :priority => 1
- )
- subject.notify 'great', :title => 'Guard', :priority => 1
- end
+ it "passes the notification to Growl" do
+ GrowlNotify.should_receive(:send_notification).with(
+ :title => "Guard",
+ :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
+ :application_name => "Guard",
+ :description => 'great'
+ )
+ subject.notify 'great', :title => 'Guard'
+ end
- it "allows to overwrite a default notification option" do
- Growl.should_receive(:notify).with("great",
- :title => "Guard",
- :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
- :name => "Guard-Cucumber"
- )
- subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
+ it "don't passes the notification to Growl if library is not available" do
+ GrowlNotify.should_not_receive(:send_notification)
+ subject.should_receive(:enabled?).and_return(true, false)
+ subject.notify 'great', :title => 'Guard'
+ end
+
+ it "allows additional notification options" do
+ GrowlNotify.should_receive(:send_notification).with(
+ :title => "Guard",
+ :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
+ :application_name => "Guard",
+ :description => 'great',
+ :priority => 1
+ )
+ subject.notify 'great', :title => 'Guard', :priority => 1
+ end
+
+ it "allows to overwrite a default notification option" do
+ GrowlNotify.should_receive(:send_notification).with(
+ :title => "Guard",
+ :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
+ :application_name => "Guard-Cucumber",
+ :description => 'great'
+ )
+ subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
+ end
end
end
From b13255a9f86cb30f6d87625214b1cd62dd66bb7b Mon Sep 17 00:00:00 2001
From: John Bintz
Date: Tue, 28 Jun 2011 16:53:23 -0400
Subject: [PATCH 02/24] more test and support for growl_notify
---
lib/guard/notifier.rb | 13 +++++++++----
spec/guard/notifier_spec.rb | 12 ++++++++++++
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/lib/guard/notifier.rb b/lib/guard/notifier.rb
index 36d9bc2..695ce7c 100644
--- a/lib/guard/notifier.rb
+++ b/lib/guard/notifier.rb
@@ -52,6 +52,7 @@ module Guard
if defined?(GrowlNotify)
default_options[:description] = message
default_options[:application_name] = default_options.delete(:name)
+ growl_notify_config(default_options[:application_name]) if default_options[:application_name] != 'Guard'
GrowlNotify.send_notification(default_options) if enabled?
else
@@ -103,10 +104,7 @@ module Guard
begin
require 'growl_notify'
- GrowlNotify.config do |c|
- c.notifications = c.default_notifications = [ "Guard" ]
- c.application_name = c.notifications.first
- end
+ growl_notify_config
rescue LoadError
require 'growl'
end
@@ -128,5 +126,12 @@ module Guard
turn_off
UI.info "Please install rb-notifu gem for Windows notification support and add it to your Gemfile"
end
+
+ def self.growl_notify_config(additional_applications = [])
+ GrowlNotify.config do |c|
+ c.notifications = c.default_notifications = [ "Guard", additional_applications ].flatten
+ c.application_name = c.notifications.first
+ end
+ end
end
end
diff --git a/spec/guard/notifier_spec.rb b/spec/guard/notifier_spec.rb
index 2613d9a..0d3b90b 100644
--- a/spec/guard/notifier_spec.rb
+++ b/spec/guard/notifier_spec.rb
@@ -194,6 +194,14 @@ describe Guard::Notifier do
end
it "allows to overwrite a default notification option" do
+ config = Class.new do
+ attr_accessor :notifications, :default_notifications, :application_name
+ end.new
+
+ apps = ["Guard", "Guard-Cucumber"]
+
+ GrowlNotify.should_receive(:config).and_yield(config)
+
GrowlNotify.should_receive(:send_notification).with(
:title => "Guard",
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
@@ -201,6 +209,10 @@ describe Guard::Notifier do
:description => 'great'
)
subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
+
+ config.notifications.should == apps
+ config.default_notifications.should == apps
+ config.application_name.should == apps.first
end
end
end
From 8917682cdfd3d38f1daab59630ceb76c3ec55296 Mon Sep 17 00:00:00 2001
From: John Bintz
Date: Tue, 28 Jun 2011 16:58:23 -0400
Subject: [PATCH 03/24] update README
---
README.md | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 057370d..3078af6 100644
--- a/README.md
+++ b/README.md
@@ -50,9 +50,11 @@ Install the rb-fsevent gem for [FSEvent](http://en.wikipedia.org/wiki/FSEvents)
$ gem install rb-fsevent
```
-Install the Growl gem if you want notification support:
+Install either the growl_notify or the Growl gem if you want notification support:
``` bash
+$ gem install growl_notify
+$ # or
$ gem install growl
```
@@ -63,6 +65,9 @@ gem 'rb-fsevent'
gem 'growl'
```
+growl_notify uses AppleScript, the suggested method for interfacing with Growl,
+rather than the `growlnotify` command to display messages.
+
### On Linux
Install the rb-inotify gem for [inotify](http://en.wikipedia.org/wiki/Inotify) support:
From facd4f2a0b1e1a2b99fc8569f190903f690e24b3 Mon Sep 17 00:00:00 2001
From: John Bintz
Date: Fri, 1 Jul 2011 11:52:24 -0400
Subject: [PATCH 04/24] force use of Guard application name when using
growl_notify
---
lib/guard/notifier.rb | 21 ++++++++++-----------
spec/guard/notifier_spec.rb | 17 +++--------------
2 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/lib/guard/notifier.rb b/lib/guard/notifier.rb
index 695ce7c..19820fc 100644
--- a/lib/guard/notifier.rb
+++ b/lib/guard/notifier.rb
@@ -4,6 +4,7 @@ require 'guard/ui'
module Guard
module Notifier
+ APPLICATION_NAME = "Guard"
def self.turn_off
ENV["GUARD_NOTIFY"] = 'false'
@@ -46,13 +47,13 @@ module Guard
def self.notify_mac(title, message, image, options)
require_growl # need for guard-rspec formatter that is called out of guard scope
- default_options = { :title => title, :icon => image_path(image), :name => "Guard" }
+ default_options = { :title => title, :icon => image_path(image), :name => APPLICATION_NAME }
default_options.merge!(options)
if defined?(GrowlNotify)
default_options[:description] = message
- default_options[:application_name] = default_options.delete(:name)
- growl_notify_config(default_options[:application_name]) if default_options[:application_name] != 'Guard'
+ default_options[:application_name] = APPLICATION_NAME
+ default_options.delete(:name)
GrowlNotify.send_notification(default_options) if enabled?
else
@@ -104,7 +105,12 @@ module Guard
begin
require 'growl_notify'
- growl_notify_config
+ if GrowlNotify.application_name != APPLICATION_NAME
+ GrowlNotify.config do |c|
+ c.notifications = c.default_notifications = [ APPLICATION_NAME ]
+ c.application_name = c.notifications.first
+ end
+ end
rescue LoadError
require 'growl'
end
@@ -126,12 +132,5 @@ module Guard
turn_off
UI.info "Please install rb-notifu gem for Windows notification support and add it to your Gemfile"
end
-
- def self.growl_notify_config(additional_applications = [])
- GrowlNotify.config do |c|
- c.notifications = c.default_notifications = [ "Guard", additional_applications ].flatten
- c.application_name = c.notifications.first
- end
- end
end
end
diff --git a/spec/guard/notifier_spec.rb b/spec/guard/notifier_spec.rb
index 0d3b90b..5b376b5 100644
--- a/spec/guard/notifier_spec.rb
+++ b/spec/guard/notifier_spec.rb
@@ -29,6 +29,7 @@ describe Guard::Notifier do
it "loads the library and enables the notifications" do
subject.should_receive(:require).with('growl_notify').and_return true
+ GrowlNotify.should_receive(:application_name).and_return ''
subject.turn_on
subject.should be_enabled
end
@@ -193,26 +194,14 @@ describe Guard::Notifier do
subject.notify 'great', :title => 'Guard', :priority => 1
end
- it "allows to overwrite a default notification option" do
- config = Class.new do
- attr_accessor :notifications, :default_notifications, :application_name
- end.new
-
- apps = ["Guard", "Guard-Cucumber"]
-
- GrowlNotify.should_receive(:config).and_yield(config)
-
+ it "throws out the application name since Guard should only use one Growl App Name while running" do
GrowlNotify.should_receive(:send_notification).with(
:title => "Guard",
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
- :application_name => "Guard-Cucumber",
+ :application_name => "Guard",
:description => 'great'
)
subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
-
- config.notifications.should == apps
- config.default_notifications.should == apps
- config.application_name.should == apps.first
end
end
end
From 7f87411189ff2c3fac869a4d3ff1987e6e4e8b26 Mon Sep 17 00:00:00 2001
From: John Bintz
Date: Wed, 6 Jul 2011 15:45:20 -0400
Subject: [PATCH 05/24] remove growl support completely
---
Gemfile | 2 +-
README.md | 11 ++-----
lib/guard/notifier.rb | 30 ++++++-------------
spec/guard/notifier_spec.rb | 57 +------------------------------------
4 files changed, 14 insertions(+), 86 deletions(-)
diff --git a/Gemfile b/Gemfile
index 269c5e6..40c14e4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,7 +8,7 @@ require 'rbconfig'
if RbConfig::CONFIG['target_os'] =~ /darwin/i
gem 'rb-fsevent', '>= 0.4.0', :require => false
- gem 'growl', '~> 1.0.3', :require => false
+ gem 'growl_notify', :require => false
end
if RbConfig::CONFIG['target_os'] =~ /linux/i
gem 'rb-inotify', '>= 0.8.5', :require => false
diff --git a/README.md b/README.md
index 3078af6..5a3f69a 100644
--- a/README.md
+++ b/README.md
@@ -50,24 +50,19 @@ Install the rb-fsevent gem for [FSEvent](http://en.wikipedia.org/wiki/FSEvents)
$ gem install rb-fsevent
```
-Install either the growl_notify or the Growl gem if you want notification support:
+Install the growl_notify gem if you want notification support:
``` bash
$ gem install growl_notify
-$ # or
-$ gem install growl
```
-And add them to your Gemfile:
+And add it to your Gemfile:
``` ruby
gem 'rb-fsevent'
-gem 'growl'
+gem 'growl_notify'
```
-growl_notify uses AppleScript, the suggested method for interfacing with Growl,
-rather than the `growlnotify` command to display messages.
-
### On Linux
Install the rb-inotify gem for [inotify](http://en.wikipedia.org/wiki/Inotify) support:
diff --git a/lib/guard/notifier.rb b/lib/guard/notifier.rb
index 19820fc..9035aef 100644
--- a/lib/guard/notifier.rb
+++ b/lib/guard/notifier.rb
@@ -47,18 +47,10 @@ module Guard
def self.notify_mac(title, message, image, options)
require_growl # need for guard-rspec formatter that is called out of guard scope
- default_options = { :title => title, :icon => image_path(image), :name => APPLICATION_NAME }
- default_options.merge!(options)
+ options = { :description => message, :title => title, :icon => image_path(image), :application_name => APPLICATION_NAME }.merge(options)
+ options.delete(:name)
- if defined?(GrowlNotify)
- default_options[:description] = message
- default_options[:application_name] = APPLICATION_NAME
- default_options.delete(:name)
-
- GrowlNotify.send_notification(default_options) if enabled?
- else
- Growl.notify message, default_options.merge(options) if enabled?
- end
+ GrowlNotify.send_notification(options) if enabled?
end
def self.notify_linux(title, message, image, options)
@@ -102,21 +94,17 @@ module Guard
end
def self.require_growl
- begin
- require 'growl_notify'
+ require 'growl_notify'
- if GrowlNotify.application_name != APPLICATION_NAME
- GrowlNotify.config do |c|
- c.notifications = c.default_notifications = [ APPLICATION_NAME ]
- c.application_name = c.notifications.first
- end
+ if GrowlNotify.application_name != APPLICATION_NAME
+ GrowlNotify.config do |c|
+ c.notifications = c.default_notifications = [ APPLICATION_NAME ]
+ c.application_name = c.notifications.first
end
- rescue LoadError
- require 'growl'
end
rescue LoadError
turn_off
- UI.info "Please install growl or growl_notify gem for Mac OS X notification support and add it to your Gemfile"
+ UI.info "Please install growl_notify gem for Mac OS X notification support and add it to your Gemfile"
end
def self.require_libnotify
diff --git a/spec/guard/notifier_spec.rb b/spec/guard/notifier_spec.rb
index 5b376b5..e1005bb 100644
--- a/spec/guard/notifier_spec.rb
+++ b/spec/guard/notifier_spec.rb
@@ -39,19 +39,9 @@ describe Guard::Notifier do
end
end
- context "with the Growl library available" do
- it "loads the library and enables the notifications" do
- subject.should_receive(:require).with('growl_notify').and_raise LoadError
- subject.should_receive(:require).with('growl').and_return true
- subject.turn_on
- subject.should be_enabled
- end
- end
-
- context "without the Growl library available" do
+ context "without the GrowlNofity library available" do
it "disables the notifications" do
subject.should_receive(:require).with('growl_notify').and_raise LoadError
- subject.should_receive(:require).with('growl').and_raise LoadError
subject.turn_on
subject.should_not be_enabled
end
@@ -112,51 +102,6 @@ describe Guard::Notifier do
subject.stub(:require_growl)
end
- context 'with growl gem' do
- before do
- Object.send(:remove_const, :Growl) if defined?(Growl)
- Growl = Object.new
- end
-
- after do
- Object.send(:remove_const, :Growl)
- end
-
- it "passes the notification to Growl" do
- Growl.should_receive(:notify).with("great",
- :title => "Guard",
- :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
- :name => "Guard"
- )
- subject.notify 'great', :title => 'Guard'
- end
-
- it "don't passes the notification to Growl if library is not available" do
- Growl.should_not_receive(:notify)
- subject.should_receive(:enabled?).and_return(true, false)
- subject.notify 'great', :title => 'Guard'
- end
-
- it "allows additional notification options" do
- Growl.should_receive(:notify).with("great",
- :title => "Guard",
- :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
- :name => "Guard",
- :priority => 1
- )
- subject.notify 'great', :title => 'Guard', :priority => 1
- end
-
- it "allows to overwrite a default notification option" do
- Growl.should_receive(:notify).with("great",
- :title => "Guard",
- :icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
- :name => "Guard-Cucumber"
- )
- subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
- end
- end
-
context 'with growl_notify gem' do
before do
Object.send(:remove_const, :GrowlNotify) if defined?(GrowlNotify)
From 7da0cd2b0d1a73a0392ace2d51051dbded025309 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Wed, 10 Aug 2011 01:16:31 +0200
Subject: [PATCH 06/24] Update manual with latest changes. [ci skip]
---
man/guard.1 | 146 +++++++++++++++++++++++++++++++++++------------
man/guard.1.html | 95 +++++++++++++++++++++---------
man/guard.md | 79 ++++++++++++++-----------
3 files changed, 224 insertions(+), 96 deletions(-)
diff --git a/man/guard.1 b/man/guard.1
index 5e5f92e..a6d51fa 100644
--- a/man/guard.1
+++ b/man/guard.1
@@ -1,64 +1,130 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "GUARD" "1" "June 2011" "" ""
+.TH "GUARD" "1" "August 2011" "" ""
.
.SH "NAME"
\fBguard\fR \- Guard keeps an eye on your file modifications\.
.
-.SH "SYNOPSIS"
-guard \fIcommand\fR \fIoptions\fR
-.
.SH "DESCRIPTION"
Guard is a command line tool that easily handle events on files modifications\.
.
-.SH "HOMEPAGE"
-https://github\.com/guard/guard
+.SH "SYNOPSIS"
+guard \fIcommand\fR \fIoptions\fR
+.
+.SH "COMMANDS"
+.
+.SS "start"
+Starts Guard\. This is the default command if none is provided\.
+.
+.P
+The following options are available:
+.
+.P
+\fB\-c\fR/\fB\-\-clear\fR
+.
+.IP "" 4
+.
+.nf
+
+ Clears the Shell after each change\.
+.
+.fi
+.
+.IP "" 0
+.
+.P
+\fB\-n\fR/\fB\-\-notify\fR \fIflag\fR
+.
+.IP "" 4
+.
+.nf
+
+ Disable notifications (Growl or Libnotify depending on your system)\.
+ Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false\.
+ The part can be passed to guard using true/false or t/f\.
+.
+.fi
+.
+.IP "" 0
+.
+.P
+\fB\-d\fR/\fB\-\-debug\fR
+.
+.IP "" 4
+.
+.nf
+
+ Runs Guard in debug mode\.
+.
+.fi
+.
+.IP "" 0
+.
+.P
+\fB\-g\fR/\fB\-\-group\fR \fIgroup\fR \.\.\.
+.
+.IP "" 4
+.
+.nf
+
+ Runs only the groups specified\.
+.
+.fi
+.
+.IP "" 0
+.
+.P
+\fB\-w\fR/\fB\-\-watchdir\fR \fIfolder\fR
+.
+.IP "" 4
+.
+.nf
+
+ Specify the directory to watch\.
+.
+.fi
+.
+.IP "" 0
+.
+.P
+\fB\-G\fR/\fB\-\-guardfile\fR \fIfile\fR
+.
+.IP "" 4
+.
+.nf
+
+ Specify a Guardfile by giving its path\.
+.
+.fi
+.
+.IP "" 0
+.
+.SS "init [guard]"
+Add the requested guard\'s default Guardfile configuration to the current Guardfile\.
+.
+.SS "list"
+Lists guards that can be used with the \fBinit\fR command\.
+.
+.SS "\-T/show"
+List defined groups and guards for the current Guardfile\.
.
.SH "OPTIONS"
.
.TP
-\fB\-c\fR, \fB\-\-clear\fR
-Clears the Shell after each change\.
-.
-.TP
-\fB\-n\fR \fIflag\fR, \fB\-\-notify\fR \fIflag\fR
-Disable notifications (Growl or Libnotify depending on your system)\. Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false\. The \fIflag\fR part can be passed to guard using true/false or t/f\.
-.
-.TP
-\fB\-g\fR \fIgroup\fR \.\.\., \fB\-\-group\fR \fIgroup\fR \.\.\.
-Runs only the groups specified\.
-.
-.TP
-\fB\-d\fR, \fB\-\-debug\fR
-Runs Guard in debug mode\.
-.
-.TP
\fB\-h\fR
List all of Guard\'s available commands\.
.
-.SH "COMMANDS"
-.
-.TP
-\fBstart\fR
-Starts Guard\. This is the default command if none is provided\.
-.
-.TP
-\fBinit\fR [guard]
-Add the requested guard\'s default Guardfile configuration to the current Guardfile\.
-.
-.TP
-\fBshow\fR, \fB\-T\fR
-List defined groups and guards for the current Guardfile\.
+.SS "start"
.
.SH "EXAMPLES"
-\fB[bundle exec] guard \-\-clear \-\-group backend frontend \-\-notify false \-\-debug\fR
+\fB[bundle exec] guard [start] \-\-watchdir ~/dev \-\-guardfile ~/env/Guardfile \-\-clear \-\-group backend frontend \-\-notify false \-\-debug\fR
.
.P
or in a more concise way:
.
.P
-\fB[bundle exec] guard \-c \-g backend frontend \-n f \-d\fR
+\fB[bundle exec] guard [start] \-w ~/dev \-G ~/env/Guardfile \-c \-g backend frontend \-n f \-d\fR
.
.SH "AUTHORS / CONTRIBUTORS"
Thibaud Guillaume\-Gentil is the main author\.
@@ -68,3 +134,9 @@ A list of contributors based on all commits can be found here: https://github\.c
.
.P
For an exhaustive list of all the contributors, please see the CHANGELOG: https://github\.com/guard/guard/blob/master/CHANGELOG\.md
+.
+.P
+This manual has been written by Remy Coutable\.
+.
+.SH "WWW"
+https://github\.com/guard/guard
diff --git a/man/guard.1.html b/man/guard.1.html
index 538feea..81d3956 100644
--- a/man/guard.1.html
+++ b/man/guard.1.html
@@ -54,13 +54,13 @@
@@ -74,47 +74,82 @@
guard
- Guard keeps an eye on your file modifications.
-SYNOPSIS
-
-guard command options
-
DESCRIPTION
Guard is a command line tool that easily handle events on files modifications.
-HOMEPAGE
+SYNOPSIS
-https://github.com/guard/guard
+guard command options
+
+COMMANDS
+
+start
+
+ Starts Guard. This is the default command if none is provided.
+
+The following options are available:
+
+ -c
/--clear
+
+ Clears the Shell after each change.
+
+
+ -n
/--notify
flag
+
+ Disable notifications (Growl or Libnotify depending on your system).
+ Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
+ The <flag> part can be passed to guard using true/false or t/f.
+
+
+ -d
/--debug
+
+ Runs Guard in debug mode.
+
+
+ -g
/--group
group ...
+
+ Runs only the groups specified.
+
+
+ -w
/--watchdir
folder
+
+ Specify the directory to watch.
+
+
+ -G
/--guardfile
file
+
+ Specify a Guardfile by giving its path.
+
+
+init [guard]
+
+ Add the requested guard's default Guardfile configuration to the current Guardfile.
+
+list
+
+ Lists guards that can be used with the init
command.
+
+-T/show
+
+ List defined groups and guards for the current Guardfile.
OPTIONS
--c
, --clear
Clears the Shell after each change.
--n
flag, --notify
flagDisable notifications (Growl or Libnotify depending on your system).
-Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
-The flag part can be passed to guard using true/false or t/f.
--g
group ..., --group
group ...Runs only the groups specified.
--d
, --debug
Runs Guard in debug mode.
--h
List all of Guard's available commands.
+-h
- List all of Guard's available commands.
-COMMANDS
-
-
-start
Starts Guard. This is the default command if none is provided.
-init
[guard]Add the requested guard's default Guardfile configuration to the current Guardfile.
-show
, -T
List defined groups and guards for the current Guardfile.
-
-
+start
EXAMPLES
-[bundle exec] guard --clear --group backend frontend --notify false --debug
+[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug
or in a more concise way:
-[bundle exec] guard -c -g backend frontend -n f -d
+[bundle exec] guard [start] -w ~/dev -G ~/env/Guardfile -c -g backend frontend -n f -d
AUTHORS / CONTRIBUTORS
@@ -126,10 +161,16 @@ https://github.com/guard/guard/contributors
For an exhaustive list of all the contributors, please see the CHANGELOG:
https://github.com/guard/guard/blob/master/CHANGELOG.md
+This manual has been written by Remy Coutable.
+
+WWW
+
+https://github.com/guard/guard
+
diff --git a/man/guard.md b/man/guard.md
index 43c6780..f61dd1d 100644
--- a/man/guard.md
+++ b/man/guard.md
@@ -1,55 +1,64 @@
guard(1) -- Guard keeps an eye on your file modifications.
========================================================
-## SYNOPSIS
-
-guard
-
## DESCRIPTION
Guard is a command line tool that easily handle events on files modifications.
-## HOMEPAGE
+## SYNOPSIS
-https://github.com/guard/guard
+guard
+
+## COMMANDS
+
+### start
+ Starts Guard. This is the default command if none is provided.
+
+The following options are available:
+
+ `-c`/`--clear`
+ Clears the Shell after each change.
+
+ `-n`/`--notify`
+ Disable notifications (Growl or Libnotify depending on your system).
+ Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
+ The part can be passed to guard using true/false or t/f.
+
+ `-d`/`--debug`
+ Runs Guard in debug mode.
+
+ `-g`/`--group` ...
+ Runs only the groups specified.
+
+ `-w`/`--watchdir`
+ Specify the directory to watch.
+
+ `-G`/`--guardfile`
+ Specify a Guardfile by giving its path.
+
+### init [guard]
+ Add the requested guard's default Guardfile configuration to the current Guardfile.
+
+### list
+ Lists guards that can be used with the `init` command.
+
+### -T/show
+ List defined groups and guards for the current Guardfile.
## OPTIONS
-* `-c`, `--clear`:
- Clears the Shell after each change.
-
-* `-n` , `--notify` :
- Disable notifications (Growl or Libnotify depending on your system).
- Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
- The part can be passed to guard using true/false or t/f.
-
-* `-g` ..., `--group` ...:
- Runs only the groups specified.
-
-* `-d`, `--debug`:
- Runs Guard in debug mode.
-
* `-h`:
List all of Guard's available commands.
-## COMMANDS
-
-* `start`:
- Starts Guard. This is the default command if none is provided.
-
-* `init` [guard]:
- Add the requested guard's default Guardfile configuration to the current Guardfile.
-
-* `show`, `-T`:
- List defined groups and guards for the current Guardfile.
+### start
## EXAMPLES
-`[bundle exec] guard --clear --group backend frontend --notify false --debug`
+`[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug`
or in a more concise way:
-`[bundle exec] guard -c -g backend frontend -n f -d`
+`[bundle exec] guard [start] -w ~/dev -G ~/env/Guardfile -c -g backend frontend -n f -d`
## AUTHORS / CONTRIBUTORS
@@ -60,3 +69,9 @@ https://github.com/guard/guard/contributors
For an exhaustive list of all the contributors, please see the CHANGELOG:
https://github.com/guard/guard/blob/master/CHANGELOG.md
+
+This manual has been written by Remy Coutable.
+
+## WWW
+
+https://github.com/guard/guard
\ No newline at end of file
From 134a476f037e20428922cf076f84c27b77b2f410 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Wed, 10 Aug 2011 01:17:11 +0200
Subject: [PATCH 07/24] Build against master and hook branch, and ping IRC room
when build finishes.
---
.travis.yml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 36b2ab4..2642570 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,3 +2,9 @@ rvm:
- 1.8.7
- 1.9.2
- ree
+branches:
+ only:
+ - master
+ - hook
+notifications:
+ irc: "irc.freenode.org#guard"
\ No newline at end of file
From 3663687ad63c42dd35942b1267f0a16f904ebb67 Mon Sep 17 00:00:00 2001
From: Daniel Mack
Date: Thu, 11 Aug 2011 11:24:14 +0200
Subject: [PATCH 08/24] Add ':transient => true' to default libnotify options
This is a new feature in libnotify causing transitions to vanish after
they've been displayed.
---
lib/guard/notifier.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/guard/notifier.rb b/lib/guard/notifier.rb
index eb5bd86..d45950c 100644
--- a/lib/guard/notifier.rb
+++ b/lib/guard/notifier.rb
@@ -51,7 +51,7 @@ module Guard
def self.notify_linux(title, message, image, options)
require_libnotify # need for guard-rspec formatter that is called out of guard scope
- default_options = { :body => message, :summary => title, :icon_path => image_path(image) }
+ default_options = { :body => message, :summary => title, :icon_path => image_path(image), :transient => true }
Libnotify.show default_options.merge(options) if enabled?
end
From 95b86a38c77e2a37a67e174ceae015f69a7d36b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Thu, 11 Aug 2011 12:09:24 +0200
Subject: [PATCH 09/24] Fix specs (hopefully)
---
spec/guard/notifier_spec.rb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/spec/guard/notifier_spec.rb b/spec/guard/notifier_spec.rb
index c0b164e..3aefdd6 100644
--- a/spec/guard/notifier_spec.rb
+++ b/spec/guard/notifier_spec.rb
@@ -148,7 +148,8 @@ describe Guard::Notifier do
Libnotify.should_receive(:show).with(
:body => "great",
:summary => 'Guard',
- :icon_path => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s
+ :icon_path => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
+ :transient => true
)
subject.notify 'great', :title => 'Guard'
end
@@ -164,6 +165,7 @@ describe Guard::Notifier do
:body => "great",
:summary => 'Guard',
:icon_path => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
+ :transient => true,
:urgency => :critical
)
subject.notify 'great', :title => 'Guard', :urgency => :critical
@@ -173,7 +175,8 @@ describe Guard::Notifier do
Libnotify.should_receive(:show).with(
:body => "great",
:summary => 'Guard',
- :icon_path => '~/.guard/success.png'
+ :icon_path => '~/.guard/success.png',
+ :transient => true
)
subject.notify 'great', :title => 'Guard', :icon_path => '~/.guard/success.png'
end
From bcbcf6139009332afcdd60b67c4a2a718d3c2623 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Thu, 11 Aug 2011 12:09:30 +0200
Subject: [PATCH 10/24] Update CHANGELOG
---
CHANGELOG.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7850da..4444c82 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,10 +7,11 @@
### New features
-- Pull request [#112](https://github.com/guard/guard/pull/112): Add list command to CLI. ([@docwhat][])
+- Pull request [#112](https://github.com/guard/guard/pull/112): Add `list` command to CLI. ([@docwhat][])
### Improvements
+- Pull request [#115](https://github.com/guard/guard/pull/115): [Linux] Add ':transient => true' to default libnotify options. ([@zonque][])
- Pull request [#95](https://github.com/guard/guard/pull/95): Output system commands and options to be executed when in debug mode. ([@uk-ar][] and [@netzpirat][])
- `Guard::Dsl.revaluate_guardfile` has been renamed to `Guard::Dsl.reevaluate_guardfile`. ([@rymai][])
- New CLI options: ([@nestegg][])
@@ -223,3 +224,4 @@
[@veged]: https://github.com/veged
[@wereHamster]: https://github.com/wereHamster
[@yannlugrin]: https://github.com/yannlugrin
+[@zonque]: https://github.com/zonque
From 118e8ff167d8e2b6a307d335da95f46ca45a16bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Thu, 11 Aug 2011 12:10:08 +0200
Subject: [PATCH 11/24] Added guard-ronn (to build manual automatically).
---
Gemfile | 4 ++++
Guardfile | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/Gemfile b/Gemfile
index 269c5e6..3a8f317 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,6 +4,10 @@ gemspec
gem 'rake'
+group :guard do
+ gem 'guard-ronn'
+end
+
require 'rbconfig'
if RbConfig::CONFIG['target_os'] =~ /darwin/i
diff --git a/Guardfile b/Guardfile
index 826ffb6..f32757d 100644
--- a/Guardfile
+++ b/Guardfile
@@ -16,4 +16,8 @@ end
#
# group "exceptional" do
# guard :breaking
-# end
\ No newline at end of file
+# end
+
+guard 'ronn' do
+ watch(%r{^man/.+\.m(ark)?d(own)?$})
+end
From 63ca5f0b70be5b56079697be299e7077df2be415 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?=
Date: Thu, 11 Aug 2011 13:27:41 +0300
Subject: [PATCH 12/24] [ci skip] Added missing documentation for options and
for win32console!
---
README.md | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 7aa00dd..10c8681 100644
--- a/README.md
+++ b/README.md
@@ -92,6 +92,12 @@ Install the rb-fchange gem for [Directory Change Notification](http://msdn.micro
$ gem install rb-fchange
```
+Install the win32console gem if you want colors in your terminal:
+
+``` bash
+$ gem install win32console
+```
+
Install the Notifu gem if you want notification support:
``` bash
@@ -125,7 +131,7 @@ Guard will look for a Guardfile in your current directory. If it does not find o
Command line options
--------------------
-### `--clear` option
+### `-c`/`--clear` option
Shell can be cleared after each change:
@@ -134,7 +140,7 @@ $ guard --clear
$ guard -c # shortcut
```
-### `--notify` option
+### `-n`/`--notify` option
Notifications (growl/libnotify) can be disabled:
@@ -145,7 +151,7 @@ $ guard -n f # shortcut
Notifications can also be disabled globally by setting a `GUARD_NOTIFY` environment variable to `false`
-### `--group` option
+### `-g`/`--group` option
Only certain guards groups can be run (see the Guardfile DSL below for creating groups):
@@ -154,7 +160,7 @@ $ guard --group group_name another_group_name
$ guard -g group_name another_group_name # shortcut
```
-### `--debug` option
+### `-d`/`--debug` option
Guard can be run in debug mode:
@@ -163,6 +169,24 @@ $ guard --debug
$ guard -d # shortcut
```
+### `-w`/`--watchdir` option
+
+Guard can watch in any directory (instead of the current directory):
+
+``` bash
+$ guard --watchdir ~/your/fancy/project
+$ guard -w ~/your/fancy/project # shortcut
+```
+
+### `-G`/`--guardfile` option
+
+Guard can use a Guardfile not located in the current directory:
+
+``` bash
+$ guard --guardfile ~/.your_global_guardfile
+$ guard -G ~/.your_global_guardfile # shortcut
+```
+
An exhaustive list of options is available with:
``` bash
From e846068e89362f47a1937ded6af3f32cddbd0179 Mon Sep 17 00:00:00 2001
From: Rob Eanes
Date: Fri, 12 Aug 2011 10:03:06 -0500
Subject: [PATCH 13/24] Polling#watch_change should use listener directory, not
Dir.pwd
---
lib/guard/listeners/polling.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/guard/listeners/polling.rb b/lib/guard/listeners/polling.rb
index fad687c..894bff9 100644
--- a/lib/guard/listeners/polling.rb
+++ b/lib/guard/listeners/polling.rb
@@ -22,7 +22,7 @@ module Guard
def watch_change
until @stop
start = Time.now.to_f
- files = modified_files([Dir.pwd], :all => true)
+ files = modified_files([@directory], :all => true)
@callback.call(files) unless files.empty?
nap_time = @latency - (Time.now.to_f - start)
sleep(nap_time) if nap_time > 0
From 2c81e5b9bd27b204897b0d35860d008117b0ae1d Mon Sep 17 00:00:00 2001
From: Thibaud Guillaume-Gentil
Date: Sat, 13 Aug 2011 16:47:23 +0200
Subject: [PATCH 14/24] Version 0.6.0
---
CHANGELOG.md | 3 ++-
lib/guard/version.rb | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4444c82..1e57b83 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## Master
+## 0.6.0 - August 13, 2011
### Bugs fixes:
@@ -11,6 +11,7 @@
### Improvements
+- Pull request [#99](https://github.com/guard/guard/pull/99): [OS X] Switch from growl gem to growl_notify gem. ([@johnbintz][])
- Pull request [#115](https://github.com/guard/guard/pull/115): [Linux] Add ':transient => true' to default libnotify options. ([@zonque][])
- Pull request [#95](https://github.com/guard/guard/pull/95): Output system commands and options to be executed when in debug mode. ([@uk-ar][] and [@netzpirat][])
- `Guard::Dsl.revaluate_guardfile` has been renamed to `Guard::Dsl.reevaluate_guardfile`. ([@rymai][])
diff --git a/lib/guard/version.rb b/lib/guard/version.rb
index 78f2314..b1df99c 100644
--- a/lib/guard/version.rb
+++ b/lib/guard/version.rb
@@ -1,3 +1,3 @@
module Guard
- VERSION = "0.5.1" unless defined? Guard::VERSION
+ VERSION = "0.6.0" unless defined? Guard::VERSION
end
From e7c23ff78d45fee73a2d80578dd36b77b004729c Mon Sep 17 00:00:00 2001
From: Thibaud Guillaume-Gentil
Date: Sat, 13 Aug 2011 16:50:27 +0200
Subject: [PATCH 15/24] Add gem 'win32console' note in the README
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index f749661..2c6f21f 100644
--- a/README.md
+++ b/README.md
@@ -109,6 +109,7 @@ And add them to your Gemfile:
``` ruby
gem 'rb-fchange'
gem 'rb-notifu'
+gem 'win32console'
```
Usage
From 87375c7a1ffdfcab1b10015ca6bb7706c41368ae Mon Sep 17 00:00:00 2001
From: Ches Martin
Date: Sun, 14 Aug 2011 15:16:16 +0700
Subject: [PATCH 16/24] evaluate_guardfile uses all groups if none specified.
Fixes #118
---
lib/guard/dsl.rb | 3 ++-
spec/guard/dsl_spec.rb | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/guard/dsl.rb b/lib/guard/dsl.rb
index aa78735..12ca379 100644
--- a/lib/guard/dsl.rb
+++ b/lib/guard/dsl.rb
@@ -104,7 +104,8 @@ module Guard
end
def group(name, &guard_definition)
- guard_definition.call if guard_definition && (@@options[:group].empty? || @@options[:group].include?(name.to_s))
+ @groups = @@options[:group] || []
+ guard_definition.call if guard_definition && (@groups.empty? || @groups.include?(name.to_s))
end
def guard(name, options = {}, &watch_definition)
diff --git a/spec/guard/dsl_spec.rb b/spec/guard/dsl_spec.rb
index f50c707..740d8ed 100644
--- a/spec/guard/dsl_spec.rb
+++ b/spec/guard/dsl_spec.rb
@@ -213,6 +213,11 @@ describe Guard::Dsl do
::Guard.should_receive(:add_guard).with('another', anything, {})
lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['x','y']) }.should_not raise_error
end
+ it "should evaluate all groups when no group option is specified" do
+ ::Guard.should_receive(:add_guard).with('test', anything, {}).twice
+ ::Guard.should_receive(:add_guard).with('another', anything, {}).twice
+ lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
+ end
end
# TODO: not sure if each seperate quoting/call type needs its own test
From ca2a4fa1be2a0a1de98e31b566554cddae5484fe Mon Sep 17 00:00:00 2001
From: Ches Martin
Date: Sun, 14 Aug 2011 15:16:59 +0700
Subject: [PATCH 17/24] Don't fail specs because of blasted vim swapfiles
---
spec/support/listener_helper.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/spec/support/listener_helper.rb b/spec/support/listener_helper.rb
index 03bc21b..85c9d78 100644
--- a/spec/support/listener_helper.rb
+++ b/spec/support/listener_helper.rb
@@ -8,9 +8,11 @@ private
end
def record_results
+ noise = %r|\.sw.$| # don't fail specs due to editor swap files, etc.
+
@results = []
@listener.on_change do |files|
- @results += files
+ @results += files.reject { |f| f =~ noise }
end
end
From e375d2f3271d94fdbae7b427453854bb60f72f9c Mon Sep 17 00:00:00 2001
From: Michael Kessler
Date: Sun, 14 Aug 2011 14:17:48 +0200
Subject: [PATCH 18/24] Explain what happens with guards without a group.
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f749661..e73b177 100644
--- a/README.md
+++ b/README.md
@@ -243,7 +243,7 @@ Required:
Optional:
* The `#watch` method allows you to define which files are supervised by this guard. An optional block can be added to overwrite the paths sent to the guard's `#run_on_change` method or to launch any arbitrary command.
-* The `#group` method allows you to group several guards together. Groups to be run can be specified with the Guard DSL option `--group` (or `-g`). This comes in handy especially when you have a huge Guardfile and want to focus your development on a certain part.
+* The `#group` method allows you to group several guards together. Groups to be run can be specified with the Guard DSL option `--group` (or `-g`). This comes in handy especially when you have a huge Guardfile and want to focus your development on a certain part. Guards that don't belong to a group are considered global and are always run.
Example:
From 820501bf15b32ad6dbcebc73a45e3a2c3b613c63 Mon Sep 17 00:00:00 2001
From: mordaroso
Date: Sun, 14 Aug 2011 18:41:05 +0200
Subject: [PATCH 19/24] remove guardfile_contents when re-evaluating so that
the Guardfile gets reloaded correctly
---
lib/guard/dsl.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/guard/dsl.rb b/lib/guard/dsl.rb
index aa78735..abea392 100644
--- a/lib/guard/dsl.rb
+++ b/lib/guard/dsl.rb
@@ -14,6 +14,7 @@ module Guard
def reevaluate_guardfile
::Guard.guards.clear
+ @@options.delete(:guardfile_contents)
Dsl.evaluate_guardfile(@@options)
msg = "Guardfile has been re-evaluated."
UI.info(msg)
From e9cef8809b6c77a4aa1c390929cf358e41c96d7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?=
Date: Sun, 14 Aug 2011 21:25:57 +0300
Subject: [PATCH 20/24] [ci skip] Added a link to the screencast on Guard by
Ryan Bates (idea taken from the guard-process's README!). :)
---
README.md | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e73b177..06bd4a0 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,12 @@ Features
* Automatic & Super fast (when polling is not used) files modifications detection (even new files are detected).
* Growl notifications ([growlnotify](http://growl.info/documentation/growlnotify.php) & [growl gem](https://rubygems.org/gems/growl) required).
* Libnotify notifications ([libnotify gem](https://rubygems.org/gems/libnotify) required).
-* Tested on Ruby 1.8.7, 1.9.2 && ree.
+* Tested against Ruby 1.8.7, 1.9.2 and REE.
+
+Screencast
+----------
+
+Ryan Bates made a screencast on Guard, you can view it here: http://railscasts.com/episodes/264-guard
Install
-------
From ec7ba3cda101b12c9cc068105122198f556c15d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Mon, 15 Aug 2011 09:15:29 +0200
Subject: [PATCH 21/24] Use fuubar formatter
---
Gemfile | 6 +++++-
Guardfile | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Gemfile b/Gemfile
index 3a8f317..d5494f6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,4 +1,4 @@
-source "http://rubygems.org"
+source :rubygems
gemspec
@@ -8,6 +8,10 @@ group :guard do
gem 'guard-ronn'
end
+group :test do
+ gem 'fuubar'
+end
+
require 'rbconfig'
if RbConfig::CONFIG['target_os'] =~ /darwin/i
diff --git a/Guardfile b/Guardfile
index f32757d..3febef2 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,4 +1,4 @@
-guard 'rspec', :version => 2, :keep_failed => false, :cli => '-f doc' do
+guard 'rspec', :version => 2, :keep_failed => false, :cli => '--format Fuubar' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
From 59bb373fa7b6c60de6d0c212eefd43f04a2886f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Mon, 15 Aug 2011 09:19:32 +0200
Subject: [PATCH 22/24] Update CHANGELOG
---
CHANGELOG.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e57b83..2a14a6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 0.6.1 - August 15, 2011
+
+### Bugs fixes:
+
+- Pull request [#120](https://github.com/guard/guard/pull/120): remove guardfile_contents when re-evaluating so that the Guardfile gets reloaded correctly. ([@mordaroso][])
+- Pull request [#119](https://github.com/guard/guard/pull/119): Dsl.evaluate_guardfile uses all groups if none specified. ([@ches][])
+
## 0.6.0 - August 13, 2011
### Bugs fixes:
@@ -194,8 +201,10 @@
[@brainopia]: https://github.com/brainopia
[@bronson]: https://github.com/bronson
[@capotej]: https://github.com/capotej
+[@ches]: https://github.com/ches
[@chrisberkhout]: https://github.com/chrisberkhout
[@dnagir]: https://github.com/dnagir
+[@docwhat]: https://github.com/docwhat
[@etehtsea]: https://github.com/etehtsea
[@fnichol]: https://github.com/fnichol
[@Gazer]: https://github.com/Gazer
@@ -208,6 +217,7 @@
[@koshigoe]: https://github.com/koshigoe
[@mcmire]: https://github.com/mcmire
[@mislav]: https://github.com/mislav
+[@mordaroso]: https://github.com/mordaroso
[@nestegg]: https://github.com/nestegg
[@netzpirat]: https://github.com/netzpirat
[@nicksieger]: https://github.com/nicksieger
From 1ee70fbe2eb189900286ac1d7ce1f242f6aa3fa9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Re=CC=81my=20Coutable?=
Date: Mon, 15 Aug 2011 09:49:21 +0200
Subject: [PATCH 23/24] Updates manual
---
Guardfile | 10 ++---
man/guard.1 | 101 ++++++++++++-----------------------------------
man/guard.1.html | 73 ++++++++++++++++------------------
man/guard.md | 77 ------------------------------------
man/guard.ronn | 93 +++++++++++++++++++++++++++++++++++++++++++
5 files changed, 159 insertions(+), 195 deletions(-)
delete mode 100644 man/guard.md
create mode 100644 man/guard.ronn
diff --git a/Guardfile b/Guardfile
index 3febef2..106cadf 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,9 +1,13 @@
-guard 'rspec', :version => 2, :keep_failed => false, :cli => '--format Fuubar' do
+guard :rspec, :version => 2, :keep_failed => false, :cli => '--format Fuubar' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end
+guard :ronn do
+ watch(%r{^man/.+\.ronn?$})
+end
+
# require 'guard/guard'
#
# module ::Guard
@@ -17,7 +21,3 @@ end
# group "exceptional" do
# guard :breaking
# end
-
-guard 'ronn' do
- watch(%r{^man/.+\.m(ark)?d(own)?$})
-end
diff --git a/man/guard.1 b/man/guard.1
index a6d51fa..ea54ba5 100644
--- a/man/guard.1
+++ b/man/guard.1
@@ -10,7 +10,7 @@
Guard is a command line tool that easily handle events on files modifications\.
.
.SH "SYNOPSIS"
-guard \fIcommand\fR \fIoptions\fR
+\fBguard \fR
.
.SH "COMMANDS"
.
@@ -21,103 +21,54 @@ Starts Guard\. This is the default command if none is provided\.
The following options are available:
.
.P
-\fB\-c\fR/\fB\-\-clear\fR
-.
-.IP "" 4
-.
-.nf
-
- Clears the Shell after each change\.
-.
-.fi
-.
-.IP "" 0
+\fB\-c\fR, \fB\-\-clear\fR Clears the Shell after each change\.
.
.P
-\fB\-n\fR/\fB\-\-notify\fR \fIflag\fR
-.
-.IP "" 4
-.
-.nf
-
- Disable notifications (Growl or Libnotify depending on your system)\.
- Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false\.
- The part can be passed to guard using true/false or t/f\.
-.
-.fi
-.
-.IP "" 0
+\fB\-n\fR, \fB\-\-notify\fR \fIFLAG\fR Disable notifications (Growl or Libnotify depending on your system)\. Notifications can be disabled globally by setting a GUARD_NOTIFY environment variable to false\. FLAG can be \fBtrue\fR/\fBfalse\fR or \fBt\fR/\fBf\fR\.
.
.P
-\fB\-d\fR/\fB\-\-debug\fR
-.
-.IP "" 4
-.
-.nf
-
- Runs Guard in debug mode\.
-.
-.fi
-.
-.IP "" 0
+\fB\-d\fR, \fB\-\-debug\fR Runs Guard in debug mode\.
.
.P
-\fB\-g\fR/\fB\-\-group\fR \fIgroup\fR \.\.\.
-.
-.IP "" 4
-.
-.nf
-
- Runs only the groups specified\.
-.
-.fi
-.
-.IP "" 0
+\fB\-g\fR, \fB\-\-group\fR \fIGROUP1\fR \fIGROUP2\fR\.\.\. Runs only the groups specified by GROUP1, GROUP2 etc\. Groups name should be separated by spaces\. Guards that don\'t belong to a group are considered global and are always run\.
.
.P
-\fB\-w\fR/\fB\-\-watchdir\fR \fIfolder\fR
-.
-.IP "" 4
-.
-.nf
-
- Specify the directory to watch\.
-.
-.fi
-.
-.IP "" 0
+\fB\-w\fR, \fB\-\-watchdir\fR \fIPATH\fR
.
.P
-\fB\-G\fR/\fB\-\-guardfile\fR \fIfile\fR
+Tells Guard to watch PATH instead of \fB\./\fR\.
.
-.IP "" 4
+.P
+\fB\-G\fR, \fB\-\-guardfile\fR \fIFILE\fR Tells Guard to use FILE as its Guardfile instead of \fB\./Guardfile\fR or \fB~/\.Guardfile\fR\.
.
-.nf
-
- Specify a Guardfile by giving its path\.
+.SS "init [GUARD]"
+If no Guardfile is present in the current directory, creates an empty Guardfile\.
.
-.fi
-.
-.IP "" 0
-.
-.SS "init [guard]"
-Add the requested guard\'s default Guardfile configuration to the current Guardfile\.
+.P
+If \fIGUARD\fR is present, add its default Guardfile configuration to the current Guardfile\. Note that \fIGUARD\fR is the guard\'s name without the \fBguard\-\fR prefix\. For instance to initialize guard\-rspec, run \fBguard init rspec\fR\.
.
.SS "list"
Lists guards that can be used with the \fBinit\fR command\.
.
-.SS "\-T/show"
+.SS "\-T, show"
List defined groups and guards for the current Guardfile\.
.
-.SH "OPTIONS"
-.
-.TP
-\fB\-h\fR
+.SS "\-h, help [COMMAND]"
List all of Guard\'s available commands\.
.
-.SS "start"
+.P
+If \fICOMMAND\fR is given, displays a specific help for \fITASK\fR\.
.
.SH "EXAMPLES"
+Initialize Guard and a specific guard at the same time:
+.
+.P
+\fB[bundle exec] guard init [rspec]\fR
+.
+.P
+Run Guard:
+.
+.P
\fB[bundle exec] guard [start] \-\-watchdir ~/dev \-\-guardfile ~/env/Guardfile \-\-clear \-\-group backend frontend \-\-notify false \-\-debug\fR
.
.P
diff --git a/man/guard.1.html b/man/guard.1.html
index 81d3956..95d230f 100644
--- a/man/guard.1.html
+++ b/man/guard.1.html
@@ -57,7 +57,6 @@
DESCRIPTION
SYNOPSIS
COMMANDS
- OPTIONS
EXAMPLES
AUTHORS / CONTRIBUTORS
WWW
@@ -80,71 +79,69 @@
SYNOPSIS
-guard command options
+guard <COMMAND> <OPTIONS>
COMMANDS
start
- Starts Guard. This is the default command if none is provided.
+Starts Guard. This is the default command if none is provided.
The following options are available:
- -c
/--clear
+-c
, --clear
+ Clears the Shell after each change.
- Clears the Shell after each change.
-
+-n
, --notify
FLAG
+ Disable notifications (Growl or Libnotify depending on your system).
+ Notifications can be disabled globally by setting a GUARD_NOTIFY environment variable to false.
+ FLAG can be true
/false
or t
/f
.
- -n
/--notify
flag
+-d
, --debug
+ Runs Guard in debug mode.
- Disable notifications (Growl or Libnotify depending on your system).
- Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
- The <flag> part can be passed to guard using true/false or t/f.
-
+-g
, --group
GROUP1 GROUP2...
+ Runs only the groups specified by GROUP1, GROUP2 etc.
+ Groups name should be separated by spaces.
+ Guards that don't belong to a group are considered global and are always run.
- -d
/--debug
+-w
, --watchdir
PATH
- Runs Guard in debug mode.
-
+Tells Guard to watch PATH instead of ./
.
- -g
/--group
group ...
+-G
, --guardfile
FILE
+ Tells Guard to use FILE as its Guardfile instead of ./Guardfile
or ~/.Guardfile
.
- Runs only the groups specified.
-
+init [GUARD]
- -w
/--watchdir
folder
+If no Guardfile is present in the current directory, creates an empty Guardfile.
- Specify the directory to watch.
-
-
- -G
/--guardfile
file
-
- Specify a Guardfile by giving its path.
-
-
-init [guard]
-
- Add the requested guard's default Guardfile configuration to the current Guardfile.
+If GUARD is present, add its default Guardfile configuration to the current Guardfile.
+Note that GUARD is the guard's name without the guard-
prefix.
+For instance to initialize guard-rspec, run guard init rspec
.
list
- Lists guards that can be used with the init
command.
+Lists guards that can be used with the init
command.
--T/show
+-T, show
- List defined groups and guards for the current Guardfile.
+List defined groups and guards for the current Guardfile.
-OPTIONS
+-h, help [COMMAND]
-
--h
- List all of Guard's available commands.
-
+List all of Guard's available commands.
-
-start
+If COMMAND is given, displays a specific help for TASK.
EXAMPLES
+Initialize Guard and a specific guard at the same time:
+
+[bundle exec] guard init [rspec]
+
+Run Guard:
+
[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug
or in a more concise way:
diff --git a/man/guard.md b/man/guard.md
deleted file mode 100644
index f61dd1d..0000000
--- a/man/guard.md
+++ /dev/null
@@ -1,77 +0,0 @@
-guard(1) -- Guard keeps an eye on your file modifications.
-========================================================
-
-## DESCRIPTION
-
-Guard is a command line tool that easily handle events on files modifications.
-
-## SYNOPSIS
-
-guard
-
-## COMMANDS
-
-### start
- Starts Guard. This is the default command if none is provided.
-
-The following options are available:
-
- `-c`/`--clear`
- Clears the Shell after each change.
-
- `-n`/`--notify`
- Disable notifications (Growl or Libnotify depending on your system).
- Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
- The part can be passed to guard using true/false or t/f.
-
- `-d`/`--debug`
- Runs Guard in debug mode.
-
- `-g`/`--group` ...
- Runs only the groups specified.
-
- `-w`/`--watchdir`
- Specify the directory to watch.
-
- `-G`/`--guardfile`
- Specify a Guardfile by giving its path.
-
-### init [guard]
- Add the requested guard's default Guardfile configuration to the current Guardfile.
-
-### list
- Lists guards that can be used with the `init` command.
-
-### -T/show
- List defined groups and guards for the current Guardfile.
-
-## OPTIONS
-
-* `-h`:
- List all of Guard's available commands.
-
-### start
-
-## EXAMPLES
-
-`[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug`
-
-or in a more concise way:
-
-`[bundle exec] guard [start] -w ~/dev -G ~/env/Guardfile -c -g backend frontend -n f -d`
-
-## AUTHORS / CONTRIBUTORS
-
-Thibaud Guillaume-Gentil is the main author.
-
-A list of contributors based on all commits can be found here:
-https://github.com/guard/guard/contributors
-
-For an exhaustive list of all the contributors, please see the CHANGELOG:
-https://github.com/guard/guard/blob/master/CHANGELOG.md
-
-This manual has been written by Remy Coutable.
-
-## WWW
-
-https://github.com/guard/guard
\ No newline at end of file
diff --git a/man/guard.ronn b/man/guard.ronn
new file mode 100644
index 0000000..412284a
--- /dev/null
+++ b/man/guard.ronn
@@ -0,0 +1,93 @@
+guard(1) -- Guard keeps an eye on your file modifications.
+========================================================
+
+## DESCRIPTION
+
+Guard is a command line tool that easily handle events on files modifications.
+
+## SYNOPSIS
+
+`guard `
+
+## COMMANDS
+
+### start
+
+Starts Guard. This is the default command if none is provided.
+
+The following options are available:
+
+`-c`, `--clear`
+ Clears the Shell after each change.
+
+`-n`, `--notify`
+ Disable notifications (Growl or Libnotify depending on your system).
+ Notifications can be disabled globally by setting a GUARD_NOTIFY environment variable to false.
+ FLAG can be `true`/`false` or `t`/`f`.
+
+`-d`, `--debug`
+ Runs Guard in debug mode.
+
+`-g`, `--group` ...
+ Runs only the groups specified by GROUP1, GROUP2 etc.
+ Groups name should be separated by spaces.
+ Guards that don't belong to a group are considered global and are always run.
+
+`-w`, `--watchdir`
+
+Tells Guard to watch PATH instead of `./`.
+
+`-G`, `--guardfile`
+ Tells Guard to use FILE as its Guardfile instead of `./Guardfile` or `~/.Guardfile`.
+
+### init [GUARD]
+
+If no Guardfile is present in the current directory, creates an empty Guardfile.
+
+If is present, add its default Guardfile configuration to the current Guardfile.
+Note that is the guard's name without the `guard-` prefix.
+For instance to initialize guard-rspec, run `guard init rspec`.
+
+### list
+
+Lists guards that can be used with the `init` command.
+
+### -T, show
+
+List defined groups and guards for the current Guardfile.
+
+### -h, help [COMMAND]
+
+List all of Guard's available commands.
+
+If is given, displays a specific help for .
+
+## EXAMPLES
+
+Initialize Guard and a specific guard at the same time:
+
+`[bundle exec] guard init [rspec]`
+
+Run Guard:
+
+`[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug`
+
+or in a more concise way:
+
+`[bundle exec] guard [start] -w ~/dev -G ~/env/Guardfile -c -g backend frontend -n f -d`
+
+## AUTHORS / CONTRIBUTORS
+
+Thibaud Guillaume-Gentil is the main author.
+
+A list of contributors based on all commits can be found here:
+https://github.com/guard/guard/contributors
+
+For an exhaustive list of all the contributors, please see the CHANGELOG:
+https://github.com/guard/guard/blob/master/CHANGELOG.md
+
+This manual has been written by Remy Coutable.
+
+## WWW
+
+https://github.com/guard/guard
\ No newline at end of file
From d268f236bf0f859a0c8729b44e605612e7031851 Mon Sep 17 00:00:00 2001
From: Thibaud Guillaume-Gentil
Date: Mon, 15 Aug 2011 09:53:10 +0200
Subject: [PATCH 24/24] Version 0.6.1
---
lib/guard/version.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/guard/version.rb b/lib/guard/version.rb
index b1df99c..6b73f67 100644
--- a/lib/guard/version.rb
+++ b/lib/guard/version.rb
@@ -1,3 +1,3 @@
module Guard
- VERSION = "0.6.0" unless defined? Guard::VERSION
+ VERSION = "0.6.1" unless defined? Guard::VERSION
end