dirwatch 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f14d579346fda1ee2da50afb3ad9dcd9911f7c69
4
- data.tar.gz: f4ae3791e9097b4bd78a6406b255f0d43b760b17
3
+ metadata.gz: 839c8fc639962596a0533b78921a3de363c0c7a9
4
+ data.tar.gz: 7471888ddf3f437b68ad7f2e5ff0f3921d0ea614
5
5
  SHA512:
6
- metadata.gz: bdb7c3585a99ae454502bbc4180a9191deebc7568e797d18cf2fcfe31a71ac00714f67dd4cd4fb821ead079d21a8cfe12a129a6b29d72ed5212a996835aeb825
7
- data.tar.gz: 6ad86b0f9621389a248d2ea8aa2d4c57a4a34e42ced3da18319f47245baf7803bfe9bb81f6d2fb1d73dde7845feaa6a240b5c81eb62fc6799cd262d3d111d508
6
+ metadata.gz: 5d7b4a0af9c358adf72fe4e63013e917c46a38367d7de275221409f48639f6bec267947a406ecc2df6d094e157c9eb3376ae1c9af7281a5bcead2051026d921c
7
+ data.tar.gz: 5237b8d00a9cc66a97275dbbf7aeddb9f3935819e9e48e7e2faddc392b9a42e30eb089636497715c795856001034c0862958b8f7953bfbf95c6e4a2f065e8068
@@ -17,16 +17,20 @@ module Dirwatch
17
17
 
18
18
  watcher = Watcher.new options
19
19
  watcher.start
20
+ puts "Watching files..."
20
21
 
21
22
  begin
22
23
  watcher.wait_for_stop
23
24
  rescue Interrupt
24
- exit
25
+ interrupted
25
26
  ensure
26
27
  stop_watcher watcher
27
28
  end
28
29
  end
29
30
 
31
+ def interrupted
32
+ end
33
+
30
34
  def stop_watcher watcher
31
35
  watcher.stop
32
36
  end
@@ -60,5 +64,9 @@ module Dirwatch
60
64
  puts 'shutting down...'
61
65
  super
62
66
  end
67
+
68
+ def interuppted
69
+ exit 0
70
+ end
63
71
  end
64
72
  end
@@ -52,6 +52,7 @@ module Dirwatch
52
52
  end
53
53
 
54
54
  add_alternatives opts, @alternatives
55
+ add_version opts
55
56
  end
56
57
  end
57
58
 
@@ -62,6 +63,12 @@ module Dirwatch
62
63
  alternatives.each {|a| opts.separator " #{a}" }
63
64
  end
64
65
 
66
+ def add_version opts
67
+ require 'dirwatch/version'
68
+ opts.separator ''
69
+ opts.separator "Version: #{::Dirwatch::VERSION}"
70
+ end
71
+
65
72
  def limit_number_of_args limit, args
66
73
  return if args.size <= limit
67
74
  $stderr.puts "Unknown arguments: #{args.map(&:inspect).join(', ')}"
@@ -45,8 +45,12 @@ module Dirwatch
45
45
  }
46
46
  end
47
47
 
48
+ def inspect
49
+ "#<#{self.class} #{key}: #{to_s}>"
50
+ end
51
+
48
52
  def to_s
49
- "#<#{self.class} #{key}: #{to_h.map {|k, v| "#{k}=#{v.inspect}" }.join ' '}>"
53
+ to_h.map {|k, v| "#{k}=#{v.inspect}" }.join ' '
50
54
  end
51
55
 
52
56
  private
@@ -1,3 +1,3 @@
1
1
  module Dirwatch
2
- VERSION = Gem::Version.new '0.0.5'
2
+ VERSION = Gem::Version.new '0.0.6'
3
3
  end
@@ -21,7 +21,9 @@ module Dirwatch
21
21
 
22
22
  Thread.abort_on_exception = true
23
23
  @settings.by_interval do |interval, watch_settings|
24
- watch_settings.each {|ws| puts "Watching #{ws}" }
24
+ if @options.verbose
25
+ watch_settings.each {|ws| puts "Watching #{ws}" }
26
+ end
25
27
  @threads << Thread.new do
26
28
  run interval, watch_settings
27
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dirwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Ganz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-04 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec