rb-fchange 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -3
- data/Rakefile +16 -0
- data/lib/rb-fchange/native/flags.rb +1 -6
- data/lib/rb-fchange/notifier.rb +6 -3
- data/rb-fchange.gemspec +3 -1
- metadata +25 -3
data/README.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
Code is working. But there is still a lot of work.
|
4
4
|
This is a simple wrapper over the Windows Kernel functions for monitoring the specified directory or subtree.
|
5
|
+
Tested on:
|
6
|
+
|
7
|
+
- jruby 1.6.1 (ruby-1.8.7-p330) (2011-04-12 85838f6)
|
8
|
+
- ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-ingw32]
|
9
|
+
- ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
|
5
10
|
|
6
11
|
Example
|
7
12
|
|
@@ -25,8 +30,5 @@ Example
|
|
25
30
|
## TODO
|
26
31
|
|
27
32
|
- add latency setting with 0.5 default
|
28
|
-
- default flag for events :all_events
|
29
33
|
- rework interface (should more look like rb-fsevent)
|
30
|
-
- add specs (can use specs from rb-fsevent)
|
31
34
|
- add none-ANSI path support
|
32
|
-
- add jRuby support
|
data/Rakefile
CHANGED
@@ -1,2 +1,18 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
namespace(:spec) do
|
9
|
+
desc "Run all specs on multiple ruby versions (requires pik)"
|
10
|
+
task(:portability) do
|
11
|
+
%w[187 192 161].each do |version|
|
12
|
+
system("echo -----------#{version}------------")
|
13
|
+
system("pik use #{version}")
|
14
|
+
system("bundle install")
|
15
|
+
system("rake spec")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -48,14 +48,9 @@ module FChange
|
|
48
48
|
FILE_NOTIFY_CHANGE_SECURITY = 0x00000100
|
49
49
|
|
50
50
|
FILE_NOTIFY_CHANGE_ALL_EVENTS = (
|
51
|
-
FILE_NOTIFY_CHANGE_ATTRIBUTES |
|
52
|
-
FILE_NOTIFY_CHANGE_CREATION |
|
53
51
|
FILE_NOTIFY_CHANGE_DIR_NAME |
|
54
52
|
FILE_NOTIFY_CHANGE_FILE_NAME |
|
55
|
-
|
56
|
-
FILE_NOTIFY_CHANGE_LAST_WRITE |
|
57
|
-
FILE_NOTIFY_CHANGE_SECURITY |
|
58
|
-
FILE_NOTIFY_CHANGE_SIZE
|
53
|
+
FILE_NOTIFY_CHANGE_LAST_WRITE
|
59
54
|
)
|
60
55
|
|
61
56
|
# Converts a list of flags to the bitmask that the C API expects.
|
data/lib/rb-fchange/notifier.rb
CHANGED
@@ -76,11 +76,14 @@ module FChange
|
|
76
76
|
# or the flags don't contain any events
|
77
77
|
def watch(path, *flags, &callback)
|
78
78
|
recursive = flags.include?(:recursive)
|
79
|
-
flags.include?(:recursive)
|
80
79
|
#:latency = 0.5
|
81
80
|
flags = flags - [:recursive]
|
82
|
-
|
83
|
-
|
81
|
+
if flags.empty?
|
82
|
+
@flags = [:all_events]
|
83
|
+
else
|
84
|
+
@flags = flags.freeze
|
85
|
+
end
|
86
|
+
Watcher.new(self, path, recursive, *@flags, &callback)
|
84
87
|
end
|
85
88
|
|
86
89
|
# Starts the notifier watching for filesystem events.
|
data/rb-fchange.gemspec
CHANGED
@@ -28,5 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.require_paths = ["lib"]
|
29
29
|
s.rubygems_version = %q{1.3.7}
|
30
30
|
s.summary = %q{A Ruby wrapper for Windows Kernel functions for monitoring the specified directory or subtree}
|
31
|
-
s.add_dependency
|
31
|
+
s.add_dependency 'ffi'
|
32
|
+
s.add_development_dependency 'bundler'
|
33
|
+
s.add_development_dependency 'rspec'
|
32
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb-fchange
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ffi
|
17
|
-
requirement: &
|
17
|
+
requirement: &23882976 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,29 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *23882976
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: bundler
|
28
|
+
requirement: &23882628 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *23882628
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
requirement: &23882364 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *23882364
|
26
48
|
description: A Ruby wrapper for Windows Kernel functions for monitoring the specified
|
27
49
|
directory or subtree
|
28
50
|
email:
|