guard 1.8.3 → 2.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -10
  3. data/README.md +54 -33
  4. data/lib/guard.rb +133 -483
  5. data/lib/guard/cli.rb +78 -82
  6. data/lib/guard/commander.rb +121 -0
  7. data/lib/guard/commands/all.rb +1 -1
  8. data/lib/guard/commands/reload.rb +1 -1
  9. data/lib/guard/deprecated_methods.rb +59 -0
  10. data/lib/guard/deprecator.rb +107 -0
  11. data/lib/guard/dsl.rb +143 -329
  12. data/lib/guard/dsl_describer.rb +101 -57
  13. data/lib/guard/group.rb +27 -8
  14. data/lib/guard/guard.rb +25 -150
  15. data/lib/guard/guardfile.rb +35 -85
  16. data/lib/guard/guardfile/evaluator.rb +245 -0
  17. data/lib/guard/guardfile/generator.rb +89 -0
  18. data/lib/guard/interactor.rb +147 -163
  19. data/lib/guard/notifier.rb +83 -137
  20. data/lib/guard/notifiers/base.rb +220 -0
  21. data/lib/guard/notifiers/emacs.rb +39 -37
  22. data/lib/guard/notifiers/file_notifier.rb +29 -25
  23. data/lib/guard/notifiers/gntp.rb +68 -75
  24. data/lib/guard/notifiers/growl.rb +49 -52
  25. data/lib/guard/notifiers/growl_notify.rb +51 -56
  26. data/lib/guard/notifiers/libnotify.rb +41 -48
  27. data/lib/guard/notifiers/notifysend.rb +58 -38
  28. data/lib/guard/notifiers/rb_notifu.rb +54 -54
  29. data/lib/guard/notifiers/terminal_notifier.rb +48 -36
  30. data/lib/guard/notifiers/terminal_title.rb +23 -19
  31. data/lib/guard/notifiers/tmux.rb +110 -93
  32. data/lib/guard/options.rb +21 -0
  33. data/lib/guard/plugin.rb +66 -0
  34. data/lib/guard/plugin/base.rb +178 -0
  35. data/lib/guard/plugin/hooker.rb +123 -0
  36. data/lib/guard/plugin_util.rb +158 -0
  37. data/lib/guard/rake_task.rb +47 -0
  38. data/lib/guard/runner.rb +62 -82
  39. data/lib/guard/setuper.rb +248 -0
  40. data/lib/guard/ui.rb +24 -80
  41. data/lib/guard/ui/colors.rb +60 -0
  42. data/lib/guard/version.rb +1 -2
  43. data/lib/guard/watcher.rb +30 -30
  44. data/man/guard.1 +4 -4
  45. data/man/guard.1.html +6 -4
  46. metadata +25 -11
  47. data/lib/guard/hook.rb +0 -120
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 2.0.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibaud Guillaume-Gentil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-16 00:00:00.000000000 Z
11
+ date: 2013-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: listen
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: 1.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +123,7 @@ files:
123
123
  - images/pending.png
124
124
  - images/success.png
125
125
  - lib/guard/cli.rb
126
+ - lib/guard/commander.rb
126
127
  - lib/guard/commands/all.rb
127
128
  - lib/guard/commands/change.rb
128
129
  - lib/guard/commands/notification.rb
@@ -130,14 +131,18 @@ files:
130
131
  - lib/guard/commands/reload.rb
131
132
  - lib/guard/commands/scope.rb
132
133
  - lib/guard/commands/show.rb
134
+ - lib/guard/deprecated_methods.rb
135
+ - lib/guard/deprecator.rb
133
136
  - lib/guard/dsl.rb
134
137
  - lib/guard/dsl_describer.rb
135
138
  - lib/guard/group.rb
136
139
  - lib/guard/guard.rb
140
+ - lib/guard/guardfile/evaluator.rb
141
+ - lib/guard/guardfile/generator.rb
137
142
  - lib/guard/guardfile.rb
138
- - lib/guard/hook.rb
139
143
  - lib/guard/interactor.rb
140
144
  - lib/guard/notifier.rb
145
+ - lib/guard/notifiers/base.rb
141
146
  - lib/guard/notifiers/emacs.rb
142
147
  - lib/guard/notifiers/file_notifier.rb
143
148
  - lib/guard/notifiers/gntp.rb
@@ -149,8 +154,16 @@ files:
149
154
  - lib/guard/notifiers/terminal_notifier.rb
150
155
  - lib/guard/notifiers/terminal_title.rb
151
156
  - lib/guard/notifiers/tmux.rb
157
+ - lib/guard/options.rb
158
+ - lib/guard/plugin/base.rb
159
+ - lib/guard/plugin/hooker.rb
160
+ - lib/guard/plugin.rb
161
+ - lib/guard/plugin_util.rb
162
+ - lib/guard/rake_task.rb
152
163
  - lib/guard/runner.rb
164
+ - lib/guard/setuper.rb
153
165
  - lib/guard/templates/Guardfile
