guard 1.1.0.beta → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +2 -1
- data/README.md +10 -181
- data/lib/guard.rb +2 -2
- data/lib/guard/cli.rb +4 -4
- data/lib/guard/ui.rb +3 -3
- data/lib/guard/version.rb +1 -1
- data/man/guard.1 +1 -1
- data/man/guard.1.html +2 -2
- metadata +4 -4
- data/bin/fsevent_watch_guard +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
## 1.1.0 -
|
1
|
+
## 1.1.0 - 2. June, 2012
|
2
2
|
|
3
3
|
### Improvements
|
4
4
|
|
5
5
|
- Listening is now handled by the [Listen gem](https://github.com/guard/listen).
|
6
|
+
- Replace the `--verbose` option with the `--debug` option.
|
6
7
|
- New `--latency`/`-l` option to overwrite Listen's default latency.
|
7
8
|
- New `--force-polling`/`-p` option to force usage of the Listen polling listener.
|
8
9
|
- `--watch-all-modifications`/`-A` option is removed and is now always on.
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This document contains a lot of information, please take your time and read thes
|
|
7
7
|
any questions, ask them in our [Google group](http://groups.google.com/group/guard-dev) or on `#guard`
|
8
8
|
(irc.freenode.net).
|
9
9
|
|
10
|
-
Before you file an issue, make sure you have read the file an issue section that contains some
|
10
|
+
Before you file an issue, make sure you have read the _[file an issue](#file-an-issue)_ section that contains some
|
11
11
|
important information.
|
12
12
|
|
13
13
|
Features
|
@@ -285,13 +285,14 @@ $ guard -g group_name another_group_name # shortcut
|
|
285
285
|
|
286
286
|
See the Guardfile DSL below for creating groups.
|
287
287
|
|
288
|
-
#### `-
|
288
|
+
#### `-d`/`--debug` option
|
289
289
|
|
290
|
-
Guard can be
|
290
|
+
Guard can display debug information which can be very usefull for plugins
|
291
|
+
developers with:
|
291
292
|
|
292
293
|
```bash
|
293
|
-
$ guard --
|
294
|
-
$ guard -
|
294
|
+
$ guard --debug
|
295
|
+
$ guard -d # shortcut
|
295
296
|
```
|
296
297
|
|
297
298
|
#### `-w`/`--watchdir` option
|
@@ -694,177 +695,6 @@ guard :shell do
|
|
694
695
|
end
|
695
696
|
```
|
696
697
|
|
697
|
-
Advanced Linux system configuration
|
698
|
-
-----------------------------------
|
699
|
-
|
700
|
-
It's not uncommon to encounter a system limit on the number of files you can monitor.
|
701
|
-
For example, Ubuntu Lucid's (64bit) inotify limit is set to 8192.
|
702
|
-
|
703
|
-
You can get your current inotify file watch limit by executing:
|
704
|
-
|
705
|
-
```bash
|
706
|
-
$ cat /proc/sys/fs/inotify/max_user_watches
|
707
|
-
```
|
708
|
-
|
709
|
-
And set a new limit temporary with:
|
710
|
-
|
711
|
-
```bash
|
712
|
-
sudo sysctl fs.inotify.max_user_watches=524288
|
713
|
-
sudo sysctl -p
|
714
|
-
```
|
715
|
-
|
716
|
-
If you like to make your limit permanent, use:
|
717
|
-
|
718
|
-
```bash
|
719
|
-
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
|
720
|
-
sudo sysctl -p
|
721
|
-
```
|
722
|
-
|
723
|
-
You may also need to pay attention to the values of `max_queued_events` and `max_user_instances`.
|
724
|
-
|
725
|
-
Create a Guard
|
726
|
-
--------------
|
727
|
-
|
728
|
-
Creating a new Guard is very easy. For example, to create a Guard named `yoyo` just create a new gem by running `bundle gem guard-yoyo`. Please make your Guard start with `guard-`, so that it can easily be found on RubyGems.
|
729
|
-
|
730
|
-
```bash
|
731
|
-
$ mkdir guard-yoyo
|
732
|
-
$ cd guard-yoyo
|
733
|
-
$ bundle gem guard-yoyo
|
734
|
-
```
|
735
|
-
|
736
|
-
Now extend the project structure to have an initial Guard:
|
737
|
-
|
738
|
-
```bash
|
739
|
-
.travis.yml # bonus point!
|
740
|
-
CHANGELOG.md # bonus point!
|
741
|
-
Gemfile
|
742
|
-
guard-yoyo.gemspec
|
743
|
-
Guardfile
|
744
|
-
lib/
|
745
|
-
guard/
|
746
|
-
yoyo/
|
747
|
-
templates/
|
748
|
-
Guardfile # needed for `guard init <guard-name>`
|
749
|
-
version.rb
|
750
|
-
yoyo.rb
|
751
|
-
test/ # or spec/
|
752
|
-
README.md
|
753
|
-
```
|
754
|
-
|
755
|
-
Your Guard main class `Guard::Yoyo` in `lib/guard/guard-yoyo.rb` must inherit from
|
756
|
-
[Guard::Guard](http://rubydoc.info/github/guard/guard/master/Guard/Guard) and should implement at least the
|
757
|
-
`#run_on_changes` task method. `#run_on_additions`, `#run_on_modifications` and `#run_on_removals` task methods
|
758
|
-
could be use instead of `#run_on_changes` task method for more control about how changes are handled.
|
759
|
-
|
760
|
-
Here is an example scaffold for `lib/guard/yoyo.rb`:
|
761
|
-
|
762
|
-
```ruby
|
763
|
-
require 'guard'
|
764
|
-
require 'guard/guard'
|
765
|
-
|
766
|
-
module Guard
|
767
|
-
class Yoyo < Guard
|
768
|
-
|
769
|
-
# Initialize a Guard.
|
770
|
-
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
|
771
|
-
# @param [Hash] options the custom Guard options
|
772
|
-
def initialize(watchers = [], options = {})
|
773
|
-
super
|
774
|
-
end
|
775
|
-
|
776
|
-
# Call once when Guard starts. Please override initialize method to init stuff.
|
777
|
-
# @raise [:task_has_failed] when start has failed
|
778
|
-
def start
|
779
|
-
end
|
780
|
-
|
781
|
-
# Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
|
782
|
-
# @raise [:task_has_failed] when stop has failed
|
783
|
-
def stop
|
784
|
-
end
|
785
|
-
|
786
|
-
# Called when `reload|r|z + enter` is pressed.
|
787
|
-
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
788
|
-
# @raise [:task_has_failed] when reload has failed
|
789
|
-
def reload
|
790
|
-
end
|
791
|
-
|
792
|
-
# Called when just `enter` is pressed
|
793
|
-
# This method should be principally used for long action like running all specs/tests/...
|
794
|
-
# @raise [:task_has_failed] when run_all has failed
|
795
|
-
def run_all
|
796
|
-
end
|
797
|
-
|
798
|
-
# Default behaviour on file(s) changes that the Guard watches.
|
799
|
-
# @param [Array<String>] paths the changes files or paths
|
800
|
-
# @raise [:task_has_failed] when run_on_change has failed
|
801
|
-
def run_on_changes(paths)
|
802
|
-
end
|
803
|
-
end
|
804
|
-
end
|
805
|
-
```
|
806
|
-
|
807
|
-
Please take a look at the source code of some of the [existing Guards](https://github.com/guard)
|
808
|
-
for more concrete example and inspiration.
|
809
|
-
|
810
|
-
Alternatively, a new Guard can be added inline to a `Guardfile` with this basic structure:
|
811
|
-
|
812
|
-
```ruby
|
813
|
-
require 'guard/guard'
|
814
|
-
|
815
|
-
module ::Guard
|
816
|
-
class InlineGuard < ::Guard::Guard
|
817
|
-
def run_all
|
818
|
-
end
|
819
|
-
|
820
|
-
def run_on_changes(paths)
|
821
|
-
end
|
822
|
-
end
|
823
|
-
end
|
824
|
-
```
|
825
|
-
|
826
|
-
[@avdi](https://github.com/avdi) has a very cool inline Guard example in his blog post
|
827
|
-
[A Guardfile for Redis](http://avdi.org/devblog/2011/06/15/a-guardfile-for-redis).
|
828
|
-
|
829
|
-
Programmatic use of Guard
|
830
|
-
-------------------------
|
831
|
-
|
832
|
-
The Guardfile DSL can also be used in a programmatic fashion by calling
|
833
|
-
[Guard::Dsl.evaluate_guardfile](http://rubydoc.info/github/guard/guard/master/Guard/Dsl#evaluate_guardfile-class_method).
|
834
|
-
|
835
|
-
Available options are as follow:
|
836
|
-
|
837
|
-
* `:guardfile` - The path to a valid `Guardfile`.
|
838
|
-
* `:guardfile_contents` - A string representing the content of a valid `Guardfile`.
|
839
|
-
|
840
|
-
Remember, without any options given, Guard will look for a `Guardfile` in your current directory and if it does not find
|
841
|
-
one, it will look for it in your `$HOME` directory.
|
842
|
-
|
843
|
-
Evaluate a `Guardfile`:
|
844
|
-
|
845
|
-
```ruby
|
846
|
-
require 'guard'
|
847
|
-
|
848
|
-
Guard.setup
|
849
|
-
Guard.start(:guardfile => '/path/to/Guardfile')
|
850
|
-
```
|
851
|
-
|
852
|
-
Evaluate a string as `Guardfile`:
|
853
|
-
|
854
|
-
```ruby
|
855
|
-
require 'guard'
|
856
|
-
|
857
|
-
Guard.setup
|
858
|
-
|
859
|
-
guardfile = <<-EOF
|
860
|
-
guard 'rspec' do
|
861
|
-
watch(%r{^spec/.+_spec\.rb$})
|
862
|
-
end
|
863
|
-
EOF
|
864
|
-
|
865
|
-
Guard.start(:guardfile_contents => guardfile)
|
866
|
-
```
|
867
|
-
|
868
698
|
File an issue
|
869
699
|
-------------
|
870
700
|
|
@@ -879,7 +709,7 @@ using?
|
|
879
709
|
When you file a bug, please try to follow these simple rules if applicable:
|
880
710
|
|
881
711
|
* Make sure you run Guard with `bundle exec` first.
|
882
|
-
* Add
|
712
|
+
* Add debug information to the issue by running Guard with the `--debug` option.
|
883
713
|
* Add your `Guardfile` and `Gemfile` to the issue.
|
884
714
|
* Make sure that the issue is reproducible with your description.
|
885
715
|
|
@@ -895,10 +725,9 @@ Pull requests are very welcome! Please try to follow these simple rules if appli
|
|
895
725
|
|
896
726
|
* Please create a topic branch for every separate change you make.
|
897
727
|
* Make sure your patches are well tested. All specs run with `rake spec:portability` must pass.
|
898
|
-
* On OS X you need to compile once rb-fsevent executable with `rake build_mac_exec`.
|
899
728
|
* Update the [Yard](http://yardoc.org/) documentation.
|
900
|
-
* Update the README.
|
901
|
-
* Update the CHANGELOG for noteworthy changes.
|
729
|
+
* Update the [README](https://github.com/guard/guard/blob/master/README.md).
|
730
|
+
* Update the [CHANGELOG](https://github.com/guard/guard/blob/master/CHANGELOG.md) for noteworthy changes.
|
902
731
|
* Please **do not change** the version number.
|
903
732
|
|
904
733
|
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
@@ -912,7 +741,7 @@ For questions please join us in our [Google group](http://groups.google.com/grou
|
|
912
741
|
|
913
742
|
* [Maher Sallam](https://github.com/Maher4Ever) ([@mahersalam](http://twitter.com/mahersalam))
|
914
743
|
* [Michael Kessler](https://github.com/netzpirat) ([@netzpirat](http://twitter.com/netzpirat), [mksoft.ch](https://mksoft.ch))
|
915
|
-
* [Rémy Coutable](https://github.com/rymai) ([@rymai](http://twitter.com/rymai), [rymai.me](http://rymai.me
|
744
|
+
* [Rémy Coutable](https://github.com/rymai) ([@rymai](http://twitter.com/rymai), [rymai.me](http://rymai.me))
|
916
745
|
* [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](http://twitter.com/thibaudgg), [thibaud.me](http://thibaud.me/))
|
917
746
|
|
918
747
|
### Contributors
|
data/lib/guard.rb
CHANGED
@@ -33,7 +33,7 @@ module Guard
|
|
33
33
|
#
|
34
34
|
# @option options [Boolean] clear if auto clear the UI should be done
|
35
35
|
# @option options [Boolean] notify if system notifications should be shown
|
36
|
-
# @option options [Boolean]
|
36
|
+
# @option options [Boolean] debug if debug output should be shown
|
37
37
|
# @option options [Array<String>] group the list of groups to start
|
38
38
|
# @option options [String] watchdir the director to watch
|
39
39
|
# @option options [String] guardfile the path to the Guardfile
|
@@ -54,7 +54,7 @@ module Guard
|
|
54
54
|
setup_listener
|
55
55
|
setup_signal_traps
|
56
56
|
|
57
|
-
debug_command_execution if @options[:
|
57
|
+
debug_command_execution if @options[:debug]
|
58
58
|
|
59
59
|
Dsl.evaluate_guardfile(options)
|
60
60
|
UI.error 'No guards found in Guardfile, please add at least one.' if @guards.empty?
|
data/lib/guard/cli.rb
CHANGED
@@ -25,11 +25,11 @@ module Guard
|
|
25
25
|
:aliases => '-n',
|
26
26
|
:banner => 'Notifications feature (growl/libnotify)'
|
27
27
|
|
28
|
-
method_option :
|
28
|
+
method_option :debug,
|
29
29
|
:type => :boolean,
|
30
30
|
:default => false,
|
31
|
-
:aliases => '-
|
32
|
-
:banner => 'Show
|
31
|
+
:aliases => '-d',
|
32
|
+
:banner => 'Show debug information'
|
33
33
|
|
34
34
|
method_option :group,
|
35
35
|
:type => :array,
|
@@ -78,7 +78,7 @@ module Guard
|
|
78
78
|
:type => :numeric,
|
79
79
|
:aliases => '-l',
|
80
80
|
:banner => 'Overwrite Listen\'s default latency'
|
81
|
-
|
81
|
+
|
82
82
|
method_option :force_polling,
|
83
83
|
:type => :boolean,
|
84
84
|
:default => false,
|
data/lib/guard/ui.rb
CHANGED
@@ -68,7 +68,7 @@ module Guard
|
|
68
68
|
def debug(message, options = { })
|
69
69
|
unless ENV['GUARD_ENV'] == 'test'
|
70
70
|
reset_line if options[:reset]
|
71
|
-
STDERR.puts color("DEBUG (#{Time.now.strftime('%T')}): ", :yellow) + message if ::Guard.options && ::Guard.options[:
|
71
|
+
STDERR.puts color("DEBUG (#{Time.now.strftime('%T')}): ", :yellow) + message if ::Guard.options && ::Guard.options[:debug]
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -83,7 +83,7 @@ module Guard
|
|
83
83
|
def clear
|
84
84
|
system('clear;') if ::Guard.options[:clear]
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
# Show a scoped action message.
|
88
88
|
#
|
89
89
|
# @param [String] action the action to show
|
@@ -93,7 +93,7 @@ module Guard
|
|
93
93
|
scope_message ||= scopes[:guard]
|
94
94
|
scope_message ||= scopes[:group]
|
95
95
|
scope_message ||= 'all'
|
96
|
-
|
96
|
+
|
97
97
|
info "#{action} #{scope_message}"
|
98
98
|
end
|
99
99
|
|
data/lib/guard/version.rb
CHANGED
data/man/guard.1
CHANGED
@@ -27,7 +27,7 @@ The following options are available:
|
|
27
27
|
\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\.
|
28
28
|
.
|
29
29
|
.P
|
30
|
-
\fB\-
|
30
|
+
\fB\-d\fR, \fB\-\-debug\fR Runs Guard in debug mode\.
|
31
31
|
.
|
32
32
|
.P
|
33
33
|
\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\.
|
data/man/guard.1.html
CHANGED
@@ -97,8 +97,8 @@
|
|
97
97
|
Notifications can be disabled globally by setting a GUARD_NOTIFY environment variable to false.
|
98
98
|
FLAG can be <code>true</code>/<code>false</code> or <code>t</code>/<code>f</code>.</p>
|
99
99
|
|
100
|
-
<p><code>-
|
101
|
-
Runs Guard in
|
100
|
+
<p><code>-d</code>, <code>--debug</code>
|
101
|
+
Runs Guard in debug mode.</p>
|
102
102
|
|
103
103
|
<p><code>-g</code>, <code>--group</code> <var>GROUP1</var> <var>GROUP2</var>...
|
104
104
|
Runs only the groups specified by GROUP1, GROUP2 etc.
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thibaud Guillaume-Gentil
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -147,7 +147,6 @@ executables:
|
|
147
147
|
extensions: []
|
148
148
|
extra_rdoc_files: []
|
149
149
|
files:
|
150
|
-
- bin/fsevent_watch_guard
|
151
150
|
- bin/guard
|
152
151
|
- images/failed.png
|
153
152
|
- images/pending.png
|
@@ -205,3 +204,4 @@ signing_key:
|
|
205
204
|
specification_version: 3
|
206
205
|
summary: Guard keeps an eye on your file modifications
|
207
206
|
test_files: []
|
207
|
+
has_rdoc:
|
data/bin/fsevent_watch_guard
DELETED
Binary file
|