win32-changenotify 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +70 -66
- data/MANIFEST +11 -11
- data/README +91 -97
- data/Rakefile +26 -17
- data/examples/example_win32_changenotify.rb +36 -35
- data/lib/win32/changenotify.rb +246 -275
- data/lib/win32/changenotify/constants.rb +28 -0
- data/lib/win32/changenotify/functions.rb +60 -0
- data/lib/win32/changenotify/structs.rb +26 -0
- data/test/test_win32_changenotify.rb +93 -70
- data/win32-changenotify.gemspec +28 -28
- metadata +87 -43
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 07c45d703b303035e2b57bdf85bfea1f31b17cea
|
4
|
+
data.tar.gz: a1804830a560e2aa35988900b95394558522fa59
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9915924bc56a91d81437e64cab7bb495297683ee4cb6835c32806a689f7e57f1e705ccbacdc1cc6b657e731ec62d94338a4e243f4c0233b88b7a465d55b20a20
|
7
|
+
data.tar.gz: 871f135bdd7f00971de340600904226f4e5af36c475ee3447401a36d4f8cabf335605c6d67ffa37373f9d54dda955e3a3eecf0ca8ce1eb8b08bcb9e7edf5729c
|
data/CHANGES
CHANGED
@@ -1,66 +1,70 @@
|
|
1
|
-
== 0.
|
2
|
-
*
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
*
|
7
|
-
|
8
|
-
*
|
9
|
-
*
|
10
|
-
|
11
|
-
|
12
|
-
*
|
13
|
-
*
|
14
|
-
|
15
|
-
|
16
|
-
*
|
17
|
-
|
18
|
-
*
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
*
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
*
|
40
|
-
|
41
|
-
|
42
|
-
*
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
*
|
47
|
-
|
48
|
-
|
49
|
-
*
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
* The ChangeNotify
|
54
|
-
|
55
|
-
* Added
|
56
|
-
|
57
|
-
*
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
*
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
1
|
+
== 0.6.0 - 16-Aug-2013
|
2
|
+
* Converted code to FFI.
|
3
|
+
* Updated dependencies in the gemspec, including ffi and win32-event.
|
4
|
+
|
5
|
+
== 0.5.1 - 21-Aug-2009
|
6
|
+
* License changed to Artistic 2.0.
|
7
|
+
* The ChangeNotify#wait method is now slightly more robust.
|
8
|
+
* Renamed test file to test_win32_changenotify.rb.
|
9
|
+
* Some gemspec updates, including license and description.
|
10
|
+
* Renamed example file to example_win32_changenotify.rb to avoid any
|
11
|
+
confusion with actual test files.
|
12
|
+
* Removed the doc/changenotify.txt file because I felt it was redundant.
|
13
|
+
* Added an example rake task.
|
14
|
+
|
15
|
+
== 0.5.0 - 9-Aug-2007
|
16
|
+
* Now pure Ruby!
|
17
|
+
* Now requires the win32-event library.
|
18
|
+
* The constructor now accepts a block. If provided, it yields itself
|
19
|
+
and automatically closes itself when the block terminates.
|
20
|
+
* Removed the ChangeNotify#reset method. It was never especially useful,
|
21
|
+
and now it's useless because of the way we wait for events (see below).
|
22
|
+
* Added a Rakefile with tasks for installation and testing.
|
23
|
+
* The code now uses completion ports internally, which greatly improves the
|
24
|
+
number of simultaneous events it can detect and report. See the 'Known
|
25
|
+
Issues' in the README for details on potential misses, however.
|
26
|
+
* Some internal reorganization, with the C related code now moved into a
|
27
|
+
separate directory.
|
28
|
+
* Doc, test, and example program updates.
|
29
|
+
|
30
|
+
== 0.4.2 - 22-Nov-2006
|
31
|
+
* Fixed bugs caused by changes to the Ruby internals with regards to question
|
32
|
+
marks and instance variables. Thanks go to an anonymous user for the spot.
|
33
|
+
* Minor documentation updates.
|
34
|
+
|
35
|
+
== 0.4.1 - 2-Jan-2006
|
36
|
+
* Code cleanup
|
37
|
+
|
38
|
+
== 0.4.0 - 20-Apr-2005
|
39
|
+
* ChangeNotify#wait now returns an array of ChangeNotifyStruct's, rather than
|
40
|
+
a single struct, because multiple notifications can occur for a single
|
41
|
+
event.
|
42
|
+
* Example program and test suite updates.
|
43
|
+
* Removed the changenotify.rd file.
|
44
|
+
|
45
|
+
== 0.3.1 - 4-Feb-2005
|
46
|
+
* Fixed a bug in ChangeNotify#wait where the timeout was not set to the
|
47
|
+
proper default if a timeout was not specified by the user. Thanks go
|
48
|
+
to CT for the spot.
|
49
|
+
* Made this document rdoc friendly.
|
50
|
+
* Corrected the release date for 0.3.0.
|
51
|
+
|
52
|
+
== 0.3.0 - 25-Jan-2005
|
53
|
+
* The ChangeNotify#wait method now yields a ChangeNotifyStruct if a block is
|
54
|
+
provided. This struct contains more detail on what changes occurred.
|
55
|
+
* Added the ChangeNotify#path, ChangeNotify#recursive? and ChangeNotify#filter
|
56
|
+
methods.
|
57
|
+
* The ChangeNotify.new method no longer accepts a block. See the developer's
|
58
|
+
notes if you want the nitty gritty details.
|
59
|
+
* Added more code to the extconf.rb file. This was needed to set the
|
60
|
+
_WIN32_WINNT macro properly.
|
61
|
+
* Moved the 'examples' directory to the toplevel.
|
62
|
+
* Test suite and documentation updates.
|
63
|
+
|
64
|
+
== 0.2.0 - 17-Jul-2004
|
65
|
+
* Now uses the newer allocation framework. This means that, as of this
|
66
|
+
releas, this package requires Ruby 1.8.0 or later.
|
67
|
+
* Moved the test.rb file to doc/examples.
|
68
|
+
|
69
|
+
== 0.1.0 - 7-May-2004
|
70
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
* CHANGES
|
2
|
-
* README
|
3
|
-
* MANIFEST
|
4
|
-
* Rakefile
|
5
|
-
* win32-changenotify.gemspec
|
6
|
-
* examples/test.rb
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
* lib/win32/changenotify.rb
|
11
|
-
* test/test_win32_changenotify.rb
|
1
|
+
* CHANGES
|
2
|
+
* README
|
3
|
+
* MANIFEST
|
4
|
+
* Rakefile
|
5
|
+
* win32-changenotify.gemspec
|
6
|
+
* examples/test.rb
|
7
|
+
* lib/win32/changenotify.rb
|
8
|
+
* lib/win32/changenotify/constants.rb
|
9
|
+
* lib/win32/changenotify/functions.rb
|
10
|
+
* lib/win32/changenotify/structs.rb
|
11
|
+
* test/test_win32_changenotify.rb
|
data/README
CHANGED
@@ -1,97 +1,91 @@
|
|
1
|
-
= Description
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
= Prerequisites
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
= Synopsis
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
= Notes
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
=
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
=
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
implied warranties, including, without limitation, the implied
|
93
|
-
warranties of merchantability and fitness for a particular purpose.
|
94
|
-
|
95
|
-
= Authors
|
96
|
-
Park Heesob
|
97
|
-
Daniel J. Berger
|
1
|
+
= Description
|
2
|
+
A class for monitoring events related to files and directories. This
|
3
|
+
package is deprecated in favor of win32-changejournal on NTFS filesystems.
|
4
|
+
|
5
|
+
= Prerequisites
|
6
|
+
* ffi
|
7
|
+
* win32-ipc
|
8
|
+
* win32-event
|
9
|
+
|
10
|
+
= Installation
|
11
|
+
gem install win32-changenotify
|
12
|
+
|
13
|
+
= Synopsis
|
14
|
+
require 'win32/changenotify'
|
15
|
+
include Win32
|
16
|
+
|
17
|
+
# Indefinitely wait for a change in 'C:\some\path' and any of its
|
18
|
+
# subdirectories. Print the file and action affected.
|
19
|
+
|
20
|
+
filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME
|
21
|
+
path = 'C:\some\path'
|
22
|
+
|
23
|
+
cn = ChangeNotify.new(path, true, filter)
|
24
|
+
|
25
|
+
cn.wait{ |arr|
|
26
|
+
arr.each{ |info|
|
27
|
+
p info.file_name
|
28
|
+
p info.action
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
cn.close
|
33
|
+
|
34
|
+
# OR
|
35
|
+
|
36
|
+
ChangeNotify.new(path, true, filter) do |events|
|
37
|
+
events.each{ |event|
|
38
|
+
p event.file_name
|
39
|
+
p event.action
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
= Notes
|
44
|
+
The Win32::ChangeNotify class is a subclass of Win32::Ipc, and thus has
|
45
|
+
all of its methods available as well.
|
46
|
+
|
47
|
+
This library is deprecated in favor of win32-changejournal on NTFS
|
48
|
+
filesystems.
|
49
|
+
|
50
|
+
= Known Issues
|
51
|
+
Despite the improvements yielded as a result of using completion ports,
|
52
|
+
it's still possible that events could be missed. To be more precise,
|
53
|
+
any events that occur in the fraction of a second between the call to
|
54
|
+
GetQueuedCompletionStatus() and ReadDirectoryChangesW() in the wait loop
|
55
|
+
will not get picked up. As a general rule, the faster your system is,
|
56
|
+
the less likely you are to encounter this scenario.
|
57
|
+
|
58
|
+
With Ruby 2.x and JRuby this should be even less of an issue than it's
|
59
|
+
been in the past.
|
60
|
+
|
61
|
+
= Acknowledgements
|
62
|
+
This class was originally based on the Win32::ChangeNotify Perl module by
|
63
|
+
Christopher Madsen.
|
64
|
+
|
65
|
+
= Future Plans
|
66
|
+
Probably none. This library is deprecated in favor of win32-changejournal.
|
67
|
+
However, that library only works on NTFS filesystems, so this library will
|
68
|
+
be maintained as well.
|
69
|
+
|
70
|
+
That being said, I'm always open to improvements, so feel free to submit
|
71
|
+
ideas and patches.
|
72
|
+
|
73
|
+
= Known Bugs
|
74
|
+
None that I know of. Please report any issues on the project page at:
|
75
|
+
|
76
|
+
http://www.github.com/djberg96/win32-changenotify
|
77
|
+
|
78
|
+
= License
|
79
|
+
Artistic 2.0
|
80
|
+
|
81
|
+
= Copyright
|
82
|
+
(C) 2003-2013 Daniel J. Berger, All Rights Reserved
|
83
|
+
|
84
|
+
= Warranty
|
85
|
+
This package is provided "as is" and without any express or
|
86
|
+
implied warranties, including, without limitation, the implied
|
87
|
+
warranties of merchantability and fitness for a particular purpose.
|
88
|
+
|
89
|
+
= Authors
|
90
|
+
Park Heesob
|
91
|
+
Daniel J. Berger
|
data/Rakefile
CHANGED
@@ -1,30 +1,39 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
+
require 'rake/clean'
|
3
4
|
require 'rbconfig'
|
4
|
-
include
|
5
|
+
include RbConfig
|
5
6
|
|
6
|
-
|
7
|
-
task :install do
|
8
|
-
sitelibdir = CONFIG['sitelibdir']
|
9
|
-
installdir = File.join(sitelibdir, 'win32')
|
10
|
-
file = 'lib\win32\changenotify.rb'
|
7
|
+
CLEAN.include("**/*.gem")
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
namespace :gem do
|
10
|
+
desc 'Create the win32-changenotify gem'
|
11
|
+
task :create => [:clean] do
|
12
|
+
spec = eval(IO.read('win32-changenotify.gemspec'))
|
13
|
+
if Gem::VERSION.to_f >= 2.0
|
14
|
+
require 'rubygems/package'
|
15
|
+
Gem::Package.build(spec)
|
16
|
+
else
|
17
|
+
Gem::Builder.new(spec).build
|
18
|
+
end
|
19
|
+
end
|
15
20
|
|
16
|
-
desc 'Install the win32-changenotify
|
17
|
-
task :
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
+
desc 'Install the win32-changenotify gem'
|
22
|
+
task :install => [:create] do
|
23
|
+
ruby 'win32-changenotify.gemspec'
|
24
|
+
file = Dir["*.gem"].first
|
25
|
+
sh "gem install #{file}"
|
26
|
+
end
|
21
27
|
end
|
22
28
|
|
23
29
|
desc 'Run the example program'
|
24
30
|
task :example do
|
25
|
-
|
31
|
+
ruby '-Ilib examples/example_win32_changenotify.rb'
|
32
|
+
end
|
26
33
|
|
27
34
|
Rake::TestTask.new do |t|
|
28
|
-
|
29
|
-
|
35
|
+
t.verbose = true
|
36
|
+
t.warning = true
|
30
37
|
end
|
38
|
+
|
39
|
+
task :default => :test
|
@@ -1,35 +1,36 @@
|
|
1
|
-
#######################################################################
|
2
|
-
# example_win32_changenotify.rb
|
3
|
-
#
|
4
|
-
# An example script for general futzing and demonstration. You can
|
5
|
-
# run this program via the 'rake example' task.
|
6
|
-
#
|
7
|
-
# Modify as you see fit.
|
8
|
-
#######################################################################
|
9
|
-
require 'win32/changenotify'
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
flags
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
1
|
+
#######################################################################
|
2
|
+
# example_win32_changenotify.rb
|
3
|
+
#
|
4
|
+
# An example script for general futzing and demonstration. You can
|
5
|
+
# run this program via the 'rake example' task.
|
6
|
+
#
|
7
|
+
# Modify as you see fit.
|
8
|
+
#######################################################################
|
9
|
+
require 'win32/changenotify'
|
10
|
+
include Win32
|
11
|
+
|
12
|
+
puts "VERSION: " + ChangeNotify::VERSION
|
13
|
+
sec = 10
|
14
|
+
dir = "C:\\Users"
|
15
|
+
|
16
|
+
puts "This will timeout after #{sec} seconds of inactivity on #{dir}."
|
17
|
+
|
18
|
+
flags = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME
|
19
|
+
flags |= ChangeNotify::LAST_WRITE
|
20
|
+
|
21
|
+
cn = ChangeNotify.new(dir, true, flags)
|
22
|
+
|
23
|
+
# Wait up to 'sec' seconds for something to happen
|
24
|
+
begin
|
25
|
+
cn.wait(sec) do |events|
|
26
|
+
events.each { |event|
|
27
|
+
puts "Something changed"
|
28
|
+
puts "File: " + event.file_name
|
29
|
+
puts "Action: " + event.action
|
30
|
+
}
|
31
|
+
end
|
32
|
+
rescue
|
33
|
+
cn.close
|
34
|
+
end
|
35
|
+
|
36
|
+
puts "ChangeNotify example program done"
|