Merge branch 'master' into stdin
Conflicts: Guardfile
This commit is contained in:
commit
d6e27fe334
@ -2,3 +2,9 @@ rvm:
|
|||||||
- 1.8.7
|
- 1.8.7
|
||||||
- 1.9.2
|
- 1.9.2
|
||||||
- ree
|
- ree
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- hook
|
||||||
|
notifications:
|
||||||
|
irc: "irc.freenode.org#guard"
|
17
CHANGELOG.md
17
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:
|
### Bugs fixes:
|
||||||
|
|
||||||
@ -7,10 +14,12 @@
|
|||||||
|
|
||||||
### New features
|
### 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
|
### 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][])
|
- 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][])
|
- `Guard::Dsl.revaluate_guardfile` has been renamed to `Guard::Dsl.reevaluate_guardfile`. ([@rymai][])
|
||||||
- New CLI options: ([@nestegg][])
|
- New CLI options: ([@nestegg][])
|
||||||
@ -192,8 +201,10 @@
|
|||||||
[@brainopia]: https://github.com/brainopia
|
[@brainopia]: https://github.com/brainopia
|
||||||
[@bronson]: https://github.com/bronson
|
[@bronson]: https://github.com/bronson
|
||||||
[@capotej]: https://github.com/capotej
|
[@capotej]: https://github.com/capotej
|
||||||
|
[@ches]: https://github.com/ches
|
||||||
[@chrisberkhout]: https://github.com/chrisberkhout
|
[@chrisberkhout]: https://github.com/chrisberkhout
|
||||||
[@dnagir]: https://github.com/dnagir
|
[@dnagir]: https://github.com/dnagir
|
||||||
|
[@docwhat]: https://github.com/docwhat
|
||||||
[@etehtsea]: https://github.com/etehtsea
|
[@etehtsea]: https://github.com/etehtsea
|
||||||
[@fnichol]: https://github.com/fnichol
|
[@fnichol]: https://github.com/fnichol
|
||||||
[@Gazer]: https://github.com/Gazer
|
[@Gazer]: https://github.com/Gazer
|
||||||
@ -206,6 +217,7 @@
|
|||||||
[@koshigoe]: https://github.com/koshigoe
|
[@koshigoe]: https://github.com/koshigoe
|
||||||
[@mcmire]: https://github.com/mcmire
|
[@mcmire]: https://github.com/mcmire
|
||||||
[@mislav]: https://github.com/mislav
|
[@mislav]: https://github.com/mislav
|
||||||
|
[@mordaroso]: https://github.com/mordaroso
|
||||||
[@nestegg]: https://github.com/nestegg
|
[@nestegg]: https://github.com/nestegg
|
||||||
[@netzpirat]: https://github.com/netzpirat
|
[@netzpirat]: https://github.com/netzpirat
|
||||||
[@nicksieger]: https://github.com/nicksieger
|
[@nicksieger]: https://github.com/nicksieger
|
||||||
@ -223,3 +235,4 @@
|
|||||||
[@veged]: https://github.com/veged
|
[@veged]: https://github.com/veged
|
||||||
[@wereHamster]: https://github.com/wereHamster
|
[@wereHamster]: https://github.com/wereHamster
|
||||||
[@yannlugrin]: https://github.com/yannlugrin
|
[@yannlugrin]: https://github.com/yannlugrin
|
||||||
|
[@zonque]: https://github.com/zonque
|
||||||
|
12
Gemfile
12
Gemfile
@ -1,14 +1,22 @@
|
|||||||
source "http://rubygems.org"
|
source :rubygems
|
||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
|
|
||||||
|
group :guard do
|
||||||
|
gem 'guard-ronn'
|
||||||
|
end
|
||||||
|
|
||||||
|
group :test do
|
||||||
|
gem 'fuubar'
|
||||||
|
end
|
||||||
|
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
|
||||||
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
||||||
gem 'rb-fsevent', '>= 0.4.0', :require => false
|
gem 'rb-fsevent', '>= 0.4.0', :require => false
|
||||||
gem 'growl', '~> 1.0.3', :require => false
|
gem 'growl_notify', :require => false
|
||||||
end
|
end
|
||||||
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
||||||
gem 'rb-inotify', '>= 0.8.5', :require => false
|
gem 'rb-inotify', '>= 0.8.5', :require => false
|
||||||
|
@ -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{^spec/.+_spec\.rb$})
|
||||||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
||||||
watch('spec/spec_helper.rb') { "spec" }
|
watch('spec/spec_helper.rb') { "spec" }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
guard :ronn do
|
||||||
|
watch(%r{^man/.+\.ronn?$})
|
||||||
|
end
|
||||||
|
|
||||||
# require 'guard/guard'
|
# require 'guard/guard'
|
||||||
#
|
#
|
||||||
# module ::Guard
|
# module ::Guard
|
||||||
|
50
README.md
50
README.md
@ -15,7 +15,12 @@ Features
|
|||||||
* Automatic & Super fast (when polling is not used) files modifications detection (even new files are detected).
|
* 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).
|
* 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).
|
* 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
|
Install
|
||||||
-------
|
-------
|
||||||
@ -50,17 +55,17 @@ Install the rb-fsevent gem for [FSEvent](http://en.wikipedia.org/wiki/FSEvents)
|
|||||||
$ gem install rb-fsevent
|
$ gem install rb-fsevent
|
||||||
```
|
```
|
||||||
|
|
||||||
Install the Growl gem if you want notification support:
|
Install the growl_notify gem if you want notification support:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
$ gem install growl
|
$ gem install growl_notify
|
||||||
```
|
```
|
||||||
|
|
||||||
And add them to your Gemfile:
|
And add it to your Gemfile:
|
||||||
|
|
||||||
``` ruby
|
``` ruby
|
||||||
gem 'rb-fsevent'
|
gem 'rb-fsevent'
|
||||||
gem 'growl'
|
gem 'growl_notify'
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Linux
|
### On Linux
|
||||||
@ -92,6 +97,12 @@ Install the rb-fchange gem for [Directory Change Notification](http://msdn.micro
|
|||||||
$ gem install rb-fchange
|
$ 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:
|
Install the Notifu gem if you want notification support:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
@ -103,6 +114,7 @@ And add them to your Gemfile:
|
|||||||
``` ruby
|
``` ruby
|
||||||
gem 'rb-fchange'
|
gem 'rb-fchange'
|
||||||
gem 'rb-notifu'
|
gem 'rb-notifu'
|
||||||
|
gem 'win32console'
|
||||||
```
|
```
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@ -125,7 +137,7 @@ Guard will look for a Guardfile in your current directory. If it does not find o
|
|||||||
Command line options
|
Command line options
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
### `--clear` option
|
### `-c`/`--clear` option
|
||||||
|
|
||||||
Shell can be cleared after each change:
|
Shell can be cleared after each change:
|
||||||
|
|
||||||
@ -134,7 +146,7 @@ $ guard --clear
|
|||||||
$ guard -c # shortcut
|
$ guard -c # shortcut
|
||||||
```
|
```
|
||||||
|
|
||||||
### `--notify` option
|
### `-n`/`--notify` option
|
||||||
|
|
||||||
Notifications (growl/libnotify) can be disabled:
|
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`
|
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):
|
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
|
$ guard -g group_name another_group_name # shortcut
|
||||||
```
|
```
|
||||||
|
|
||||||
### `--debug` option
|
### `-d`/`--debug` option
|
||||||
|
|
||||||
Guard can be run in debug mode:
|
Guard can be run in debug mode:
|
||||||
|
|
||||||
@ -163,6 +175,24 @@ $ guard --debug
|
|||||||
$ guard -d # shortcut
|
$ 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:
|
An exhaustive list of options is available with:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
@ -219,7 +249,7 @@ Required:
|
|||||||
Optional:
|
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 `#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:
|
Example:
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ module Guard
|
|||||||
|
|
||||||
def reevaluate_guardfile
|
def reevaluate_guardfile
|
||||||
::Guard.guards.clear
|
::Guard.guards.clear
|
||||||
|
@@options.delete(:guardfile_contents)
|
||||||
Dsl.evaluate_guardfile(@@options)
|
Dsl.evaluate_guardfile(@@options)
|
||||||
msg = "Guardfile has been re-evaluated."
|
msg = "Guardfile has been re-evaluated."
|
||||||
UI.info(msg)
|
UI.info(msg)
|
||||||
@ -104,7 +105,8 @@ module Guard
|
|||||||
end
|
end
|
||||||
|
|
||||||
def group(name, &guard_definition)
|
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
|
end
|
||||||
|
|
||||||
def guard(name, options = {}, &watch_definition)
|
def guard(name, options = {}, &watch_definition)
|
||||||
|
@ -22,7 +22,7 @@ module Guard
|
|||||||
def watch_change
|
def watch_change
|
||||||
until @stop
|
until @stop
|
||||||
start = Time.now.to_f
|
start = Time.now.to_f
|
||||||
files = modified_files([Dir.pwd], :all => true)
|
files = modified_files([@directory], :all => true)
|
||||||
@callback.call(files) unless files.empty?
|
@callback.call(files) unless files.empty?
|
||||||
nap_time = @latency - (Time.now.to_f - start)
|
nap_time = @latency - (Time.now.to_f - start)
|
||||||
sleep(nap_time) if nap_time > 0
|
sleep(nap_time) if nap_time > 0
|
||||||
|
@ -4,6 +4,7 @@ require 'guard/ui'
|
|||||||
|
|
||||||
module Guard
|
module Guard
|
||||||
module Notifier
|
module Notifier
|
||||||
|
APPLICATION_NAME = "Guard"
|
||||||
|
|
||||||
def self.turn_off
|
def self.turn_off
|
||||||
ENV["GUARD_NOTIFY"] = 'false'
|
ENV["GUARD_NOTIFY"] = 'false'
|
||||||
@ -45,13 +46,16 @@ module Guard
|
|||||||
|
|
||||||
def self.notify_mac(title, message, image, options)
|
def self.notify_mac(title, message, image, options)
|
||||||
require_growl # need for guard-rspec formatter that is called out of guard scope
|
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
|
end
|
||||||
|
|
||||||
def self.notify_linux(title, message, image, options)
|
def self.notify_linux(title, message, image, options)
|
||||||
require_libnotify # need for guard-rspec formatter that is called out of guard scope
|
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?
|
Libnotify.show default_options.merge(options) if enabled?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -90,10 +94,17 @@ module Guard
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.require_growl
|
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
|
rescue LoadError
|
||||||
turn_off
|
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
|
end
|
||||||
|
|
||||||
def self.require_libnotify
|
def self.require_libnotify
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
module Guard
|
module Guard
|
||||||
VERSION = "0.5.1" unless defined? Guard::VERSION
|
VERSION = "0.6.1" unless defined? Guard::VERSION
|
||||||
end
|
end
|
||||||
|
97
man/guard.1
97
man/guard.1
@ -1,64 +1,81 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "GUARD" "1" "June 2011" "" ""
|
.TH "GUARD" "1" "August 2011" "" ""
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBguard\fR \- Guard keeps an eye on your file modifications\.
|
\fBguard\fR \- Guard keeps an eye on your file modifications\.
|
||||||
.
|
.
|
||||||
.SH "SYNOPSIS"
|
|
||||||
guard \fIcommand\fR \fIoptions\fR
|
|
||||||
.
|
|
||||||
.SH "DESCRIPTION"
|
.SH "DESCRIPTION"
|
||||||
Guard is a command line tool that easily handle events on files modifications\.
|
Guard is a command line tool that easily handle events on files modifications\.
|
||||||
.
|
.
|
||||||
.SH "HOMEPAGE"
|
.SH "SYNOPSIS"
|
||||||
https://github\.com/guard/guard
|
\fBguard <COMMAND> <OPTIONS>\fR
|
||||||
.
|
|
||||||
.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"
|
.SH "COMMANDS"
|
||||||
.
|
.
|
||||||
.TP
|
.SS "start"
|
||||||
\fBstart\fR
|
|
||||||
Starts Guard\. This is the default command if none is provided\.
|
Starts Guard\. This is the default command if none is provided\.
|
||||||
.
|
.
|
||||||
.TP
|
.P
|
||||||
\fBinit\fR [guard]
|
The following options are available:
|
||||||
Add the requested guard\'s default Guardfile configuration to the current Guardfile\.
|
|
||||||
.
|
.
|
||||||
.TP
|
.P
|
||||||
\fBshow\fR, \fB\-T\fR
|
\fB\-c\fR, \fB\-\-clear\fR Clears the Shell after each change\.
|
||||||
|
.
|
||||||
|
.P
|
||||||
|
\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 Runs Guard in debug mode\.
|
||||||
|
.
|
||||||
|
.P
|
||||||
|
\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 \fIPATH\fR
|
||||||
|
.
|
||||||
|
.P
|
||||||
|
Tells Guard to watch PATH instead of \fB\./\fR\.
|
||||||
|
.
|
||||||
|
.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\.
|
||||||
|
.
|
||||||
|
.SS "init [GUARD]"
|
||||||
|
If no Guardfile is present in the current directory, creates an empty 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"
|
||||||
List defined groups and guards for the current Guardfile\.
|
List defined groups and guards for the current Guardfile\.
|
||||||
.
|
.
|
||||||
|
.SS "\-h, help [COMMAND]"
|
||||||
|
List all of Guard\'s available commands\.
|
||||||
|
.
|
||||||
|
.P
|
||||||
|
If \fICOMMAND\fR is given, displays a specific help for \fITASK\fR\.
|
||||||
|
.
|
||||||
.SH "EXAMPLES"
|
.SH "EXAMPLES"
|
||||||
\fB[bundle exec] guard \-\-clear \-\-group backend frontend \-\-notify false \-\-debug\fR
|
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
|
.P
|
||||||
or in a more concise way:
|
or in a more concise way:
|
||||||
.
|
.
|
||||||
.P
|
.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"
|
.SH "AUTHORS / CONTRIBUTORS"
|
||||||
Thibaud Guillaume\-Gentil is the main author\.
|
Thibaud Guillaume\-Gentil is the main author\.
|
||||||
@ -68,3 +85,9 @@ A list of contributors based on all commits can be found here: https://github\.c
|
|||||||
.
|
.
|
||||||
.P
|
.P
|
||||||
For an exhaustive list of all the contributors, please see the CHANGELOG: https://github\.com/guard/guard/blob/master/CHANGELOG\.md
|
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
|
||||||
|
@ -54,13 +54,12 @@
|
|||||||
|
|
||||||
<div class='man-navigation' style='display:none'>
|
<div class='man-navigation' style='display:none'>
|
||||||
<a href="#NAME">NAME</a>
|
<a href="#NAME">NAME</a>
|
||||||
<a href="#SYNOPSIS">SYNOPSIS</a>
|
|
||||||
<a href="#DESCRIPTION">DESCRIPTION</a>
|
<a href="#DESCRIPTION">DESCRIPTION</a>
|
||||||
<a href="#HOMEPAGE">HOMEPAGE</a>
|
<a href="#SYNOPSIS">SYNOPSIS</a>
|
||||||
<a href="#OPTIONS">OPTIONS</a>
|
|
||||||
<a href="#COMMANDS">COMMANDS</a>
|
<a href="#COMMANDS">COMMANDS</a>
|
||||||
<a href="#EXAMPLES">EXAMPLES</a>
|
<a href="#EXAMPLES">EXAMPLES</a>
|
||||||
<a href="#AUTHORS-CONTRIBUTORS">AUTHORS / CONTRIBUTORS</a>
|
<a href="#AUTHORS-CONTRIBUTORS">AUTHORS / CONTRIBUTORS</a>
|
||||||
|
<a href="#WWW">WWW</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ol class='man-decor man-head man head'>
|
<ol class='man-decor man-head man head'>
|
||||||
@ -74,47 +73,80 @@
|
|||||||
<code>guard</code> - <span class="man-whatis">Guard keeps an eye on your file modifications.</span>
|
<code>guard</code> - <span class="man-whatis">Guard keeps an eye on your file modifications.</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
|
||||||
|
|
||||||
<p>guard <var>command</var> <var>options</var></p>
|
|
||||||
|
|
||||||
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
||||||
|
|
||||||
<p>Guard is a command line tool that easily handle events on files modifications.</p>
|
<p>Guard is a command line tool that easily handle events on files modifications.</p>
|
||||||
|
|
||||||
<h2 id="HOMEPAGE">HOMEPAGE</h2>
|
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
||||||
|
|
||||||
<p>https://github.com/guard/guard</p>
|
|
||||||
|
|
||||||
<h2 id="OPTIONS">OPTIONS</h2>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt><code>-c</code>, <code>--clear</code></dt><dd><p>Clears the Shell after each change.</p></dd>
|
|
||||||
<dt><code>-n</code> <var>flag</var>, <code>--notify</code> <var>flag</var></dt><dd><p>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 <var>flag</var> part can be passed to guard using true/false or t/f.</p></dd>
|
|
||||||
<dt><code>-g</code> <var>group</var> ..., <code>--group</code> <var>group</var> ...</dt><dd><p>Runs only the groups specified.</p></dd>
|
|
||||||
<dt><code>-d</code>, <code>--debug</code></dt><dd><p>Runs Guard in debug mode.</p></dd>
|
|
||||||
<dt class="flush"><code>-h</code></dt><dd><p>List all of Guard's available commands.</p></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
|
<p><code>guard <COMMAND> <OPTIONS></code></p>
|
||||||
|
|
||||||
<h2 id="COMMANDS">COMMANDS</h2>
|
<h2 id="COMMANDS">COMMANDS</h2>
|
||||||
|
|
||||||
<dl>
|
<h3 id="start">start</h3>
|
||||||
<dt class="flush"><code>start</code></dt><dd><p>Starts Guard. This is the default command if none is provided.</p></dd>
|
|
||||||
<dt><code>init</code> [guard]</dt><dd><p>Add the requested guard's default Guardfile configuration to the current Guardfile.</p></dd>
|
|
||||||
<dt><code>show</code>, <code>-T</code></dt><dd><p>List defined groups and guards for the current Guardfile.</p></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
|
<p>Starts Guard. This is the default command if none is provided.</p>
|
||||||
|
|
||||||
|
<p>The following options are available:</p>
|
||||||
|
|
||||||
|
<p><code>-c</code>, <code>--clear</code>
|
||||||
|
Clears the Shell after each change.</p>
|
||||||
|
|
||||||
|
<p><code>-n</code>, <code>--notify</code> <var>FLAG</var>
|
||||||
|
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 <code>true</code>/<code>false</code> or <code>t</code>/<code>f</code>.</p>
|
||||||
|
|
||||||
|
<p><code>-d</code>, <code>--debug</code>
|
||||||
|
Runs Guard in debug mode.</p>
|
||||||
|
|
||||||
|
<p><code>-g</code>, <code>--group</code> <var>GROUP1</var> <var>GROUP2</var>...
|
||||||
|
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>
|
||||||
|
|
||||||
|
<p><code>-w</code>, <code>--watchdir</code> <var>PATH</var></p>
|
||||||
|
|
||||||
|
<p>Tells Guard to watch PATH instead of <code>./</code>.</p>
|
||||||
|
|
||||||
|
<p><code>-G</code>, <code>--guardfile</code> <var>FILE</var>
|
||||||
|
Tells Guard to use FILE as its Guardfile instead of <code>./Guardfile</code> or <code>~/.Guardfile</code>.</p>
|
||||||
|
|
||||||
|
<h3 id="init-GUARD-">init [GUARD]</h3>
|
||||||
|
|
||||||
|
<p>If no Guardfile is present in the current directory, creates an empty Guardfile.</p>
|
||||||
|
|
||||||
|
<p>If <var>GUARD</var> is present, add its default Guardfile configuration to the current Guardfile.
|
||||||
|
Note that <var>GUARD</var> is the guard's name without the <code>guard-</code> prefix.
|
||||||
|
For instance to initialize guard-rspec, run <code>guard init rspec</code>.</p>
|
||||||
|
|
||||||
|
<h3 id="list">list</h3>
|
||||||
|
|
||||||
|
<p>Lists guards that can be used with the <code>init</code> command.</p>
|
||||||
|
|
||||||
|
<h3 id="-T-show">-T, show</h3>
|
||||||
|
|
||||||
|
<p>List defined groups and guards for the current Guardfile.</p>
|
||||||
|
|
||||||
|
<h3 id="-h-help-COMMAND-">-h, help [COMMAND]</h3>
|
||||||
|
|
||||||
|
<p>List all of Guard's available commands.</p>
|
||||||
|
|
||||||
|
<p>If <var>COMMAND</var> is given, displays a specific help for <var>TASK</var>.</p>
|
||||||
|
|
||||||
<h2 id="EXAMPLES">EXAMPLES</h2>
|
<h2 id="EXAMPLES">EXAMPLES</h2>
|
||||||
|
|
||||||
<p><code>[bundle exec] guard --clear --group backend frontend --notify false --debug</code></p>
|
<p>Initialize Guard and a specific guard at the same time:</p>
|
||||||
|
|
||||||
|
<p><code>[bundle exec] guard init [rspec]</code></p>
|
||||||
|
|
||||||
|
<p>Run Guard:</p>
|
||||||
|
|
||||||
|
<p><code>[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug</code></p>
|
||||||
|
|
||||||
<p>or in a more concise way:</p>
|
<p>or in a more concise way:</p>
|
||||||
|
|
||||||
<p><code>[bundle exec] guard -c -g backend frontend -n f -d</code></p>
|
<p><code>[bundle exec] guard [start] -w ~/dev -G ~/env/Guardfile -c -g backend frontend -n f -d</code></p>
|
||||||
|
|
||||||
<h2 id="AUTHORS-CONTRIBUTORS">AUTHORS / CONTRIBUTORS</h2>
|
<h2 id="AUTHORS-CONTRIBUTORS">AUTHORS / CONTRIBUTORS</h2>
|
||||||
|
|
||||||
@ -126,10 +158,16 @@ https://github.com/guard/guard/contributors</p>
|
|||||||
<p>For an exhaustive list of all the contributors, please see the CHANGELOG:
|
<p>For an exhaustive list of all the contributors, please see the CHANGELOG:
|
||||||
https://github.com/guard/guard/blob/master/CHANGELOG.md</p>
|
https://github.com/guard/guard/blob/master/CHANGELOG.md</p>
|
||||||
|
|
||||||
|
<p>This manual has been written by Remy Coutable.</p>
|
||||||
|
|
||||||
|
<h2 id="WWW">WWW</h2>
|
||||||
|
|
||||||
|
<p>https://github.com/guard/guard</p>
|
||||||
|
|
||||||
|
|
||||||
<ol class='man-decor man-foot man foot'>
|
<ol class='man-decor man-foot man foot'>
|
||||||
<li class='tl'></li>
|
<li class='tl'></li>
|
||||||
<li class='tc'>June 2011</li>
|
<li class='tc'>August 2011</li>
|
||||||
<li class='tr'>guard(1)</li>
|
<li class='tr'>guard(1)</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
62
man/guard.md
62
man/guard.md
@ -1,62 +0,0 @@
|
|||||||
guard(1) -- 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
|
|
||||||
|
|
||||||
https://github.com/guard/guard
|
|
||||||
|
|
||||||
## OPTIONS
|
|
||||||
|
|
||||||
* `-c`, `--clear`:
|
|
||||||
Clears the Shell after each change.
|
|
||||||
|
|
||||||
* `-n` <flag>, `--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.
|
|
||||||
|
|
||||||
* `-g` <group> ..., `--group` <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.
|
|
||||||
|
|
||||||
## EXAMPLES
|
|
||||||
|
|
||||||
`[bundle exec] guard --clear --group backend frontend --notify false --debug`
|
|
||||||
|
|
||||||
or in a more concise way:
|
|
||||||
|
|
||||||
`[bundle exec] guard -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
|
|
93
man/guard.ronn
Normal file
93
man/guard.ronn
Normal file
@ -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 <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).
|
||||||
|
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`.
|
||||||
|
|
||||||
|
### init [GUARD]
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
|
### 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 <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:
|
||||||
|
|
||||||
|
`[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
|
@ -213,6 +213,11 @@ describe Guard::Dsl do
|
|||||||
::Guard.should_receive(:add_guard).with('another', anything, {})
|
::Guard.should_receive(:add_guard).with('another', anything, {})
|
||||||
lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['x','y']) }.should_not raise_error
|
lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['x','y']) }.should_not raise_error
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
# TODO: not sure if each seperate quoting/call type needs its own test
|
# TODO: not sure if each seperate quoting/call type needs its own test
|
||||||
|
@ -20,17 +20,28 @@ describe Guard::Notifier do
|
|||||||
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'darwin'
|
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'darwin'
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with the Growl library available" do
|
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
|
it "loads the library and enables the notifications" do
|
||||||
subject.should_receive(:require).with('growl').and_return true
|
subject.should_receive(:require).with('growl_notify').and_return true
|
||||||
|
GrowlNotify.should_receive(:application_name).and_return ''
|
||||||
subject.turn_on
|
subject.turn_on
|
||||||
subject.should be_enabled
|
subject.should be_enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Object.send(:remove_const, :GrowlNotify)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "without the Growl library available" do
|
context "without the GrowlNofity library available" do
|
||||||
it "disables the notifications" do
|
it "disables the notifications" do
|
||||||
subject.should_receive(:require).with('growl').and_raise LoadError
|
subject.should_receive(:require).with('growl_notify').and_raise LoadError
|
||||||
subject.turn_on
|
subject.turn_on
|
||||||
subject.should_not be_enabled
|
subject.should_not be_enabled
|
||||||
end
|
end
|
||||||
@ -89,46 +100,54 @@ describe Guard::Notifier do
|
|||||||
before do
|
before do
|
||||||
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'darwin'
|
RbConfig::CONFIG.should_receive(:[]).with('target_os').and_return 'darwin'
|
||||||
subject.stub(:require_growl)
|
subject.stub(:require_growl)
|
||||||
Object.send(:remove_const, :Growl) if defined?(Growl)
|
|
||||||
Growl = Object.new
|
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
context 'with growl_notify gem' do
|
||||||
Object.send(:remove_const, :Growl)
|
before do
|
||||||
end
|
Object.send(:remove_const, :GrowlNotify) if defined?(GrowlNotify)
|
||||||
|
GrowlNotify = Object.new
|
||||||
|
end
|
||||||
|
|
||||||
it "passes the notification to Growl" do
|
after do
|
||||||
Growl.should_receive(:notify).with("great",
|
Object.send(:remove_const, :GrowlNotify)
|
||||||
:title => "Guard",
|
end
|
||||||
: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
|
it "passes the notification to Growl" do
|
||||||
Growl.should_not_receive(:notify)
|
GrowlNotify.should_receive(:send_notification).with(
|
||||||
subject.should_receive(:enabled?).and_return(true, false)
|
:title => "Guard",
|
||||||
subject.notify 'great', :title => 'Guard'
|
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
|
||||||
end
|
:application_name => "Guard",
|
||||||
|
:description => 'great'
|
||||||
|
)
|
||||||
|
subject.notify 'great', :title => 'Guard'
|
||||||
|
end
|
||||||
|
|
||||||
it "allows additional notification options" do
|
it "don't passes the notification to Growl if library is not available" do
|
||||||
Growl.should_receive(:notify).with("great",
|
GrowlNotify.should_not_receive(:send_notification)
|
||||||
:title => "Guard",
|
subject.should_receive(:enabled?).and_return(true, false)
|
||||||
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
|
subject.notify 'great', :title => 'Guard'
|
||||||
:name => "Guard",
|
end
|
||||||
:priority => 1
|
|
||||||
)
|
|
||||||
subject.notify 'great', :title => 'Guard', :priority => 1
|
|
||||||
end
|
|
||||||
|
|
||||||
it "allows to overwrite a default notification option" do
|
it "allows additional notification options" do
|
||||||
Growl.should_receive(:notify).with("great",
|
GrowlNotify.should_receive(:send_notification).with(
|
||||||
:title => "Guard",
|
:title => "Guard",
|
||||||
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
|
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
|
||||||
:name => "Guard-Cucumber"
|
:application_name => "Guard",
|
||||||
)
|
:description => 'great',
|
||||||
subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
|
:priority => 1
|
||||||
|
)
|
||||||
|
subject.notify 'great', :title => 'Guard', :priority => 1
|
||||||
|
end
|
||||||
|
|
||||||
|
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",
|
||||||
|
:description => 'great'
|
||||||
|
)
|
||||||
|
subject.notify 'great', :title => 'Guard', :name => "Guard-Cucumber"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -148,7 +167,8 @@ describe Guard::Notifier do
|
|||||||
Libnotify.should_receive(:show).with(
|
Libnotify.should_receive(:show).with(
|
||||||
:body => "great",
|
:body => "great",
|
||||||
:summary => 'Guard',
|
: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'
|
subject.notify 'great', :title => 'Guard'
|
||||||
end
|
end
|
||||||
@ -164,6 +184,7 @@ describe Guard::Notifier do
|
|||||||
:body => "great",
|
:body => "great",
|
||||||
:summary => 'Guard',
|
: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,
|
||||||
:urgency => :critical
|
:urgency => :critical
|
||||||
)
|
)
|
||||||
subject.notify 'great', :title => 'Guard', :urgency => :critical
|
subject.notify 'great', :title => 'Guard', :urgency => :critical
|
||||||
@ -173,7 +194,8 @@ describe Guard::Notifier do
|
|||||||
Libnotify.should_receive(:show).with(
|
Libnotify.should_receive(:show).with(
|
||||||
:body => "great",
|
:body => "great",
|
||||||
:summary => 'Guard',
|
:summary => 'Guard',
|
||||||
:icon_path => '~/.guard/success.png'
|
:icon_path => '~/.guard/success.png',
|
||||||
|
:transient => true
|
||||||
)
|
)
|
||||||
subject.notify 'great', :title => 'Guard', :icon_path => '~/.guard/success.png'
|
subject.notify 'great', :title => 'Guard', :icon_path => '~/.guard/success.png'
|
||||||
end
|
end
|
||||||
|
@ -8,9 +8,11 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def record_results
|
def record_results
|
||||||
|
noise = %r|\.sw.$| # don't fail specs due to editor swap files, etc.
|
||||||
|
|
||||||
@results = []
|
@results = []
|
||||||
@listener.on_change do |files|
|
@listener.on_change do |files|
|
||||||
@results += files
|
@results += files.reject { |f| f =~ noise }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user