guard 0.9.4 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.10.0 - 1 January, 2012
2
+
3
+ ### Improvement
4
+
5
+ - Improved Readline constraints. ([@netzpirat][])
6
+ - Stop & start all guards on Guardfile reevaluation. ([@thibaudgg][])
7
+
8
+ ### Bug fix
9
+
10
+ - Terminal keep-alive causing ERROR: Unknown command. ([@waldo][])
11
+
1
12
  ## 0.9.4 - December 25, 2011
2
13
 
3
14
  ### Improvement
@@ -413,6 +424,7 @@
413
424
  [@tpope]: https://github.com/tpope
414
425
  [@uk-ar]: https://github.com/uk-ar
415
426
  [@veged]: https://github.com/veged
427
+ [@waldo]: https://github.com/waldo
416
428
  [@wereHamster]: https://github.com/wereHamster
417
429
  [@yannlugrin]: https://github.com/yannlugrin
418
430
  [@zonque]: https://github.com/zonque
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Thibaud Guillaume-Gentil
1
+ Copyright (c) 2009-2012 Thibaud Guillaume-Gentil
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -63,7 +63,8 @@ the time, try the [Rubygems Bundler](https://github.com/mpapis/rubygems-bundler)
63
63
 
64
64
  ### System notifications
65
65
 
66
- You can configure Guard to make use of the following system notification libraries:
66
+ You can configure Guard to make use of the following system notification libraries, but it's strongly recommended
67
+ to use either Ruby GNTP, Libnotify or Notifu:
67
68
 
68
69
  #### Ruby GNTP
69
70
 
@@ -87,31 +88,6 @@ group :development do
87
88
  end
88
89
  ```
89
90
 
90
- #### Growl
91
-
92
- * Runs on Mac OS X
93
- * Supports all [Growl](http://growl.info/) versions
94
-
95
- The [growl](https://rubygems.org/gems/growl) gem is compatible with all versions of Growl and uses a command line tool
96
- [growlnotify](http://growl.info/extras.php#growlnotify) that must be separately downloaded and installed. The version of
97
- the command line tool must match your Growl version. The `growl` gem does **not** support multiple notification
98
- channels.
99
-
100
- You can download an installer for `growlnotify` from the [Growl download section](http://growl.info/downloads) or
101
- install it with HomeBrew:
102
-
103
- ```bash
104
- $ brew install growlnotify
105
- ```
106
-
107
- To use `growl` you have to add it to your `Gemfile` and run bundler:
108
-
109
- ```ruby
110
- group :development do
111
- gem 'growl'
112
- end
113
- ```
114
-
115
91
  #### Libnotify
116
92
 
117
93
  * Runs on Linux, FreeBSD, OpenBSD and Solaris
@@ -144,6 +120,26 @@ group :development do
144
120
  end
145
121
  ```
146
122
 
123
+ #### Growl
124
+
125
+ * Runs on Mac OS X
126
+ * Supports all [Growl](http://growl.info/) versions
127
+
128
+ The [growl](https://rubygems.org/gems/growl) gem is compatible with all versions of Growl and uses a command line tool
129
+ [growlnotify](http://growl.info/extras.php#growlnotify) that must be separately downloaded and installed. The version of
130
+ the command line tool must match your Growl version. The `growl` gem does **not** support multiple notification
131
+ channels.
132
+
133
+ You have to download the installer for `growlnotify` from the [Growl download section](http://growl.info/downloads).
134
+
135
+ To use `growl` you have to add it to your `Gemfile` and run bundler:
136
+
137
+ ```ruby
138
+ group :development do
139
+ gem 'growl'
140
+ end
141
+ ```
142
+
147
143
  #### GrowlNotify
148
144
 
149
145
  * Runs on Mac OS X
data/lib/guard/dsl.rb CHANGED
@@ -107,14 +107,24 @@ module Guard
107
107
  # Re-evaluate the `Guardfile` to update the current Guard configuration.
108
108
  #
109
109
  def reevaluate_guardfile
110
- ::Guard.guards.clear
111
- ::Guard.reset_groups
112
- ::Guard::Notifier.clear_notifications
113
- @@options.delete(:guardfile_contents)
114
- Dsl.evaluate_guardfile(@@options)
115
- msg = 'Guardfile has been re-evaluated.'
116
- UI.info(msg)
117
- Notifier.notify(msg)
110
+ ::Guard.run do
111
+ # Stop each old guards
112
+ ::Guard.run_on_guards do |guard|
113
+ ::Guard.run_supervised_task(guard, :stop)
114
+ end
115
+ ::Guard.guards.clear
116
+ ::Guard.reset_groups
117
+ ::Guard::Notifier.clear_notifications
118
+ @@options.delete(:guardfile_contents)
119
+ Dsl.evaluate_guardfile(@@options)
120
+ msg = 'Guardfile has been re-evaluated.'
121
+ UI.info(msg)
122
+ Notifier.notify(msg)
123
+ # Start each new guards
124
+ ::Guard.run_on_guards do |guard|
125
+ ::Guard.run_supervised_task(guard, :start)
126
+ end
127
+ end
118
128
  end
119
129
 
120
130
  # Evaluate the content of the `Guardfile`.
@@ -79,7 +79,7 @@ module Guard
79
79
  def self.auto_detect
80
80
  require 'readline'
81
81
 
82
- if defined?(RbReadline) || defined?(JRUBY_VERSION) || !RbConfig::CONFIG['target_os'] =~ /darwin/i
82
+ if defined?(RbReadline) || defined?(JRUBY_VERSION) || RbConfig::CONFIG['target_os'] =~ /linux/i
83
83
  ReadlineInteractor.new
84
84
  else
85
85
  SimpleInteractor.new
@@ -15,7 +15,7 @@ module Guard
15
15
  def initialize
16
16
  require 'readline'
17
17
 
18
- unless defined?(RbReadline) || defined?(JRUBY_VERSION)
18
+ unless defined?(RbReadline) || defined?(JRUBY_VERSION) || RbConfig::CONFIG['target_os'] =~ /linux/i
19
19
  ::Guard::UI.info 'Please add rb-readline for proper Readline support.'
20
20
  end
21
21
 
@@ -31,7 +31,7 @@ module Guard
31
31
  # Start the interactor.
32
32
  #
33
33
  def start
34
- store_terminal_settings
34
+ store_terminal_settings if stty_exists?
35
35
  super
36
36
  end
37
37
 
@@ -39,13 +39,14 @@ module Guard
39
39
  #
40
40
  def stop
41
41
  super
42
- restore_terminal_settings
42
+ restore_terminal_settings if stty_exists?
43
43
  end
44
44
 
45
45
  # Read a line from stdin with Readline.
46
46
  #
47
47
  def read_line
48
48
  while line = Readline.readline(prompt, true)
49
+ line.gsub!(/^\W*/, '')
49
50
  if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line
50
51
  Readline::HISTORY.pop
51
52
  end
@@ -84,6 +85,15 @@ module Guard
84
85
 
85
86
  private
86
87
 
88
+ # Detects whether or not the stty command exists
89
+ # on the user machine.
90
+ #
91
+ # @return [Boolean] the status of stty
92
+ #
93
+ def stty_exists?
94
+ system('hash', 'stty')
95
+ end
96
+
87
97
  # Stores the terminal settings so we can resore them
88
98
  # when stopping.
89
99
  #
@@ -9,7 +9,7 @@ module Guard
9
9
  #
10
10
  def read_line
11
11
  while line = $stdin.gets
12
- process_input(line.chomp)
12
+ process_input(line.gsub(/^\W*/, '').chomp)
13
13
  end
14
14
  end
15
15
 
data/lib/guard/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  unless defined? Guard::VERSION
3
3
  # The current gem version of Guard
4
- VERSION = '0.9.4'
4
+ VERSION = '0.10.0'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-25 00:00:00.000000000 Z
12
+ date: 2012-01-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70180932216960 !ruby/object:Gem::Requirement
16
+ requirement: &70103690365860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.14.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70180932216960
24
+ version_requirements: *70103690365860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ffi
27
- requirement: &70180932216500 !ruby/object:Gem::Requirement
27
+ requirement: &70103690365180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.5.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70180932216500
35
+ version_requirements: *70103690365180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70180932209560 !ruby/object:Gem::Requirement
38
+ requirement: &70103690358380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70180932209560
46
+ version_requirements: *70103690358380
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70180932208780 !ruby/object:Gem::Requirement
49
+ requirement: &70103690357140 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.7.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70180932208780
57
+ version_requirements: *70103690357140
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-rspec
60
- requirement: &70180932207640 !ruby/object:Gem::Requirement
60
+ requirement: &70103690356380 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.5.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70180932207640
68
+ version_requirements: *70103690356380
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: yard
71
- requirement: &70180932206640 !ruby/object:Gem::Requirement
71
+ requirement: &70103690355840 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.7.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70180932206640
79
+ version_requirements: *70103690355840
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: redcarpet
82
- requirement: &70180932206180 !ruby/object:Gem::Requirement
82
+ requirement: &70103690355140 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.17.2
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70180932206180
90
+ version_requirements: *70103690355140
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: pry
93
- requirement: &70180932205720 !ruby/object:Gem::Requirement
93
+ requirement: &70103690354660 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: 0.9.6.2
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70180932205720
101
+ version_requirements: *70103690354660
102
102
  description: Guard is a command line tool to easily handle events on file system modifications.
103
103
  email:
104
104
  - thibaud@thibaud.me