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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7850da..2a14a6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,11 @@
-## Master
+## 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:
@@ -7,10 +14,12 @@
### 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 [#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][])
- New CLI options: ([@nestegg][])
@@ -192,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
@@ -206,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
@@ -223,3 +235,4 @@
[@veged]: https://github.com/veged
[@wereHamster]: https://github.com/wereHamster
[@yannlugrin]: https://github.com/yannlugrin
+[@zonque]: https://github.com/zonque
diff --git a/Gemfile b/Gemfile
index 269c5e6..fe4b33b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,14 +1,22 @@
-source "http://rubygems.org"
+source :rubygems
gemspec
gem 'rake'
+group :guard do
+ gem 'guard-ronn'
+end
+
+group :test do
+ gem 'fuubar'
+end
+
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/Guardfile b/Guardfile
index c7cd061..ff974be 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,9 +1,13 @@
-guard 'rspec', :version => 2, :all_on_start => false, :all_after_pass => false, :keep_failed => false, :cli => '-f doc' do
+guard :rspec, :version => 2, :all_on_start => false, :all_after_pass => false, :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
@@ -16,4 +20,4 @@ end
#
# group "exceptional" do
# guard :breaking
-# end
\ No newline at end of file
+# end
diff --git a/README.md b/README.md
index 7aa00dd..2f35d8d 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
-------
@@ -50,17 +55,17 @@ 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 the growl_notify gem if you want notification support:
``` bash
-$ gem install growl
+$ gem install growl_notify
```
-And add them to your Gemfile:
+And add it to your Gemfile:
``` ruby
gem 'rb-fsevent'
-gem 'growl'
+gem 'growl_notify'
```
### On Linux
@@ -92,6 +97,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
@@ -103,6 +114,7 @@ And add them to your Gemfile:
``` ruby
gem 'rb-fchange'
gem 'rb-notifu'
+gem 'win32console'
```
Usage
@@ -125,7 +137,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 +146,7 @@ $ guard --clear
$ guard -c # shortcut
```
-### `--notify` option
+### `-n`/`--notify` option
Notifications (growl/libnotify) can be disabled:
@@ -145,7 +157,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 +166,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 +175,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
@@ -219,7 +249,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:
diff --git a/lib/guard/dsl.rb b/lib/guard/dsl.rb
index aa78735..1a6c739 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)
@@ -104,7 +105,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/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
diff --git a/lib/guard/notifier.rb b/lib/guard/notifier.rb
index eb5bd86..b3ae3b2 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'
@@ -45,13 +46,16 @@ 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?
+
+ options = { :description => message, :title => title, :icon => image_path(image), :application_name => APPLICATION_NAME }.merge(options)
+ options.delete(:name)
+
+ GrowlNotify.send_notification(options) if enabled?
end
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
@@ -90,10 +94,17 @@ module Guard
end
def self.require_growl
- require 'growl'
+ 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
+ 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_notify gem for Mac OS X notification support and add it to your Gemfile"
end
def self.require_libnotify
diff --git a/lib/guard/version.rb b/lib/guard/version.rb
index 78f2314..6b73f67 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.1" unless defined? Guard::VERSION
end
diff --git a/man/guard.1 b/man/guard.1
index 5e5f92e..ea54ba5 100644
--- a/man/guard.1
+++ b/man/guard.1
@@ -1,64 +1,81 @@
.\" 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 "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 "SYNOPSIS"
+\fBguard
@@ -74,47 +73,80 @@
guard
- Guard keeps an eye on your file modifications.
guard command options
-Guard is a command line tool that easily handle events on files modifications.
-https://github.com/guard/guard
- --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.
guard <COMMAND> <OPTIONS>
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.
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).
+ 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
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.
-w
, --watchdir
PATH
Tells Guard to watch PATH instead of ./
.
-G
, --guardfile
FILE
+ Tells Guard to use FILE as its Guardfile instead of ./Guardfile
or ~/.Guardfile
.
If no Guardfile is present in the current directory, creates an empty 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
.
Lists guards that can be used with the init
command.
List defined groups and guards for the current Guardfile.
+ +List all of Guard's available commands.
+ +If COMMAND is given, displays a specific help for TASK.
[bundle exec] guard --clear --group backend frontend --notify false --debug
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 -c -g backend frontend -n f -d
[bundle exec] guard [start] -w ~/dev -G ~/env/Guardfile -c -g backend frontend -n f -d
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.
+ +https://github.com/guard/guard
+