filewatch 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. data/lib/inotify/fd.rb +34 -3
  2. metadata +14 -3
@@ -47,6 +47,9 @@ class Inotify::FD
47
47
 
48
48
  attr_reader :fd
49
49
 
50
+ # Create a new Inotify::FD instance.
51
+ # This is the main interface you want to use for watching
52
+ # files, directories, etc.
50
53
  public
51
54
  def initialize
52
55
  @watches = {}
@@ -61,7 +64,8 @@ class Inotify::FD
61
64
  end
62
65
  end
63
66
 
64
- public
67
+ # Are we using java?
68
+ private
65
69
  def java?
66
70
  return RUBY_PLATFORM == "java"
67
71
  end
@@ -70,8 +74,33 @@ class Inotify::FD
70
74
  # - path is a string file path
71
75
  # - what_to_watch is any of the valid WATCH_BITS keys
72
76
  #
77
+ # Possible values for what_to_watch:
78
+ # (See also the inotify(7) manpage under 'inotify events'
79
+ #
80
+ # :access - file was accesssed (a read)
81
+ # :attrib - permissions, timestamps, link count, owner, etc changed
82
+ # :close_nowrite - a file not opened for writing was closed
83
+ # :close_write - a file opened for writing was closed
84
+ # :create - file/directory was created, only valid on watched directories
85
+ # :delete - file/directory was deleted, only valid on watched directories
86
+ # :delete_self - a watched file or directory was deleted
87
+ # :modify - A watched file was modified
88
+ # :moved_from - A file was moved out of a watched directory
89
+ # :moved_to - A file was moved into a watched directory
90
+ # :move_self - A watched file/directory was moved
91
+ # :open - A file was opened
92
+ # # Shortcuts
93
+ # :close - close_nowrite or close_write
94
+ # :move - move_self or moved_from or moved_to
95
+ # :delete - delete or delete_self
96
+ #
97
+ # (Some of the above data copied from the inotify(7) manpage, which comes from
98
+ # the linux man-pages project. http://www.kernel.org/doc/man-pages/ )
99
+ #
73
100
  # Example:
74
- # watch("/tmp", :craete, :delete)
101
+ # fd = Inotify::FD.new
102
+ # fd.watch("/tmp", :create, :delete)
103
+ # fd.watch("/var/log/messages", :modify)
75
104
  public
76
105
  def watch(path, *what_to_watch)
77
106
  mask = what_to_watch.inject(0) { |m, val| m |= WATCH_BITS[val] }
@@ -146,12 +175,14 @@ class Inotify::FD
146
175
 
147
176
  # Get one inotify event.
148
177
  #
178
+ # TIMEOUT NOT SUPPORTED YET;
179
+ #
149
180
  # If timeout is not given, this call blocks.
150
181
  # If a timeout occurs and no event was read, nil is returned.
151
182
  #
152
183
  # Returns nil on timeout or an Inotify::Event on success.
153
184
  public
154
- def get(timeout=nil)
185
+ def get(timeout_not_supported_yet=nil)
155
186
  # This big 'loop' is to support pop { |event| ... } shipping each available event.
156
187
  # It's not very rubyish (we should probably use Enumerable and such.
157
188
  if java?
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filewatch
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease:
5
- version: 0.0.2
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
6
11
  platform: ruby
7
12
  authors:
8
13
  - Jordan Sissel
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-03-06 00:00:00 -08:00
18
+ date: 2011-03-07 00:00:00 -08:00
14
19
  default_executable:
15
20
  dependencies: []
16
21
 
@@ -43,17 +48,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
43
48
  requirements:
44
49
  - - ">="
45
50
  - !ruby/object:Gem::Version
51
+ hash: 3
52
+ segments:
53
+ - 0
46
54
  version: "0"
47
55
  required_rubygems_version: !ruby/object:Gem::Requirement
48
56
  none: false
49
57
  requirements:
50
58
  - - ">="
51
59
  - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
52
63
  version: "0"
53
64
  requirements: []
54
65
 
55
66
  rubyforge_project:
56
- rubygems_version: 1.6.0
67
+ rubygems_version: 1.5.1
57
68
  signing_key:
58
69
  specification_version: 3
59
70
  summary: filewatch - file watching for ruby