sinotify 0.0.2
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/.gitignore +8 -0
- data/History.txt +3 -0
- data/README.rdoc +141 -0
- data/README.txt +141 -0
- data/Rakefile +72 -0
- data/TODO +12 -0
- data/examples/watcher.rb +30 -0
- data/ext/extconf.rb +12 -0
- data/ext/src/inotify-syscalls.h +24 -0
- data/ext/src/inotify.h +113 -0
- data/ext/src/sinotify.c +205 -0
- data/lib/sinotify.rb +18 -0
- data/lib/sinotify/event.rb +185 -0
- data/lib/sinotify/notifier.rb +334 -0
- data/lib/sinotify/prim_event.rb +114 -0
- data/lib/sinotify/watch.rb +21 -0
- data/lib/sinotify_info.rb +47 -0
- data/sinotify.gemspec +80 -0
- data/spec/prim_notify_spec.rb +98 -0
- data/spec/sinotify_spec.rb +265 -0
- data/spec/spec_helper.rb +14 -0
- data/tasks/ann.rake +80 -0
- data/tasks/bones.rake +20 -0
- data/tasks/gem.rake +201 -0
- data/tasks/git.rake +40 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +34 -0
- data/tasks/rdoc.rake +51 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +292 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- data/tasks/zentest.rake +36 -0
- metadata +154 -0
data/tasks/test.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
namespace :test do
|
6
|
+
|
7
|
+
Rake::TestTask.new(:run) do |t|
|
8
|
+
t.libs = PROJ.libs
|
9
|
+
t.test_files = if test(?f, PROJ.test.file) then [PROJ.test.file]
|
10
|
+
else PROJ.test.files end
|
11
|
+
t.ruby_opts += PROJ.ruby_opts
|
12
|
+
t.ruby_opts += PROJ.test.opts
|
13
|
+
end
|
14
|
+
|
15
|
+
if HAVE_RCOV
|
16
|
+
desc 'Run rcov on the unit tests'
|
17
|
+
task :rcov => :clobber_rcov do
|
18
|
+
opts = PROJ.rcov.opts.dup << '-o' << PROJ.rcov.dir
|
19
|
+
opts = opts.join(' ')
|
20
|
+
files = if test(?f, PROJ.test.file) then [PROJ.test.file]
|
21
|
+
else PROJ.test.files end
|
22
|
+
files = files.join(' ')
|
23
|
+
sh "#{RCOV} #{files} #{opts}"
|
24
|
+
end
|
25
|
+
|
26
|
+
task :clobber_rcov do
|
27
|
+
rm_r 'coverage' rescue nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end # namespace :test
|
32
|
+
|
33
|
+
desc 'Alias to test:run'
|
34
|
+
task :test => 'test:run'
|
35
|
+
|
36
|
+
task :clobber => 'test:clobber_rcov' if HAVE_RCOV
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
# EOF
|
data/tasks/zentest.rake
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
if HAVE_ZENTEST
|
2
|
+
|
3
|
+
# --------------------------------------------------------------------------
|
4
|
+
if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
|
5
|
+
require 'autotest'
|
6
|
+
|
7
|
+
namespace :test do
|
8
|
+
task :autotest do
|
9
|
+
Autotest.run
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Run the autotest loop"
|
14
|
+
task :autotest => 'test:autotest'
|
15
|
+
|
16
|
+
end # if test
|
17
|
+
|
18
|
+
# --------------------------------------------------------------------------
|
19
|
+
if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
|
20
|
+
require 'autotest/rspec'
|
21
|
+
|
22
|
+
namespace :spec do
|
23
|
+
task :autotest do
|
24
|
+
load '.autotest' if test(?f, '.autotest')
|
25
|
+
Autotest::Rspec.run
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Run the autotest loop"
|
30
|
+
task :autotest => 'spec:autotest'
|
31
|
+
|
32
|
+
end # if rspec
|
33
|
+
|
34
|
+
end # if HAVE_ZENTEST
|
35
|
+
|
36
|
+
# EOF
|
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sinotify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steven Swerling
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-11 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cosell
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bones
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.5.1
|
34
|
+
version:
|
35
|
+
description: |-
|
36
|
+
ALPHA Alert -- just uploaded initial release.
|
37
|
+
|
38
|
+
Linux inotify is a means to receive events describing file system activity (create, modify, delete, close, etc).
|
39
|
+
|
40
|
+
Sinotify was derived from aredridel's package (http://raa.ruby-lang.org/project/ruby-inotify/), with the addition of
|
41
|
+
Paul Boon's tweak for making the event_check thread more polite (see
|
42
|
+
http://www.mindbucket.com/2009/02/24/ruby-daemons-verifying-good-behavior/)
|
43
|
+
|
44
|
+
In sinotify, the classes Sinotify::PrimNotifier and Sinotify::PrimEvent provide a low level wrapper to inotify, with
|
45
|
+
the ability to establish 'watches' and then listen for inotify events using one of inotify's synchronous event loops,
|
46
|
+
and providing access to the events' masks (see 'man inotify' for details). Sinotify::PrimEvent class adds a little semantic sugar
|
47
|
+
to the event in to the form of 'etypes', which are just ruby symbols that describe the event mask. If the event has a
|
48
|
+
raw mask of (DELETE_SELF & IS_DIR), then the etypes array would be [:delete_self, :is_dir].
|
49
|
+
|
50
|
+
In addition to the 'straight' wrapper in inotify, sinotify provides an asynchronous implementation of the 'observer
|
51
|
+
pattern' for notification. In other words, Sinotify::Notifier listens in the background for inotify events, adapting
|
52
|
+
them into instances of Sinotify::Event as they come in and immediately placing them in a concurrent queue, from which
|
53
|
+
they are 'announced' to 'subscribers' of the event. [Sinotify uses the 'cosell' implementation of the Announcements
|
54
|
+
event notification framework, hence the terminology 'subscribe' and 'announce' rather then 'listen' and 'trigger' used
|
55
|
+
in the standard event observer pattern. See the 'cosell' package on github for details.]
|
56
|
+
|
57
|
+
A variety of 'knobs' are provided for controlling the behavior of the notifier: whether a watch should apply to a
|
58
|
+
single directory or should recurse into subdirectores, how fast it should broadcast queued events, etc (see
|
59
|
+
Sinotify::Notifier, and the example in the synopsis section below). An event 'spy' can also be setup to log all
|
60
|
+
Sinotify::PrimEvents and Sinotify::Events.
|
61
|
+
|
62
|
+
Sinotify::Event simplifies inotify's muddled event model, sending events only for those files/directories that have
|
63
|
+
changed. That's not to say you can't setup a notifier that recurses into subdirectories, just that any individual
|
64
|
+
event will apply to a single file, and not to its children. Also, event types are identified using words (in the form
|
65
|
+
of ruby :symbols) instead of inotify's event masks. See Sinotify::Event for more explanation.
|
66
|
+
|
67
|
+
The README for inotify:
|
68
|
+
|
69
|
+
http://www.kernel.org/pub/linux/kernel/people/rml/inotify/README
|
70
|
+
|
71
|
+
Selected quotes from the README for inotify:
|
72
|
+
|
73
|
+
* "Rumor is that the 'd' in 'dnotify' does not stand for 'directory' but for 'suck.'"
|
74
|
+
|
75
|
+
* "The 'i' in inotify does not stand for 'suck' but for 'inode' -- the logical
|
76
|
+
choice since inotify is inode-based."
|
77
|
+
|
78
|
+
(The 's' in 'sinotify' does in fact stand for 'suck.')
|
79
|
+
email: sswerling@yahoo.com
|
80
|
+
executables: []
|
81
|
+
|
82
|
+
extensions:
|
83
|
+
- ext/extconf.rb
|
84
|
+
extra_rdoc_files:
|
85
|
+
- History.txt
|
86
|
+
- README.txt
|
87
|
+
files:
|
88
|
+
- .gitignore
|
89
|
+
- History.txt
|
90
|
+
- README.rdoc
|
91
|
+
- README.txt
|
92
|
+
- Rakefile
|
93
|
+
- TODO
|
94
|
+
- examples/watcher.rb
|
95
|
+
- ext/extconf.rb
|
96
|
+
- ext/src/inotify-syscalls.h
|
97
|
+
- ext/src/inotify.h
|
98
|
+
- ext/src/sinotify.c
|
99
|
+
- lib/sinotify.rb
|
100
|
+
- lib/sinotify/event.rb
|
101
|
+
- lib/sinotify/notifier.rb
|
102
|
+
- lib/sinotify/prim_event.rb
|
103
|
+
- lib/sinotify/watch.rb
|
104
|
+
- lib/sinotify_info.rb
|
105
|
+
- sinotify.gemspec
|
106
|
+
- spec/prim_notify_spec.rb
|
107
|
+
- spec/sinotify_spec.rb
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- tasks/ann.rake
|
110
|
+
- tasks/bones.rake
|
111
|
+
- tasks/gem.rake
|
112
|
+
- tasks/git.rake
|
113
|
+
- tasks/notes.rake
|
114
|
+
- tasks/post_load.rake
|
115
|
+
- tasks/rdoc.rake
|
116
|
+
- tasks/rubyforge.rake
|
117
|
+
- tasks/setup.rb
|
118
|
+
- tasks/spec.rake
|
119
|
+
- tasks/svn.rake
|
120
|
+
- tasks/test.rake
|
121
|
+
- tasks/zentest.rake
|
122
|
+
has_rdoc: true
|
123
|
+
homepage: http://tab-a.slot-z.net
|
124
|
+
licenses: []
|
125
|
+
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options:
|
128
|
+
- --inline-source
|
129
|
+
- --main
|
130
|
+
- README.txt
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
- ext
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: "0"
|
139
|
+
version:
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: "0"
|
145
|
+
version:
|
146
|
+
requirements: []
|
147
|
+
|
148
|
+
rubyforge_project: sinotify
|
149
|
+
rubygems_version: 1.3.2
|
150
|
+
signing_key:
|
151
|
+
specification_version: 3
|
152
|
+
summary: ALPHA Alert -- just uploaded initial release
|
153
|
+
test_files: []
|
154
|
+
|