guard 0.9.3 → 0.9.4
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 +14 -3
- data/README.md +8 -0
- data/bin/fsevent_watch_guard +0 -0
- data/lib/guard.rb +27 -6
- data/lib/guard/dsl.rb +1 -1
- data/lib/guard/notifier.rb +11 -3
- data/lib/guard/version.rb +1 -1
- metadata +19 -19
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
+
## 0.9.4 - December 25, 2011
|
2
|
+
|
3
|
+
### Improvement
|
4
|
+
|
5
|
+
- Add the ability to load user defined templates. ([@hawx][])
|
6
|
+
|
7
|
+
### Bug fix
|
8
|
+
|
9
|
+
- Fix guard-rspec notifications by using ENV variable to store Notifier.notifications. ([@thibaudgg][])
|
10
|
+
|
1
11
|
## 0.9.3 - December 23, 2011
|
2
12
|
|
3
|
-
###
|
13
|
+
### Improvement
|
4
14
|
|
5
15
|
- Fix terminal status after interrupting the Readline interactor. ([@Maher4Ever][])
|
6
16
|
|
@@ -13,14 +23,14 @@
|
|
13
23
|
|
14
24
|
## 0.9.1 - December 19, 2011
|
15
25
|
|
16
|
-
### Bug
|
26
|
+
### Bug fixes
|
17
27
|
|
18
28
|
- Fix wrong `--no-vendor` option. ([@netzpirat][])
|
19
29
|
- [#195](https://github.com/guard/guard/issues/195): Empty watch directory prohibit Guard from running. (reported by [@madtrick][], fixed by [@netzpirat][])
|
20
30
|
|
21
31
|
## 0.9.0 - December 19, 2011
|
22
32
|
|
23
|
-
### Bug
|
33
|
+
### Bug fixes
|
24
34
|
|
25
35
|
- [#173](https://github.com/guard/guard/issues/173): Cannot set the watch_all_modifications option. (reported by [@sutherland][], fixed by [@netzpirat][])
|
26
36
|
- Fix `guard init` when a guard name is given. ([@rymai][])
|
@@ -366,6 +376,7 @@
|
|
366
376
|
[@fnichol]: https://github.com/fnichol
|
367
377
|
[@Gazer]: https://github.com/Gazer
|
368
378
|
[@gix]: https://github.com/gix
|
379
|
+
[@hawx]: https://github.com/hawx
|
369
380
|
[@hron]: https://github.com/hron
|
370
381
|
[@hardipe]: https://github.com/hardipe
|
371
382
|
[@hashrocketeer]: https://github.com/hashrocketeer
|
data/README.md
CHANGED
@@ -218,6 +218,13 @@ In addition, the `init` task can be used to append a supplied Guard template fro
|
|
218
218
|
$ guard init <guard-name>
|
219
219
|
```
|
220
220
|
|
221
|
+
You can also define your own templates in `~/.guard/templates/` which can be appended in the same way to your existing
|
222
|
+
`Guardfile`:
|
223
|
+
|
224
|
+
```bash
|
225
|
+
$ guard init <template-name>
|
226
|
+
```
|
227
|
+
|
221
228
|
### Start
|
222
229
|
|
223
230
|
Just launch Guard inside your Ruby or Rails project with:
|
@@ -839,6 +846,7 @@ Pull requests are very welcome! Please try to follow these simple rules if appli
|
|
839
846
|
|
840
847
|
* Please create a topic branch for every separate change you make.
|
841
848
|
* Make sure your patches are well tested. All specs run with `rake spec:portability` must pass.
|
849
|
+
* On OS X you need to compile once rb-fsevent executable with `rake build_mac_exec`.
|
842
850
|
* Update the [Yard](http://yardoc.org/) documentation.
|
843
851
|
* Update the README.
|
844
852
|
* Update the CHANGELOG for noteworthy changes.
|
data/bin/fsevent_watch_guard
CHANGED
Binary file
|
data/lib/guard.rb
CHANGED
@@ -17,6 +17,8 @@ module Guard
|
|
17
17
|
|
18
18
|
# The Guardfile template for `guard init`
|
19
19
|
GUARDFILE_TEMPLATE = File.expand_path('../guard/templates/Guardfile', __FILE__)
|
20
|
+
# The location of user defined templates
|
21
|
+
HOME_TEMPLATES = File.expand_path('~/.guard/templates')
|
20
22
|
|
21
23
|
class << self
|
22
24
|
attr_accessor :options, :interactor, :listener, :lock
|
@@ -26,7 +28,7 @@ module Guard
|
|
26
28
|
#
|
27
29
|
# @see Guard::Guard.init
|
28
30
|
#
|
29
|
-
# @param [String] guard_name the name of the Guard to initialize
|
31
|
+
# @param [String] guard_name the name of the Guard or template to initialize
|
30
32
|
#
|
31
33
|
def initialize_template(guard_name = nil)
|
32
34
|
if !File.exist?('Guardfile')
|
@@ -38,8 +40,24 @@ module Guard
|
|
38
40
|
end
|
39
41
|
|
40
42
|
if guard_name
|
41
|
-
guard_class = ::Guard.get_guard_class(guard_name)
|
42
|
-
guard_class
|
43
|
+
guard_class = ::Guard.get_guard_class(guard_name, true)
|
44
|
+
if guard_class
|
45
|
+
guard_class.init(guard_name)
|
46
|
+
elsif File.exist?(File.join(HOME_TEMPLATES, guard_name))
|
47
|
+
content = File.read('Guardfile')
|
48
|
+
template = File.read(File.join(HOME_TEMPLATES, guard_name))
|
49
|
+
|
50
|
+
File.open('Guardfile', 'wb') do |f|
|
51
|
+
f.puts(content)
|
52
|
+
f.puts("")
|
53
|
+
f.puts(template)
|
54
|
+
end
|
55
|
+
|
56
|
+
::Guard::UI.info "#{ guard_name } template added to Guardfile, feel free to edit it"
|
57
|
+
else
|
58
|
+
const_name = guard_name.downcase.gsub('-', '')
|
59
|
+
UI.error "Could not load 'guard/#{ guard_name.downcase }' or '~/.guard/templates/#{ guard_name.downcase }' or find class Guard::#{ const_name.capitalize }"
|
60
|
+
end
|
43
61
|
end
|
44
62
|
end
|
45
63
|
|
@@ -432,9 +450,10 @@ module Guard
|
|
432
450
|
# * `rspec` will find a class `Guard::RSpec`
|
433
451
|
#
|
434
452
|
# @param [String] name the name of the Guard
|
453
|
+
# @param [Boolean] fail_gracefully whether error messages should not be printed
|
435
454
|
# @return [Class, nil] the loaded class
|
436
455
|
#
|
437
|
-
def get_guard_class(name)
|
456
|
+
def get_guard_class(name, fail_gracefully=false)
|
438
457
|
name = name.to_s
|
439
458
|
try_require = false
|
440
459
|
const_name = name.gsub(/\/(.?)/) { "::#{ $1.upcase }" }.gsub(/(?:^|[_-])(.)/) { $1.upcase }
|
@@ -449,8 +468,10 @@ module Guard
|
|
449
468
|
UI.error "Could not find class Guard::#{ const_name.capitalize }"
|
450
469
|
end
|
451
470
|
rescue LoadError => loadError
|
452
|
-
|
453
|
-
|
471
|
+
unless fail_gracefully
|
472
|
+
UI.error "Could not load 'guard/#{ name.downcase }' or find class Guard::#{ const_name.capitalize }"
|
473
|
+
UI.error loadError.to_s
|
474
|
+
end
|
454
475
|
end
|
455
476
|
end
|
456
477
|
|
data/lib/guard/dsl.rb
CHANGED
@@ -109,7 +109,7 @@ module Guard
|
|
109
109
|
def reevaluate_guardfile
|
110
110
|
::Guard.guards.clear
|
111
111
|
::Guard.reset_groups
|
112
|
-
::Guard::Notifier.
|
112
|
+
::Guard::Notifier.clear_notifications
|
113
113
|
@@options.delete(:guardfile_contents)
|
114
114
|
Dsl.evaluate_guardfile(@@options)
|
115
115
|
msg = 'Guardfile has been re-evaluated.'
|
data/lib/guard/notifier.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
require 'rbconfig'
|
2
4
|
require 'pathname'
|
3
5
|
require 'guard/ui'
|
@@ -53,7 +55,7 @@ module Guard
|
|
53
55
|
# @return [Hash] the notifications
|
54
56
|
#
|
55
57
|
def notifications
|
56
|
-
|
58
|
+
ENV['GUARD_NOTIFICATIONS'] ? YAML::load(ENV['GUARD_NOTIFICATIONS']) : []
|
57
59
|
end
|
58
60
|
|
59
61
|
# Set the available notifications.
|
@@ -61,7 +63,13 @@ module Guard
|
|
61
63
|
# @param [Array<Hash>] notifications the notifications
|
62
64
|
#
|
63
65
|
def notifications=(notifications)
|
64
|
-
|
66
|
+
ENV['GUARD_NOTIFICATIONS'] = YAML::dump(notifications)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Clear available notifications.
|
70
|
+
#
|
71
|
+
def clear_notifications
|
72
|
+
ENV['GUARD_NOTIFICATIONS'] = nil
|
65
73
|
end
|
66
74
|
|
67
75
|
# Turn notifications on. If no notifications are defined
|
@@ -107,7 +115,7 @@ module Guard
|
|
107
115
|
return turn_off if name == :off
|
108
116
|
|
109
117
|
if NOTIFIERS.has_key?(name) && NOTIFIERS[name].available?(silent)
|
110
|
-
notifications << { :name => name, :options => options }
|
118
|
+
self.notifications = notifications << { :name => name, :options => options }
|
111
119
|
true
|
112
120
|
else
|
113
121
|
false
|
data/lib/guard/version.rb
CHANGED
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
|
+
version: 0.9.4
|
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-
|
12
|
+
date: 2011-12-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70180932216960 !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: *
|
24
|
+
version_requirements: *70180932216960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ffi
|
27
|
-
requirement: &
|
27
|
+
requirement: &70180932216500 !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: *
|
35
|
+
version_requirements: *70180932216500
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70180932209560 !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: *
|
46
|
+
version_requirements: *70180932209560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70180932208780 !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: *
|
57
|
+
version_requirements: *70180932208780
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard-rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70180932207640 !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: *
|
68
|
+
version_requirements: *70180932207640
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yard
|
71
|
-
requirement: &
|
71
|
+
requirement: &70180932206640 !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: *
|
79
|
+
version_requirements: *70180932206640
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: redcarpet
|
82
|
-
requirement: &
|
82
|
+
requirement: &70180932206180 !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: *
|
90
|
+
version_requirements: *70180932206180
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: pry
|
93
|
-
requirement: &
|
93
|
+
requirement: &70180932205720 !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: *
|
101
|
+
version_requirements: *70180932205720
|
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
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: 1.3.6
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project: guard
|
206
|
-
rubygems_version: 1.8.
|
206
|
+
rubygems_version: 1.8.12
|
207
207
|
signing_key:
|
208
208
|
specification_version: 3
|
209
209
|
summary: Guard keeps an eye on your file modifications
|