166
+ - lib/guard/ui/colors.rb
154
167
  - lib/guard/ui.rb
155
168
  - lib/guard/version.rb
156
169
  - lib/guard/watcher.rb
@@ -175,13 +188,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
188
  version: '0'
176
189
  required_rubygems_version: !ruby/object:Gem::Requirement
177
190
  requirements:
178
- - - '>='
191
+ - - '>'
179
192
  - !ruby/object:Gem::Version
180
- version: 1.3.6
193
+ version: 1.3.1
181
194
  requirements: []
182
- rubyforge_project: guard
183
- rubygems_version: 2.1.3
195
+ rubyforge_project:
196
+ rubygems_version: 2.0.7
184
197
  signing_key:
185
198
  specification_version: 4
186
199
  summary: Guard keeps an eye on your file modifications
187
200
  test_files: []
201
+ has_rdoc:
@@ -1,120 +0,0 @@
1
- module Guard
2
-
3
- # Guard has a hook mechanism that allows you to insert callbacks for individual Guard plugins.
4
- # By default, each of the Guard plugin instance methods has a "_begin" and an "_end" hook.
5
- # For example, the Guard::Guard#start method has a :start_begin hook that is runs immediately
6
- # before Guard::Guard#start, and a :start_end hook that runs immediately after Guard::Guard#start.
7
- #
8
- # Read more about [hooks and callbacks on the wiki](https://github.com/guard/guard/wiki/Hooks-and-callbacks).
9
- #
10
- module Hook
11
-
12
- require 'guard/ui'
13
-
14
- # The Hook module gets included.
15
- #
16
- # @param [Class] base the class that includes the module
17
- #
18
- def self.included(base)
19
- base.send :include, InstanceMethods
20
- end
21
-
22
- # Instance methods that gets included in the base class.
23
- #
24
- module InstanceMethods
25
-
26
- # When event is a Symbol, {#hook} will generate a hook name
27
- # by concatenating the method name from where {#hook} is called
28
- # with the given Symbol.
29
- #
30
- # @example Add a hook with a Symbol
31
- #
32
- # def run_all
33
- # hook :foo
34
- # end
35
- #
36
- # Here, when {Guard::Guard#run_all} is called, {#hook} will notify callbacks
37
- # registered for the "run_all_foo" event.
38
- #
39
- # When event is a String, {#hook} will directly turn the String
40
- # into a Symbol.
41
- #
42
- # @example Add a hook with a String
43
- #
44
- # def run_all
45
- # hook "foo_bar"
46
- # end
47
- #
48
- # When {Guard::Guard#run_all} is called, {#hook} will notify callbacks
49
- # registered for the "foo_bar" event.
50
- #
51
- # @param [Symbol, String] event the name of the Guard event
52
- # @param [Array] args the parameters are passed as is to the callbacks registered for the given event.
53
- #
54
- def hook(event, *args)
55
- hook_name = if event.is_a? Symbol
56
- calling_method = caller[0][/`([^']*)'/, 1]
57
- "#{ calling_method }_#{ event }"
58
- else
59
- event
60
- end.to_sym
61
-
62
- ::Guard::UI.debug "Hook :#{ hook_name } executed for #{ self.class }"
63
-
64
- Hook.notify(self.class, hook_name, *args)
65
- end
66
- end
67
-
68
- class << self
69
-
70
- # Get all callbacks.
71
- #
72
- def callbacks
73
- @callbacks ||= Hash.new { |hash, key| hash[key] = [] }
74
- end
75
-
76
- # Add a callback.
77
- #
78
- # @param [Block] listener the listener to notify
79
- # @param [Guard::Guard] guard_class the Guard class to add the callback
80
- # @param [Array<Symbol>] events the events to register
81
- #
82
- def add_callback(listener, guard_class, events)
83
- _events = events.is_a?(Array) ? events : [events]
84
- _events.each do |event|
85
- callbacks[[guard_class, event]] << listener
86
- end
87
- end
88
-
89
- # Checks if a callback has been registered.
90
- #
91
- # @param [Block] listener the listener to notify
92
- # @param [Guard::Guard] guard_class the Guard class to add the callback
93
- # @param [Symbol] event the event to look for
94
- #
95
- def has_callback?(listener, guard_class, event)
96
- callbacks[[guard_class, event]].include?(listener)
97
- end
98
-
99
- # Notify a callback.
100
- #
101
- # @param [Guard::Guard] guard_class the Guard class to add the callback
102
- # @param [Symbol] event the event to trigger
103
- # @param [Array] args the arguments for the listener
104
- #
105
- def notify(guard_class, event, *args)
106
- callbacks[[guard_class, event]].each do |listener|
107
- listener.call(guard_class, event, *args)
108
- end
109
- end
110
-
111
- # Reset all callbacks.
112
- #
113
- def reset_callbacks!
114
- @callbacks = nil
115
- end
116
-
117
- end
118
-
119
- end
120
- end