guard 1.6.2 → 1.7.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 51523e4c27bf70920db3eb0b9311f75c64f3663d
4
+ data.tar.gz: f66ae96be8a6924b54b2019c58ee94ec7ae314f6
5
+ SHA512:
6
+ metadata.gz: e07ed5af1b2625f0afdeb65d3d583843155227b9a7f69297c2b1dc8094c81cc9826b5599b65ea748ddc27b1c33cf35a6bf5f808f83a720e05d7d1c46eb17e5c9
7
+ data.tar.gz: 0b48ae4d660f7d2091ce3e85a5433ec0ad1158ca090832aa6fb1004884620204033d30c82a1deccd65adb9e2b208f55f9dfa4e4b5a11a0a03c0d559799d64bee
@@ -1,3 +1,17 @@
1
+ ## 1.7.0 - 28 March, 2013
2
+
3
+ ### Improvements
4
+
5
+ - [#400][] Drop dependency on `terminal-table` and use `formatador` instead. ([@netzpirat][])
6
+ - Change the current work dir to the `watchdir`. ([@netzpirat][])
7
+ - Add file notifier to write notifications to a configured file. ([@amiel][])
8
+
9
+ ### Bug fixes
10
+
11
+ - [#406][] Avoid spurious 'nil' output from emacs notifier. ([@aspiers][])
12
+ - [#402][] Make stty less noisy under JRuby. ([@pritchie][])
13
+ - [#401][] Fix Pry `history_file` file expansion. ([@martoche][])
14
+
1
15
  ## 1.6.2 - 27 January, 2013
2
16
 
3
17
  ### Improvements
@@ -717,11 +731,16 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
717
731
  [#386]: https://github.com/guard/guard/issues/386
718
732
  [#387]: https://github.com/guard/guard/issues/387
719
733
  [#389]: https://github.com/guard/guard/issues/389
734
+ [#400]: https://github.com/guard/guard/issues/400
735
+ [#401]: https://github.com/guard/guard/issues/401
736
+ [#402]: https://github.com/guard/guard/issues/402
737
+ [#406]: https://github.com/guard/guard/issues/406
720
738
  [@Gazer]: https://github.com/Gazer
721
739
  [@Maher4Ever]: https://github.com/Maher4Ever
722
740
  [@alandipert]: https://github.com/alandipert
723
741
  [@anithri]: https://github.com/anithri
724
742
  [@ashleyconnor]: https://github.com/ashleyconnor
743
+ [@aspiers]: https://github.com/aspiers
725
744
  [@benolee]: https://github.com/benolee
726
745
  [@brainopia]: https://github.com/brainopia
727
746
  [@bronson]: https://github.com/bronson
@@ -761,6 +780,7 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
761
780
  [@limeyd]: https://github.com/limeyd
762
781
  [@madtrick]: https://github.com/madtrick
763
782
  [@maio]: https://github.com/maio
783
+ [@martoche]: https://github.com/martoche
764
784
  [@mattgreen]: https://github.com/mattgreen
765
785
  [@matthijsgroen]: https://github.com/matthijsgroen
766
786
  [@mcmire]: https://github.com/mcmire
@@ -777,6 +797,7 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
777
797
  [@pcreux]: https://github.com/pcreux
778
798
  [@philomory]: https://github.com/philomory
779
799
  [@pirukire]: https://github.com/pirukire
800
+ [@pritchie]: https://github.com/pritchie
780
801
  [@rking]: https://github.com/rking
781
802
  [@rmm5t]: https://github.com/rmm5t
782
803
  [@royvandewater]: https://github.com/royvandewater
data/README.md CHANGED
@@ -1,11 +1,17 @@
1
- Guard [![Gem Version](https://badge.fury.io/rb/guard.png)](http://badge.fury.io/rb/guard) [![Build Status](https://secure.travis-ci.org/guard/guard.png?branch=master)](http://travis-ci.org/guard/guard) [![Dependency Status](https://gemnasium.com/guard/guard.png)](https://gemnasium.com/guard/guard) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/guard/guard)
1
+ Guard [![Gem Version](https://badge.fury.io/rb/guard.png)](http://badge.fury.io/rb/guard) [![Build Status](https://secure.travis-ci.org/guard/guard.png?branch=master)](http://travis-ci.org/guard/guard) [![Dependency Status](https://gemnasium.com/guard/guard.png)](https://gemnasium.com/guard/guard) [![Code Climate](https://codeclimate.com/github/guard/guard.png)](https://codeclimate.com/github/guard/guard) [![Coverage Status](https://coveralls.io/repos/guard/guard/badge.png?branch=master)](https://coveralls.io/r/guard/guard)
2
2
  =====
3
3
 
4
+ <img src="http://img515.imageshack.us/img515/1358/guardicon.png" alt="Guard Icon" align="right" />
4
5
  Guard is a command line tool to easily handle events on file system modifications.
5
6
 
6
7
  This document contains a lot of information, please take your time and read these instructions carefully. If you have
7
- any questions, ask them in our [Google group](http://groups.google.com/group/guard-dev) or on `#guard`
8
- (irc.freenode.net).
8
+ any questions about the Guard usage or want to share some information with the Guard community, please go to one of
9
+ the following places:
10
+
11
+ * [Google+ community](https://plus.google.com/u/1/communities/110022199336250745477)
12
+ * [Google group](http://groups.google.com/group/guard-dev)
13
+ * [StackOverflow](http://stackoverflow.com/questions/tagged/guard)
14
+ * IRC channel `#guard` (irc.freenode.net) for chatting
9
15
 
10
16
  Information on advanced topics like creating your own Guard plugin, programatic use of Guard, hooks and callbacks and
11
17
  more can be found in the [Guard wiki](https://github.com/guard/guard/wiki).
@@ -19,7 +25,7 @@ Features
19
25
  * File system changes handled by our awesome [Listen](https://github.com/guard/listen) gem.
20
26
  * Support for visual system notifications.
21
27
  * Huge eco-system with [more than 150](https://rubygems.org/search?query=guard-) guard plugins.
22
- * Tested against Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of JRuby & Rubinius.
28
+ * Tested against Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, REE and the latest versions of JRuby & Rubinius.
23
29
 
24
30
  Screencast
25
31
  ----------
@@ -259,6 +265,36 @@ You can use nice powerline chars here if you have that configured.
259
265
 
260
266
  You can get the message history by using `Ctrl+b ~` (where `Ctrl+b` is your key to activate TMux).
261
267
 
268
+ ### File
269
+
270
+ * You can also have Guard write notifications to a file. Each notification will
271
+ overwrite the file. This allows other commands to be run based on the status
272
+ of other guard commands.
273
+
274
+ Example:
275
+
276
+ ```ruby
277
+ # Guardfile
278
+ notification :file, path: '.guard_result'
279
+
280
+ guard :shell do
281
+ watch '.guard_result' do
282
+ if File.read('.guard_result').lines.first.strip == 'failed'
283
+ # ...
284
+ end
285
+ end
286
+ end
287
+ ```
288
+
289
+ Configuration:
290
+
291
+ ```ruby
292
+ # Guardfile
293
+ notification :file,
294
+ :path => '.guard_result', # Required, no default
295
+ :format => "result: %s\ntitle: %s\nmessage: %s\n" # Default: "%s\n%s\n%s\n"
296
+ ```
297
+
262
298
  Add Guard plugins
263
299
  -----------------
264
300
 
@@ -468,8 +504,6 @@ You can list the available plugins with the `list` task:
468
504
  ```bash
469
505
  $ guard list
470
506
  +----------+--------------+
471
- | Available Guard plugins |
472
- +----------+--------------+
473
507
  | Plugin | In Guardfile |
474
508
  +----------+--------------+
475
509
  | Compass | ✘ |
@@ -489,11 +523,8 @@ You can show the structure of the groups and their plugins with the `show` task:
489
523
  ```bash
490
524
  $ guard show
491
525
  +---------+--------+-----------------+----------------------------+
492
- | Guardfile structure |
493
- +---------+--------+-----------------+----------------------------+
494
526
  | Group | Plugin | Option | Value |
495
527
  +---------+--------+-----------------+----------------------------+
496
- | Default | | | |
497
528
  | Specs | Rspec | all_after_pass | true |
498
529
  | | | all_on_start | true |
499
530
  | | | cli | "--fail-fast --format doc" |
@@ -501,6 +532,7 @@ $ guard show
501
532
  | | | keep_failed | true |
502
533
  | | | run_all | {} |
503
534
  | | | spec_paths | ["spec"] |
535
+ +---------+--------+-----------------+----------------------------+
504
536
  | Docs | Ronn | | |
505
537
  +---------+--------+-----------------+----------------------------+
506
538
  ```
@@ -878,8 +910,12 @@ File an issue
878
910
 
879
911
  You can report bugs and feature requests to [GitHub Issues](https://github.com/guard/guard/issues).
880
912
 
881
- **Please don't ask question in the issue tracker**, instead ask them in our
882
- [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
913
+ **Please don't ask question in the issue tracker**, instead ask them at one of our other places:
914
+
915
+ * [Google+ community](https://plus.google.com/u/1/communities/110022199336250745477)
916
+ * [Google group](http://groups.google.com/group/guard-dev)
917
+ * [StackOverflow](http://stackoverflow.com/questions/tagged/guard)
918
+ * IRC channel `#guard` (irc.freenode.net) for chatting
883
919
 
884
920
  Try to figure out where the issue belongs to: Is it an issue with Guard itself or with a Guard plugin you're
885
921
  using?
@@ -51,6 +51,8 @@ module Guard
51
51
  @runner = ::Guard::Runner.new
52
52
  @scope = { :plugins => [], :groups => [] }
53
53
 
54
+ Dir.chdir(@watchdir)
55
+
54
56
  if options[:debug]
55
57
  Thread.abort_on_exception = true
56
58
  ::Guard::UI.options[:level] = :debug
@@ -488,14 +490,12 @@ module Guard
488
490
  # => { :plugins => [:rspec], :groups => [:backend] }
489
491
  #
490
492
  def convert_scopes(scopes)
491
- if scopes[:guard]
492
- scopes[:plugins] = [scopes[:guard]]
493
- scopes.delete(:guard)
493
+ if plugin = scopes.delete(:guard)
494
+ scopes[:plugins] = [plugin]
494
495
  end
495
496
 
496
- if scopes[:group]
497
- scopes[:groups] = [scopes[:group]]
498
- scopes.delete(:group)
497
+ if group = scopes.delete(:group)
498
+ scopes[:groups] = [group]
499
499
  end
500
500
 
501
501
  scopes
@@ -124,7 +124,7 @@ module Guard
124
124
  # @see Guard::DslDescriber.list
125
125
  #
126
126
  def list
127
- puts ::Guard::DslDescriber.list(options)
127
+ ::Guard::DslDescriber.list(options)
128
128
  end
129
129
 
130
130
  desc 'version', 'Show the Guard version'
@@ -180,7 +180,7 @@ module Guard
180
180
  # @see Guard::DslDescriber.show
181
181
  #
182
182
  def show
183
- puts ::Guard::DslDescriber.show(options)
183
+ ::Guard::DslDescriber.show(options)
184
184
  end
185
185
 
186
186
  private
@@ -19,7 +19,7 @@ module Guard
19
19
  def process(*entries)
20
20
  scopes, rest = ::Guard::Interactor.convert_scope(entries)
21
21
 
22
- if rest.length == 0
22
+ if rest.empty?
23
23
  ::Guard.run_all scopes
24
24
  else
25
25
  output.puts "Unkown scope #{ rest.join(', ') }"
@@ -8,23 +8,20 @@ module Guard
8
8
  description 'Trigger a file change.'
9
9
 
10
10
  banner <<-BANNER
11
- Usage: change <scope>
11
+ Usage: change <file> <other_file>
12
12
 
13
- Runs the Guard plugin `run_on_changes` action.
14
-
15
- You may want to specify an optional scope to the action,
16
- either the name of a Guard plugin or a plugin group.
13
+ Pass the given files to the Guard plugin `run_on_changes` action.
17
14
  BANNER
18
15
 
19
16
  def process(*entries)
20
- scopes, rest = ::Guard::Interactor.convert_scope(entries)
17
+ scopes, files = ::Guard::Interactor.convert_scope(entries)
21
18
 
22
- if rest.length != 0
19
+ if files.empty?
20
+ output.puts 'Please specify a file.'
21
+ else
23
22
  ::Guard.within_preserved_state do
24
- ::Guard.runner.run_on_changes(rest, [], [])
23
+ ::Guard.runner.run_on_changes(files, [], [])
25
24
  end
26
- else
27
- output.puts 'Please specify a file.'
28
25
  end
29
26
  end
30
27
 
@@ -19,7 +19,7 @@ module Guard
19
19
  def process(*entries)
20
20
  scopes, rest = ::Guard::Interactor.convert_scope(entries)
21
21
 
22
- if rest.length == 0
22
+ if rest.empty?
23
23
  ::Guard.reload scopes
24
24
  else
25
25
  output.puts "Unkown scope #{ rest.join(', ') }"
@@ -16,10 +16,10 @@ module Guard
16
16
  def process(*entries)
17
17
  scope, rest = ::Guard::Interactor.convert_scope(entries)
18
18
 
19
- if rest.length == 0
20
- ::Guard.scope = scope
19
+ if scope[:plugins].empty? && scope[:groups].empty?
20
+ output.puts 'Usage: scope <scope>'
21
21
  else
22
- output.puts "Unkown scope #{ rest.join(', ') }"
22
+ ::Guard.scope = scope
23
23
  end
24
24
  end
25
25
 
@@ -10,13 +10,13 @@ module Guard
10
10
  description 'Show all Guard plugins.'
11
11
 
12
12
  banner <<-BANNER
13
- Usage: show <scope>
13
+ Usage: show
14
14
 
15
15
  Show all defined Guard plugins and their options.
16
16
  BANNER
17
17
 
18
18
  def process
19
- output.puts ::Guard::DslDescriber.show(::Guard.options)
19
+ ::Guard::DslDescriber.show(::Guard.options)
20
20
  end
21
21
  end
22
22
  end
@@ -14,7 +14,7 @@ module Guard
14
14
  require 'guard/dsl'
15
15
  require 'guard/ui'
16
16
 
17
- require 'terminal-table'
17
+ require 'formatador'
18
18
 
19
19
  class << self
20
20
 
@@ -42,10 +42,10 @@ module Guard
42
42
  evaluate_guardfile(options)
43
43
 
44
44
  rows = ::Guard.guard_gem_names.sort.uniq.inject([]) do |rows, name|
45
- rows << [name.capitalize, ::Guard.guards(name) ? '✔' : '✘']
45
+ rows << { :Plugin => name.capitalize, :Guardfile => ::Guard.guards(name) ? '✔' : '✘' }
46
46
  end
47
47
 
48
- Terminal::Table.new(:title => 'Available Guard plugins', :headings => ['Plugin', 'In Guardfile'], :rows => rows)
48
+ Formatador.display_compact_table(rows, [:Plugin, :Guardfile])
49
49
  end
50
50
 
51
51
  # Shows all Guard plugins and their options that are defined in
@@ -57,23 +57,28 @@ module Guard
57
57
  evaluate_guardfile(options)
58
58
 
59
59
  rows = ::Guard.groups.inject([]) do |rows, group|
60
- plugins = ''
61
- options = ''
62
- values = ''
63
-
64
60
  ::Guard.guards({ :group => group.name }).each do |plugin|
65
- plugins << plugin.to_s
66
-
67
- plugin.options.inject({}) { |o, (k, v)| o[k.to_s] = v; o }.sort.each do |name, value|
68
- options << name.to_s << "\n"
69
- values << value.inspect << "\n"
61
+ options = plugin.options.inject({}) { |o, (k, v)| o[k.to_s] = v; o }.sort
62
+
63
+ if options.empty?
64
+ rows << :split
65
+ rows << { :Group => group.to_s, :Plugin => plugin.to_s, :Option => '', :Value => '' }
66
+ else
67
+ options.each_with_index do |(option, value), index|
68
+ if index == 0
69
+ rows << :split
70
+ rows << { :Group => group.to_s, :Plugin => plugin.to_s, :Option => option.to_s, :Value => value.inspect }
71
+ else
72
+ rows << { :Group => '', :Plugin => '', :Option => option.to_s, :Value => value.inspect }
73
+ end
74
+ end
70
75
  end
71
76
  end
72
77
 
73
- rows << [group.to_s, plugins, options, values]
78
+ rows
74
79
  end
75
80
 
76
- Terminal::Table.new(:title => 'Guardfile structure', :headings => %w(Group Plugin Option Value), :rows => rows)
81
+ Formatador.display_compact_table(rows.drop(1), [:Group, :Plugin, :Option, :Value])
77
82
  end
78
83
 
79
84
  end
@@ -87,7 +87,7 @@ module Guard
87
87
 
88
88
  Pry.config.should_load_rc = false
89
89
  Pry.config.should_load_local_rc = false
90
- Pry.config.history.file = self.class.options[:history_file] || HISTORY_FILE
90
+ Pry.config.history.file = File.expand_path(self.class.options[:history_file] || HISTORY_FILE)
91
91
 
92
92
  add_hooks
93
93
 
@@ -114,7 +114,7 @@ module Guard
114
114
 
115
115
  if stty_exists?
116
116
  Pry.config.hooks.add_hook :after_eval, :restore_visibility do
117
- system('stty echo')
117
+ system('stty echo 2>/dev/null')
118
118
  end
119
119
  end
120
120
  end
@@ -199,9 +199,9 @@ module Guard
199
199
  clip = Pry.view_clip(target_self)
200
200
  level = ":#{ nest_level }" unless nest_level.zero?
201
201
  scope = if !::Guard.scope[:plugins].empty?
202
- "{#{ ::Guard.scope[:plugins].join }} "
202
+ "{#{ ::Guard.scope[:plugins].join(',') }} "
203
203
  elsif !::Guard.scope[:groups].empty?
204
- "{#{ ::Guard.scope[:groups].join }} "
204
+ "{#{ ::Guard.scope[:groups].join(',') }} "
205
205
  else
206
206
  ''
207
207
  end
@@ -49,6 +49,7 @@ module Guard
49
49
  require 'guard/notifiers/terminal_notifier'
50
50
  require 'guard/notifiers/terminal_title'
51
51
  require 'guard/notifiers/tmux'
52
+ require 'guard/notifiers/file_notifier'
52
53
 
53
54
  extend self
54
55
 
@@ -66,7 +67,8 @@ module Guard
66
67
  ],
67
68
  [[:emacs, ::Guard::Notifier::Emacs]],
68
69
  [[:tmux, ::Guard::Notifier::Tmux]],
69
- [[:terminal_title, ::Guard::Notifier::TerminalTitle]]
70
+ [[:terminal_title, ::Guard::Notifier::TerminalTitle]],
71
+ [[:file, ::Guard::Notifier::FileNotifier]]
70
72
  ]
71
73
 
72
74
  # Get the available notifications.
@@ -153,7 +155,7 @@ module Guard
153
155
 
154
156
  notifier = get_notifier_module(name)
155
157
 
156
- if notifier && notifier.available?(silent)
158
+ if notifier && notifier.available?(silent, options)
157
159
  self.notifications = notifications << { :name => name, :options => options }
158
160
  true
159
161
  else
@@ -22,10 +22,11 @@ module Guard
22
22
  # Test if Emacs with running server is available.
23
23
  #
24
24
  # @param [Boolean] silent true if no error messages should be shown
25
+ # @param [Hash] options notifier options
25
26
  # @return [Boolean] the availability status
26
27
  #
27
- def available?(silent = false)
28
- result = `#{ DEFAULTS[:client] } --eval '1' 2> #{DEV_NULL} || echo 'N/A'`
28
+ def available?(silent = false, options = {})
29
+ result = `#{ options.fetch(:client, DEFAULTS[:client]) } --eval '1' 2> #{DEV_NULL} || echo 'N/A'`
29
30
 
30
31
  if %w(N/A 'N/A').include?(result.chomp!)
31
32
  false
@@ -52,7 +53,12 @@ module Guard
52
53
  options = DEFAULTS.merge options
53
54
  color = emacs_color type, options
54
55
  fontcolor = emacs_color :fontcolor, options
55
- system(%(#{ options[:client] } --eval "(set-face-attribute 'mode-line nil :background \\"#{ color }\\" :foreground \\"#{ fontcolor }\\")"))
56
+ elisp = <<-EOF.gsub(/\s+/, ' ').strip
57
+ (set-face-attribute 'mode-line nil
58
+ :background "#{color}"
59
+ :foreground "#{fontcolor}")
60
+ EOF
61
+ run_cmd [ options[:client], '--eval', elisp ]
56
62
  end
57
63
 
58
64
  # Get the Emacs color for the notification type.
@@ -70,6 +76,12 @@ module Guard
70
76
  default = options[:default] || DEFAULTS[:default]
71
77
  options.fetch(type.to_sym, default)
72
78
  end
79
+
80
+ private
81
+
82
+ def run_cmd(args)
83
+ IO.popen(args).readlines
84
+ end
73
85
  end
74
86
  end
75
87
  end
@@ -0,0 +1,58 @@
1
+ module Guard
2
+ module Notifier
3
+
4
+ # Writes guard notification results to a file
5
+ #
6
+ # @example Add the `:file` notifier to your `Guardfile`
7
+ # notification :file, path: 'tmp/guard_result'
8
+ #
9
+ module FileNotifier
10
+ extend self
11
+
12
+ # Default options for FileNotifier
13
+ DEFAULTS = {
14
+ :format => "%s\n%s\n%s\n"
15
+ }
16
+
17
+ # Test if the file notification option is available?
18
+ #
19
+ # REVIEW: This could test if there is a path provided in options, but
20
+ # we don't get options in available?.
21
+ #
22
+ # @param [Boolean] silent true if no error messages should be shown
23
+ # @param [Hash] options notifier options
24
+ # @return [Boolean] the availability status
25
+ #
26
+ def available?(silent = false, options = {})
27
+ options.has_key?(:path)
28
+ end
29
+
30
+ # Write the notification to a file. By default it writes type, tytle, and
31
+ # message separated by newlines.
32
+ #
33
+ # @param [String] type the notification type. Either 'success', 'pending', 'failed' or 'notify'
34
+ # @param [String] title the notification title
35
+ # @param [String] message the notification message body
36
+ # @param [String] image the path to the notification image
37
+ # @param [Hash] options additional notification library options
38
+ # @option options [String] format printf style format for file contents
39
+ # @option options [String] path the path of where to write the file
40
+ #
41
+ def notify(type, title, message, image, options = { })
42
+ if options[:path]
43
+ format = options.fetch(:format, DEFAULTS[:format])
44
+
45
+ write(options[:path], format % [type, title, message])
46
+ else
47
+ ::Guard::UI.error ':file notifier requires a :path option'
48
+ end
49
+ end
50
+
51
+ private
52
+ def write(path, contents)
53
+ File.write(path, contents)
54
+ end
55
+ end
56
+
57
+ end
58
+ end
@@ -54,9 +54,10 @@ module Guard
54
54
  # Test if the notification library is available.
55
55
  #
56
56
  # @param [Boolean] silent true if no error messages should be shown
57
+ # @param [Hash] options notifier options
57
58
  # @return [Boolean] the availability status
58
59
  #
59
- def available?(silent = false)
60
+ def available?(silent = false, options = {})
60
61
  if RbConfig::CONFIG['host_os'] =~ /darwin|linux|freebsd|openbsd|sunos|solaris|mswin|mingw|cygwin/
61
62
  require 'ruby_gntp'
62
63
  true
@@ -43,9 +43,10 @@ module Guard
43
43
  # Test if the notification library is available.
44
44
  #
45
45
  # @param [Boolean] silent true if no error messages should be shown
46
+ # @param [Hash] options notifier options
46
47
  # @return [Boolean] the availability status
47
48
  #
48
- def available?(silent = false)
49
+ def available?(silent = false, options = {})
49
50
  if RbConfig::CONFIG['host_os'] =~ /darwin/
50
51
  require 'growl'
51
52
 
@@ -32,9 +32,10 @@ module Guard
32
32
  # Test if the notification library is available.
33
33
  #
34
34
  # @param [Boolean] silent true if no error messages should be shown
35
+ # @param [Hash] options notifier options
35
36
  # @return [Boolean] the availability status
36
37
  #
37
- def available?(silent = false)
38
+ def available?(silent = false, options = {})
38
39
  if RbConfig::CONFIG['host_os'] =~ /darwin/
39
40
  require 'growl_notify'
40
41
 
@@ -33,9 +33,10 @@ module Guard
33
33
  # Test if the notification library is available.
34
34
  #
35
35
  # @param [Boolean] silent true if no error messages should be shown
36
+ # @param [Hash] options notifier options
36
37
  # @return [Boolean] the availability status
37
38
  #
38
- def available?(silent = false)
39
+ def available?(silent = false, options = {})
39
40
  if RbConfig::CONFIG['host_os'] =~ /linux|freebsd|openbsd|sunos|solaris/
40
41
  require 'libnotify'
41
42
 
@@ -25,9 +25,10 @@ module Guard
25
25
  # Test if the notification program is available.
26
26
  #
27
27
  # @param [Boolean] silent true if no error messages should be shown
28
+ # @param [Hash] options notifier options
28
29
  # @return [Boolean] the availability status
29
30
  #
30
- def available?(silent = false)
31
+ def available?(silent = false, options = {})
31
32
  if (RbConfig::CONFIG['host_os'] =~ /linux|freebsd|openbsd|sunos|solaris/) and (not `which notify-send`.empty?)
32
33
  true
33
34
  else
@@ -36,9 +36,10 @@ module Guard
36
36
  # Test if the notification library is available.
37
37
  #
38
38
  # @param [Boolean] silent true if no error messages should be shown
39
+ # @param [Hash] options notifier options
39
40
  # @return [Boolean] the availability status
40
41
  #
41
- def available?(silent = false)
42
+ def available?(silent = false, options = {})
42
43
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
43
44
  require 'rb-notifu'
44
45
 
@@ -25,9 +25,10 @@ module Guard
25
25
  # Test if the notification library is available.
26
26
  #
27
27
  # @param [Boolean] silent true if no error messages should be shown
28
+ # @param [Hash] options notifier options
28
29
  # @return [Boolean] the availability status
29
30
  #
30
- def available?(silent=false)
31
+ def available?(silent = false, options = {})
31
32
  require 'terminal-notifier-guard'
32
33
 
33
34
  if ::TerminalNotifier::Guard.available?
@@ -7,9 +7,10 @@ module Guard
7
7
  # Test if the notification library is available.
8
8
  #
9
9
  # @param [Boolean] silent true if no error messages should be shown
10
+ # @param [Hash] options notifier options
10
11
  # @return [Boolean] the availability status
11
12
  #
12
- def available?(silent = false)
13
+ def available?(silent = false, options = {})
13
14
  true
14
15
  end
15
16
 
@@ -35,10 +35,11 @@ module Guard
35
35
  # Test if currently running in a Tmux session
36
36
  #
37
37
  # @param [Boolean] silent true if no error messages should be shown
38
+ # @param [Hash] options notifier options
38
39
  # @return [Boolean] the availability status
39
40
  #
40
- def available?(silent = false)
41
- if ENV[DEFAULTS[:tmux_environment]].nil?
41
+ def available?(silent = false, options = {})
42
+ if ENV[options.fetch(:tmux_environment, DEFAULTS[:tmux_environment])].nil?
42
43
  ::Guard::UI.error 'The :tmux notifier runs only on when Guard is executed inside of a tmux session.' unless silent
43
44
  false
44
45
  else
@@ -1,4 +1,4 @@
1
1
  module Guard
2
2
  # The current gem version of Guard
3
- VERSION = '1.6.2'
3
+ VERSION = '1.7.0'
4
4
  end
metadata CHANGED
@@ -1,144 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
5
- prerelease:
4
+ version: 1.7.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Thibaud Guillaume-Gentil
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-27 00:00:00.000000000 Z
11
+ date: 2013-03-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: thor
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.14.6
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.14.6
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: listen
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 0.6.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 0.6.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: pry
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 0.9.10
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 0.9.10
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: lumberjack
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: 1.0.2
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: 1.0.2
78
69
  - !ruby/object:Gem::Dependency
79
- name: terminal-table
70
+ name: formatador
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
- version: 1.4.3
75
+ version: 0.2.4
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
- version: 1.4.3
82
+ version: 0.2.4
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: bundler
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: rspec
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ~>
116
102
  - !ruby/object:Gem::Version
117
- version: 2.12.0
103
+ version: 2.13.0
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ~>
124
109
  - !ruby/object:Gem::Version
125
- version: 2.12.0
110
+ version: 2.13.0
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: guard-rspec
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ~>
132
116
  - !ruby/object:Gem::Version
133
- version: 2.4.0
117
+ version: 2.5.0
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ~>
140
123
  - !ruby/object:Gem::Version
141
- version: 2.4.0
124
+ version: 2.5.0
142
125
  description: Guard is a command line tool to easily handle events on file system modifications.
143
126
  email:
144
127
  - thibaud@thibaud.me
@@ -169,6 +152,7 @@ files:
169
152
  - lib/guard/interactor.rb
170
153
  - lib/guard/notifier.rb
171
154
  - lib/guard/notifiers/emacs.rb
155
+ - lib/guard/notifiers/file_notifier.rb
172
156
  - lib/guard/notifiers/gntp.rb
173
157
  - lib/guard/notifiers/growl.rb
174
158
  - lib/guard/notifiers/growl_notify.rb
@@ -182,7 +166,6 @@ files:
182
166
  - lib/guard/templates/Guardfile
183
167
  - lib/guard/ui.rb
184
168
  - lib/guard/version.rb
185
- - lib/guard/version.rbc
186
169
  - lib/guard/watcher.rb
187
170
  - lib/guard.rb
188
171
  - CHANGELOG.md
@@ -192,27 +175,26 @@ files:
192
175
  - README.md
193
176
  homepage: https://github.com/guard/guard
194
177
  licenses: []
178
+ metadata: {}
195
179
  post_install_message:
196
180
  rdoc_options: []
197
181
  require_paths:
198
182
  - lib
199
183
  required_ruby_version: !ruby/object:Gem::Requirement
200
- none: false
201
184
  requirements:
202
- - - ! '>='
185
+ - - '>='
203
186
  - !ruby/object:Gem::Version
204
187
  version: '0'
205
188
  required_rubygems_version: !ruby/object:Gem::Requirement
206
- none: false
207
189
  requirements:
208
- - - ! '>='
190
+ - - '>='
209
191
  - !ruby/object:Gem::Version
210
192
  version: 1.3.6
211
193
  requirements: []
212
194
  rubyforge_project: guard
213
- rubygems_version: 1.8.24
195
+ rubygems_version: 2.0.3
214
196
  signing_key:
215
- specification_version: 3
197
+ specification_version: 4
216
198
  summary: Guard keeps an eye on your file modifications
217
199
  test_files: []
218
200
  has_rdoc:
@@ -1,130 +0,0 @@
1
- !RBIX
2
- 9595534255132031488
3
- x
4
- M
5
- 1
6
- n
7
- n
8
- x
9
- 10
10
- __script__
11
- i
12
- 28
13
- 99
14
- 7
15
- 0
16
- 65
17
- 49
18
- 1
19
- 2
20
- 13
21
- 99
22
- 12
23
- 7
24
- 2
25
- 12
26
- 7
27
- 3
28
- 12
29
- 65
30
- 12
31
- 49
32
- 4
33
- 4
34
- 15
35
- 49
36
- 2
37
- 0
38
- 15
39
- 2
40
- 11
41
- I
42
- 6
43
- I
44
- 0
45
- I
46
- 0
47
- I
48
- 0
49
- n
50
- p
51
- 5
52
- x
53
- 5
54
- Guard
55
- x
56
- 11
57
- open_module
58
- x
59
- 15
60
- __module_init__
61
- M
62
- 1
63
- n
64
- n
65
- x
66
- 5
67
- Guard
68
- i
69
- 12
70
- 5
71
- 66
72
- 65
73
- 7
74
- 0
75
- 7
76
- 1
77
- 64
78
- 49
79
- 2
80
- 2
81
- 11
82
- I
83
- 3
84
- I
85
- 0
86
- I
87
- 0
88
- I
89
- 0
90
- n
91
- p
92
- 3
93
- x
94
- 7
95
- VERSION
96
- s
97
- 5
98
- 1.3.1
99
- x
100
- 9
101
- const_set
102
- p
103
- 3
104
- I
105
- 2
106
- I
107
- 3
108
- I
109
- c
110
- x
111
- 52
112
- /Users/michi/Repositories/guard/lib/guard/version.rb
113
- p
114
- 0
115
- x
116
- 13
117
- attach_method
118
- p
119
- 3
120
- I
121
- 0
122
- I
123
- 1
124
- I
125
- 1c
126
- x
127
- 52
128
- /Users/michi/Repositories/guard/lib/guard/version.rb
129
- p
130
- 0