guard 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -4,7 +4,7 @@ Guard is a command line tool to easly handle events on files modifications.
4
4
 
5
5
  == Features
6
6
 
7
- - {FSEvent}[http://en.wikipedia.org/wiki/FSEvents] support on Mac OS X 10.5+ (without RubyCocoa!, {rb-fsevent gem, >= 0.3.2}[https://rubygems.org/gems/rb-fsevent] required)
7
+ - {FSEvent}[http://en.wikipedia.org/wiki/FSEvents] support on Mac OS X 10.5+ (without RubyCocoa!, {rb-fsevent gem, >= 0.3.5}[https://rubygems.org/gems/rb-fsevent] required)
8
8
  - {Inotify}[http://en.wikipedia.org/wiki/Inotify] support on Linux ({rb-inotify gem, >= 0.5.1}[https://rubygems.org/gems/rb-inotify] required)
9
9
  - Polling for others (help us to support more systems)
10
10
  - Super fast change detection (when polling not used)
@@ -39,6 +39,10 @@ Install growl for Growl notification support
39
39
 
40
40
  gem install growl
41
41
 
42
+ And add it to you Gemfile
43
+
44
+ gem 'growl'
45
+
42
46
  === On Linux
43
47
 
44
48
  Install rb-inotify for {inotify}[http://en.wikipedia.org/wiki/Inotify] support
@@ -49,6 +53,10 @@ Install libnotify for libonity notification support
49
53
 
50
54
  gem install libnotify
51
55
 
56
+ And add it to you Gemfile
57
+
58
+ gem 'libnotify'
59
+
52
60
  == Usage
53
61
 
54
62
  Just launch Guard inside your ruby/rails project with:
@@ -76,13 +84,15 @@ Signal handlers are used to interact with Guard:
76
84
  - {guard-minitest}[http://github.com/guard/guard-minitest]
77
85
  - {guard-livereload}[http://github.com/guard/guard-livereload]
78
86
  - {guard-sass}[http://github.com/guard/guard-sass]
87
+ - {guard-compass}[http://github.com/guard/guard-compass]
79
88
  - {guard-shell}[http://github.com/guard/guard-shell]
89
+ - {guard-bundler}[http://github.com/guard/guard-bundler]
90
+ - {guard-passenger}[http://github.com/guard/guard-passenger]
80
91
 
81
92
  guard ideas:
82
93
 
83
94
  - guard-spork
84
95
  - guard-cucumber
85
- - guard-bundler
86
96
  - others ideas?
87
97
 
88
98
  === Add a guard to your Guardfile
@@ -125,7 +135,9 @@ lib/guard/guard-name.rb inherit from guard/guard and should overwrite at least o
125
135
  true
126
136
  end
127
137
 
128
- # Call with Ctrl-C signal (when Guard quit)
138
+ # Call with Ctrl-C signal (when Guard quit).
139
+ # This method must return a true value
140
+ # if everything went well or guard will not stop.
129
141
  def stop
130
142
  true
131
143
  end
data/lib/guard/guard.rb CHANGED
@@ -30,6 +30,7 @@ module Guard
30
30
  true
31
31
  end
32
32
 
33
+ # Retrieve a true value if the instance successfuly stopped
33
34
  def stop
34
35
  true
35
36
  end
@@ -25,8 +25,8 @@ module Guard
25
25
 
26
26
  def self.usable?
27
27
  require 'rb-fsevent'
28
- if !defined?(FSEvent::VERSION) || Gem::Version.new(FSEvent::VERSION) < Gem::Version.new('0.3.3')
29
- UI.info "Please update rb-fsevent (>= 0.3.3)"
28
+ if !defined?(FSEvent::VERSION) || Gem::Version.new(FSEvent::VERSION) < Gem::Version.new('0.3.5')
29
+ UI.info "Please update rb-fsevent (>= 0.3.5)"
30
30
  false
31
31
  else
32
32
  true
@@ -10,6 +10,16 @@ module Guard
10
10
  @latency = 0.5
11
11
  end
12
12
 
13
+ def start
14
+ @stop = false
15
+ watch_change unless watch_change?
16
+ end
17
+
18
+ def stop
19
+ @stop = true
20
+ sleep latency
21
+ end
22
+
13
23
  def on_change(&callback)
14
24
  @callback = callback
15
25
  inotify.watch(Dir.pwd, :recursive, :modify, :create, :delete, :move) do |event|
@@ -20,16 +30,6 @@ module Guard
20
30
  rescue Interrupt
21
31
  end
22
32
 
23
- def start
24
- @stop = false
25
- watch_change unless @watch_change
26
- end
27
-
28
- def stop
29
- @stop = true
30
- sleep latency
31
- end
32
-
33
33
  def self.usable?
34
34
  require 'rb-inotify'
35
35
  if !defined?(INotify::VERSION) || Gem::Version.new(INotify::VERSION.join('.')) < Gem::Version.new('0.5.1')
@@ -43,6 +43,10 @@ module Guard
43
43
  false
44
44
  end
45
45
 
46
+ def watch_change?
47
+ !!@watch_change
48
+ end
49
+
46
50
  private
47
51
 
48
52
  def watch_change
@@ -51,6 +55,7 @@ module Guard
51
55
  if Config::CONFIG['build'] =~ /java/ || IO.select([inotify.to_io], [], [], latency)
52
56
  break if @stop
53
57
 
58
+ sleep latency
54
59
  inotify.process
55
60
  update_last_event
56
61
 
@@ -59,8 +64,6 @@ module Guard
59
64
  callback.call(files)
60
65
  files.clear
61
66
  end
62
-
63
- sleep latency unless @stop
64
67
  end
65
68
  end
66
69
  @watch_change = false
@@ -43,7 +43,7 @@ module Guard
43
43
  require 'growl'
44
44
  true
45
45
  rescue LoadError
46
- UI.info "Please install growl gem for Mac OS X notification support"
46
+ UI.info "Please install growl gem for Mac OS X notification support and add it to your Gemfile"
47
47
  false
48
48
  end
49
49
  end
@@ -53,7 +53,7 @@ module Guard
53
53
  require 'libnotify'
54
54
  true
55
55
  rescue LoadError
56
- UI.info "Please install libnotify gem for Linux notification support"
56
+ UI.info "Please install libnotify gem for Linux notification support and add it to your Gemfile"
57
57
  false
58
58
  end
59
59
  end
data/lib/guard/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Guard
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thibaud Guillaume-Gentil
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-24 00:00:00 +02:00
18
+ date: 2010-10-26 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency