fssm 0.2.4 → 0.2.5
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 +11 -0
- data/Gemfile +3 -0
- data/LICENSE +1 -1
- data/Rakefile +3 -51
- data/fssm.gemspec +17 -73
- data/lib/fssm.rb +3 -2
- data/lib/fssm/backends/fsevents.rb +1 -1
- data/lib/fssm/backends/inotify.rb +1 -1
- data/lib/fssm/backends/polling.rb +2 -2
- data/lib/fssm/backends/rubycocoa/fsevents.rb +10 -10
- data/lib/fssm/path.rb +4 -5
- data/lib/fssm/pathname.rb +6 -6
- data/lib/fssm/state/directory.rb +6 -5
- data/lib/fssm/support.rb +14 -14
- data/lib/fssm/tree.rb +6 -6
- data/lib/fssm/version.rb +3 -0
- data/spec/monitor_spec.rb +16 -16
- data/spec/spec_helper.rb +1 -0
- metadata +23 -14
- data/.document +0 -5
- data/VERSION.yml +0 -5
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -1,59 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "fssm"
|
8
|
-
gem.summary = %Q{file system state monitor}
|
9
|
-
gem.description = %Q{file system state monitor}
|
10
|
-
gem.email = "ttilley@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/ttilley/fssm"
|
12
|
-
gem.authors = ["Travis Tilley"]
|
13
|
-
gem.add_development_dependency "rspec"
|
14
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
-
end
|
16
|
-
rescue LoadError
|
17
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
19
3
|
|
20
4
|
require 'spec/rake/spectask'
|
21
5
|
Spec::Rake::SpecTask.new(:spec) do |spec|
|
22
6
|
spec.libs << 'lib' << 'spec'
|
23
7
|
spec.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
-
|
25
|
-
|
26
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
27
|
-
spec.libs << 'lib' << 'spec'
|
28
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
29
|
-
spec.rcov = true
|
30
|
-
end
|
31
|
-
|
32
|
-
task :spec => :check_dependencies
|
33
|
-
|
34
|
-
begin
|
35
|
-
require 'reek/rake_task'
|
36
|
-
Reek::RakeTask.new do |t|
|
37
|
-
t.fail_on_error = true
|
38
|
-
t.verbose = false
|
39
|
-
t.source_files = 'lib/**/*.rb'
|
40
|
-
end
|
41
|
-
rescue LoadError
|
42
|
-
task :reek do
|
43
|
-
abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
begin
|
48
|
-
require 'roodi'
|
49
|
-
require 'roodi_task'
|
50
|
-
RoodiTask.new do |t|
|
51
|
-
t.verbose = false
|
52
|
-
end
|
53
|
-
rescue LoadError
|
54
|
-
task :roodi do
|
55
|
-
abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
|
56
|
-
end
|
8
|
+
spec.spec_opts = ['--format', 'specdoc']
|
57
9
|
end
|
58
10
|
|
59
11
|
task :default => :spec
|
data/fssm.gemspec
CHANGED
@@ -1,80 +1,24 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "fssm/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
6
|
+
s.name = "fssm"
|
7
|
+
s.version = FSSM::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Travis Tilley", "Nathan Weizenbaum", "Chris Eppstein",
|
10
|
+
"Jonathan Castello", "Tuomas Kareinen"]
|
11
|
+
s.email = ["ttilley@gmail.com"]
|
12
|
+
s.homepage = "https://github.com/ttilley/fssm"
|
13
|
+
s.summary = %q{File System State Monitor}
|
14
|
+
s.description = %q{The File System State Monitor keeps track of the state of any number of paths and will fire events when said state changes (create/update/delete). FSSM supports using FSEvents on MacOS, Inotify on GNU/Linux, and polling anywhere else.}
|
9
15
|
|
10
|
-
s.
|
11
|
-
s.authors = ["Travis Tilley"]
|
12
|
-
s.date = %q{2011-01-15}
|
13
|
-
s.description = %q{file system state monitor}
|
14
|
-
s.email = %q{ttilley@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.markdown"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"LICENSE",
|
22
|
-
"README.markdown",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION.yml",
|
25
|
-
"example.rb",
|
26
|
-
"fssm.gemspec",
|
27
|
-
"lib/fssm.rb",
|
28
|
-
"lib/fssm/backends/fsevents.rb",
|
29
|
-
"lib/fssm/backends/inotify.rb",
|
30
|
-
"lib/fssm/backends/polling.rb",
|
31
|
-
"lib/fssm/backends/rbfsevent.rb",
|
32
|
-
"lib/fssm/backends/rubycocoa/fsevents.rb",
|
33
|
-
"lib/fssm/monitor.rb",
|
34
|
-
"lib/fssm/path.rb",
|
35
|
-
"lib/fssm/pathname.rb",
|
36
|
-
"lib/fssm/state/directory.rb",
|
37
|
-
"lib/fssm/state/file.rb",
|
38
|
-
"lib/fssm/support.rb",
|
39
|
-
"lib/fssm/tree.rb",
|
40
|
-
"profile/prof-cache.rb",
|
41
|
-
"profile/prof-fssm-pathname.html",
|
42
|
-
"profile/prof-pathname-rubinius.rb",
|
43
|
-
"profile/prof-pathname.rb",
|
44
|
-
"profile/prof-plain-pathname.html",
|
45
|
-
"profile/prof.html",
|
46
|
-
"spec/count_down_latch.rb",
|
47
|
-
"spec/monitor_spec.rb",
|
48
|
-
"spec/path_spec.rb",
|
49
|
-
"spec/root/duck/quack.txt",
|
50
|
-
"spec/root/file.css",
|
51
|
-
"spec/root/file.rb",
|
52
|
-
"spec/root/file.yml",
|
53
|
-
"spec/root/moo/cow.txt",
|
54
|
-
"spec/spec_helper.rb"
|
55
|
-
]
|
56
|
-
s.homepage = %q{http://github.com/ttilley/fssm}
|
57
|
-
s.require_paths = ["lib"]
|
58
|
-
s.rubygems_version = %q{1.4.2}
|
59
|
-
s.summary = %q{file system state monitor}
|
60
|
-
s.test_files = [
|
61
|
-
"spec/count_down_latch.rb",
|
62
|
-
"spec/monitor_spec.rb",
|
63
|
-
"spec/path_spec.rb",
|
64
|
-
"spec/root/file.rb",
|
65
|
-
"spec/spec_helper.rb"
|
66
|
-
]
|
16
|
+
s.rubyforge_project = "fssm"
|
67
17
|
|
68
|
-
|
69
|
-
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
70
22
|
|
71
|
-
|
72
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
73
|
-
else
|
74
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
75
|
-
end
|
76
|
-
else
|
77
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
78
|
-
end
|
23
|
+
s.add_development_dependency "rspec", "1.3.0"
|
79
24
|
end
|
80
|
-
|
data/lib/fssm.rb
CHANGED
@@ -3,8 +3,8 @@ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
|
3
3
|
|
4
4
|
module FSSM
|
5
5
|
FileNotFoundError = Class.new(StandardError)
|
6
|
-
FileNotRealError
|
7
|
-
CallbackError
|
6
|
+
FileNotRealError = Class.new(StandardError)
|
7
|
+
CallbackError = Class.new(StandardError)
|
8
8
|
|
9
9
|
class << self
|
10
10
|
def dbg(msg=nil)
|
@@ -23,6 +23,7 @@ end
|
|
23
23
|
|
24
24
|
require 'thread'
|
25
25
|
|
26
|
+
require 'fssm/version'
|
26
27
|
require 'fssm/pathname'
|
27
28
|
require 'fssm/support'
|
28
29
|
require 'fssm/tree'
|
@@ -10,7 +10,7 @@ module FSSM::Backends
|
|
10
10
|
def add_handler(handler, preload=true)
|
11
11
|
@handlers[handler.path.to_s] = handler
|
12
12
|
|
13
|
-
fsevent
|
13
|
+
fsevent = Rucola::FSEvents.new(handler.path.to_s, {:latency => 0.5}) do |events|
|
14
14
|
events.each do |event|
|
15
15
|
handler.refresh(event.path)
|
16
16
|
end
|
@@ -6,7 +6,7 @@ module FSSM::Backends
|
|
6
6
|
|
7
7
|
def add_handler(handler, preload=true)
|
8
8
|
@notifier.watch(handler.path.to_s, :recursive, :attrib, :modify, :create,
|
9
|
-
|
9
|
+
:delete, :delete_self, :moved_from, :moved_to, :move_self) do |event|
|
10
10
|
path = FSSM::Pathname.for(event.absolute_name)
|
11
11
|
path = path.dirname unless event.name == "" # Event on root directory
|
12
12
|
handler.refresh(path)
|
@@ -2,7 +2,7 @@ module FSSM::Backends
|
|
2
2
|
class Polling
|
3
3
|
def initialize(options={})
|
4
4
|
@handlers = []
|
5
|
-
@latency
|
5
|
+
@latency = options[:latency] || 1.5
|
6
6
|
end
|
7
7
|
|
8
8
|
def add_handler(handler, preload=true)
|
@@ -14,7 +14,7 @@ module FSSM::Backends
|
|
14
14
|
begin
|
15
15
|
loop do
|
16
16
|
start = Time.now.to_f
|
17
|
-
@handlers.each {|handler| handler.refresh}
|
17
|
+
@handlers.each { |handler| handler.refresh }
|
18
18
|
nap_time = @latency - (Time.now.to_f - start)
|
19
19
|
sleep nap_time if nap_time > 0
|
20
20
|
end
|
@@ -14,7 +14,7 @@ module Rucola
|
|
14
14
|
# Returns an array of the files/dirs in the path that the event occurred in.
|
15
15
|
# The files are sorted by the modification time, the first entry is the last modified file.
|
16
16
|
def files
|
17
|
-
Dir.glob("#{File.expand_path(path)}/*").sort_by {|f| File.mtime(f) }.reverse
|
17
|
+
Dir.glob("#{File.expand_path(path)}/*").sort_by { |f| File.mtime(f) }.reverse
|
18
18
|
end
|
19
19
|
|
20
20
|
# Returns the last modified file in the path that the event occurred in.
|
@@ -88,22 +88,22 @@ module Rucola
|
|
88
88
|
raise ArgumentError, 'No callback block was specified.' unless block_given?
|
89
89
|
|
90
90
|
options = params.last.kind_of?(Hash) ? params.pop : {}
|
91
|
-
@paths
|
91
|
+
@paths = params.flatten
|
92
92
|
|
93
93
|
paths.each { |path| raise ArgumentError, "The specified path (#{path}) does not exist." unless File.exist?(path) }
|
94
94
|
|
95
|
-
@allocator
|
96
|
-
@context
|
97
|
-
@since
|
98
|
-
@latency
|
99
|
-
@flags
|
100
|
-
@stream
|
95
|
+
@allocator = options[:allocator] || OSX::KCFAllocatorDefault
|
96
|
+
@context = options[:context] || nil
|
97
|
+
@since = options[:since] || OSX::KFSEventStreamEventIdSinceNow
|
98
|
+
@latency = options[:latency] || 0.0
|
99
|
+
@flags = options[:flags] || 0
|
100
|
+
@stream = options[:stream] || nil
|
101
101
|
|
102
102
|
@user_callback = block
|
103
|
-
@callback
|
103
|
+
@callback = Proc.new do |stream, client_callback_info, number_of_events, paths_pointer, event_flags, event_ids|
|
104
104
|
paths_pointer.regard_as('*')
|
105
105
|
events = []
|
106
|
-
number_of_events.times {|i| events << Rucola::FSEvents::FSEvent.new(self, event_ids[i], paths_pointer[i]) }
|
106
|
+
number_of_events.times { |i| events << Rucola::FSEvents::FSEvent.new(self, event_ids[i], paths_pointer[i]) }
|
107
107
|
@user_callback.call(events)
|
108
108
|
end
|
109
109
|
end
|
data/lib/fssm/path.rb
CHANGED
@@ -42,7 +42,7 @@ class FSSM::Path
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def init_callbacks
|
45
|
-
do_nothing = lambda {|base, relative|}
|
45
|
+
do_nothing = lambda { |base, relative|}
|
46
46
|
@callbacks = Hash.new(do_nothing)
|
47
47
|
end
|
48
48
|
|
@@ -82,10 +82,9 @@ class FSSM::Path
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def set_path(path)
|
85
|
-
path = FSSM::Pathname.for(path)
|
86
|
-
raise FSSM::FileNotFoundError, "No such file or directory - #{path}" unless path.exist?
|
87
|
-
raise FSSM::FileNotRealError, "Path is virtual - #{path}" if path.is_virtual?
|
88
|
-
@path = path.expand_path
|
85
|
+
@path = FSSM::Pathname.for(path).expand_path
|
86
|
+
raise FSSM::FileNotFoundError, "No such file or directory - #{@path}" unless @path.exist?
|
87
|
+
raise FSSM::FileNotRealError, "Path is virtual - #{@path}" if @path.is_virtual?
|
89
88
|
end
|
90
89
|
|
91
90
|
def set_glob(glob)
|
data/lib/fssm/pathname.rb
CHANGED
@@ -4,32 +4,32 @@ require 'pathname'
|
|
4
4
|
|
5
5
|
module FSSM
|
6
6
|
class Pathname < ::Pathname
|
7
|
-
ROOT = '/'.freeze
|
8
7
|
VIRTUAL_REGEX = /^file:([^!]*)!/
|
9
8
|
|
10
9
|
class << self
|
11
10
|
def for(path)
|
12
|
-
path.is_a?(Pathname) ? path : new(path)
|
11
|
+
path.is_a?(::FSSM::Pathname) ? path : new(path)
|
13
12
|
end
|
14
13
|
|
15
14
|
alias :[] :glob
|
16
15
|
end
|
17
|
-
|
16
|
+
|
18
17
|
def is_virtual?
|
19
18
|
!!(VIRTUAL_REGEX =~ to_s)
|
20
19
|
end
|
21
20
|
|
22
21
|
def segments
|
23
|
-
path
|
22
|
+
path = to_s
|
24
23
|
array = path.split(File::SEPARATOR)
|
25
24
|
array.delete('')
|
26
|
-
array.insert(0,
|
25
|
+
array.insert(0, File::SEPARATOR) if path[0, 1] == File::SEPARATOR
|
26
|
+
array[0] += File::SEPARATOR if path[0, 3] =~ SEPARATOR_PAT
|
27
27
|
array
|
28
28
|
end
|
29
29
|
|
30
30
|
def glob(pattern, flags = 0, &block)
|
31
31
|
patterns = [pattern].flatten
|
32
|
-
patterns.map! {|p| self.class.glob(to_s + p, flags, &block) }
|
32
|
+
patterns.map! { |p| self.class.glob(to_s + p, flags, &block) }
|
33
33
|
patterns.flatten
|
34
34
|
end
|
35
35
|
end
|
data/lib/fssm/state/directory.rb
CHANGED
@@ -3,13 +3,14 @@ module FSSM::State
|
|
3
3
|
attr_reader :path
|
4
4
|
|
5
5
|
def initialize(path, options={})
|
6
|
-
@path
|
6
|
+
@path = path
|
7
7
|
@options = options
|
8
|
-
@cache
|
8
|
+
@cache = FSSM::Tree::Cache.new
|
9
9
|
end
|
10
10
|
|
11
11
|
def refresh(base=nil, skip_callbacks=false)
|
12
|
-
|
12
|
+
base_path = FSSM::Pathname.for(base || @path.to_pathname).expand_path
|
13
|
+
previous, current = recache(base_path)
|
13
14
|
|
14
15
|
unless skip_callbacks
|
15
16
|
deleted(previous, current)
|
@@ -40,7 +41,7 @@ module FSSM::State
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def recache(base)
|
43
|
-
base
|
44
|
+
base = FSSM::Pathname.for(base)
|
44
45
|
previous = cache_entries
|
45
46
|
snapshot(base)
|
46
47
|
current = cache_entries
|
@@ -50,7 +51,7 @@ module FSSM::State
|
|
50
51
|
def snapshot(base)
|
51
52
|
base = FSSM::Pathname.for(base)
|
52
53
|
@cache.unset(base)
|
53
|
-
@path.glob.each {|glob| add_glob(base, glob)}
|
54
|
+
@path.glob.each { |glob| add_glob(base, glob) }
|
54
55
|
end
|
55
56
|
|
56
57
|
def add_glob(base, glob)
|
data/lib/fssm/support.rb
CHANGED
@@ -4,23 +4,23 @@ module FSSM::Support
|
|
4
4
|
class << self
|
5
5
|
def usable_backend
|
6
6
|
choice = case
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
when mac? && !jruby? && carbon_core?
|
8
|
+
'FSEvents'
|
9
|
+
when mac? && rb_fsevent?
|
10
|
+
'RBFSEvent'
|
11
|
+
when linux? && rb_inotify?
|
12
|
+
'Inotify'
|
13
|
+
else
|
14
|
+
'Polling'
|
15
|
+
end
|
16
16
|
|
17
17
|
if (mac? || linux?) && choice == 'Polling'
|
18
18
|
optimal = case
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
when mac?
|
20
|
+
'rb-fsevent'
|
21
|
+
when linux?
|
22
|
+
'rb-inotify'
|
23
|
+
end
|
24
24
|
STDERR.puts("FSSM: An optimized backend is available for this platform!")
|
25
25
|
STDERR.puts(" gem install #{optimal}")
|
26
26
|
end
|
data/lib/fssm/tree.rb
CHANGED
@@ -34,8 +34,8 @@ module FSSM::Tree
|
|
34
34
|
def each(prefix=nil, &block)
|
35
35
|
@children.each do |segment, node|
|
36
36
|
cprefix = prefix ?
|
37
|
-
|
38
|
-
|
37
|
+
FSSM::Pathname.for(prefix).join(segment) :
|
38
|
+
FSSM::Pathname.for(segment)
|
39
39
|
block.call([cprefix, node])
|
40
40
|
node.each(cprefix, &block)
|
41
41
|
end
|
@@ -54,7 +54,7 @@ module FSSM::Tree
|
|
54
54
|
end
|
55
55
|
|
56
56
|
segment = key.pop
|
57
|
-
node
|
57
|
+
node = descendant(key)
|
58
58
|
|
59
59
|
return unless node
|
60
60
|
|
@@ -84,12 +84,12 @@ module FSSM::Tree
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def recurse(key, create=false)
|
87
|
-
key
|
87
|
+
key = key_segments(key)
|
88
88
|
node = self
|
89
89
|
|
90
90
|
until key.empty?
|
91
91
|
segment = key.shift
|
92
|
-
node
|
92
|
+
node = create ? node.child!(segment) : node.child(segment)
|
93
93
|
return nil unless node
|
94
94
|
end
|
95
95
|
|
@@ -127,7 +127,7 @@ module FSSM::Tree
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def from_path(path)
|
130
|
-
path
|
130
|
+
path = FSSM::Pathname.for(path)
|
131
131
|
@ftype = path.ftype
|
132
132
|
# this handles bad symlinks without failing. why handle bad symlinks at
|
133
133
|
# all? well, we could still be interested in their creation and deletion.
|
data/lib/fssm/version.rb
ADDED
data/spec/monitor_spec.rb
CHANGED
@@ -6,7 +6,7 @@ require 'tempfile'
|
|
6
6
|
|
7
7
|
module FSSM::MonitorSpecHelpers
|
8
8
|
def create_tmp_dir
|
9
|
-
@tmp_dir = Dir.mktmpdir
|
9
|
+
@tmp_dir = FSSM::Pathname.for(Dir.mktmpdir).realpath.to_s
|
10
10
|
FileUtils.cp_r File.join(File.dirname(__FILE__), 'root'), @tmp_dir
|
11
11
|
# Because git does not track empty directories, create one ourselves.
|
12
12
|
FileUtils.mkdir_p @tmp_dir + '/root/yawn'
|
@@ -14,7 +14,7 @@ module FSSM::MonitorSpecHelpers
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def remove_tmp_dir
|
17
|
-
FileUtils.
|
17
|
+
FileUtils.remove_entry @tmp_dir
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_handler(type, latch)
|
@@ -112,50 +112,50 @@ describe "The File System State Monitor" do
|
|
112
112
|
run_monitor(1, :directories => true) do
|
113
113
|
FileUtils.mkdir @tmp_dir + "/another_yawn"
|
114
114
|
end
|
115
|
-
@handler_results[:create].should
|
115
|
+
@handler_results[:create].should include([@tmp_dir, 'another_yawn', :directory])
|
116
116
|
end
|
117
117
|
|
118
118
|
it "should call delete callback upon directory deletion" do
|
119
119
|
run_monitor(1, :directories => true) do
|
120
120
|
FileUtils.rmdir @tmp_dir + "/root/yawn"
|
121
121
|
end
|
122
|
-
@handler_results[:delete].should
|
122
|
+
@handler_results[:delete].should include([@tmp_dir, 'root/yawn', :directory])
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should call create, update, and delete callbacks upon directory renaming in the same directory" do
|
126
126
|
run_monitor(3, :directories => true) do
|
127
127
|
FileUtils.mv @tmp_dir + "/root/yawn", @tmp_dir + "/root/old_yawn"
|
128
128
|
end
|
129
|
-
@handler_results[:create].should
|
130
|
-
@handler_results[:delete].should
|
131
|
-
@handler_results[:update].should
|
129
|
+
@handler_results[:create].should include([@tmp_dir, 'root/old_yawn', :directory])
|
130
|
+
@handler_results[:delete].should include([@tmp_dir, 'root/yawn', :directory])
|
131
|
+
@handler_results[:update].should include([@tmp_dir, 'root', :directory])
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should call create, update, and delete callbacks upon directory moving to another directory" do
|
135
135
|
run_monitor(3, :directories => true) do
|
136
136
|
FileUtils.mv @tmp_dir + "/root/yawn", @tmp_dir + "/old_yawn"
|
137
137
|
end
|
138
|
-
@handler_results[:create].should
|
139
|
-
@handler_results[:delete].should
|
140
|
-
@handler_results[:update].should
|
138
|
+
@handler_results[:create].should include([@tmp_dir, 'old_yawn', :directory])
|
139
|
+
@handler_results[:delete].should include([@tmp_dir, 'root/yawn', :directory])
|
140
|
+
@handler_results[:update].should include([@tmp_dir, 'root', :directory])
|
141
141
|
end
|
142
142
|
|
143
143
|
it "should call create, update, and delete callbacks upon file renaming in the same directory" do
|
144
144
|
run_monitor(3, :directories => true) do
|
145
145
|
FileUtils.mv @tmp_dir + "/root/file.rb", @tmp_dir + "/root/old_file.rb"
|
146
146
|
end
|
147
|
-
@handler_results[:create].should
|
148
|
-
@handler_results[:delete].should
|
149
|
-
@handler_results[:update].should
|
147
|
+
@handler_results[:create].should include([@tmp_dir, 'root/old_file.rb', :file])
|
148
|
+
@handler_results[:delete].should include([@tmp_dir, 'root/file.rb', :file])
|
149
|
+
@handler_results[:update].should include([@tmp_dir, 'root', :directory])
|
150
150
|
end
|
151
151
|
|
152
152
|
it "should call create, update, and delete callbacks upon file moving to another directory" do
|
153
153
|
run_monitor(3, :directories => true) do
|
154
154
|
FileUtils.mv @tmp_dir + "/root/file.rb", @tmp_dir + "/old_file.rb"
|
155
155
|
end
|
156
|
-
@handler_results[:create].should
|
157
|
-
@handler_results[:delete].should
|
158
|
-
@handler_results[:update].should
|
156
|
+
@handler_results[:create].should include([@tmp_dir, 'old_file.rb', :file])
|
157
|
+
@handler_results[:delete].should include([@tmp_dir, 'root/file.rb', :file])
|
158
|
+
@handler_results[:update].should include([@tmp_dir, 'root', :directory])
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should call delete callbacks upon directory structure deletion, in reverse order" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -2,15 +2,19 @@
|
|
2
2
|
name: fssm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Travis Tilley
|
9
|
+
- Nathan Weizenbaum
|
10
|
+
- Chris Eppstein
|
11
|
+
- Jonathan Castello
|
12
|
+
- Tuomas Kareinen
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
16
|
|
13
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-22 00:00:00 -05:00
|
14
18
|
default_executable:
|
15
19
|
dependencies:
|
16
20
|
- !ruby/object:Gem::Dependency
|
@@ -19,26 +23,26 @@ dependencies:
|
|
19
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
none: false
|
21
25
|
requirements:
|
22
|
-
- - "
|
26
|
+
- - "="
|
23
27
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
28
|
+
version: 1.3.0
|
25
29
|
type: :development
|
26
30
|
version_requirements: *id001
|
27
|
-
description:
|
28
|
-
email:
|
31
|
+
description: The File System State Monitor keeps track of the state of any number of paths and will fire events when said state changes (create/update/delete). FSSM supports using FSEvents on MacOS, Inotify on GNU/Linux, and polling anywhere else.
|
32
|
+
email:
|
33
|
+
- ttilley@gmail.com
|
29
34
|
executables: []
|
30
35
|
|
31
36
|
extensions: []
|
32
37
|
|
33
|
-
extra_rdoc_files:
|
34
|
-
|
35
|
-
- README.markdown
|
38
|
+
extra_rdoc_files: []
|
39
|
+
|
36
40
|
files:
|
37
|
-
- .
|
41
|
+
- .gitignore
|
42
|
+
- Gemfile
|
38
43
|
- LICENSE
|
39
44
|
- README.markdown
|
40
45
|
- Rakefile
|
41
|
-
- VERSION.yml
|
42
46
|
- example.rb
|
43
47
|
- fssm.gemspec
|
44
48
|
- lib/fssm.rb
|
@@ -54,6 +58,7 @@ files:
|
|
54
58
|
- lib/fssm/state/file.rb
|
55
59
|
- lib/fssm/support.rb
|
56
60
|
- lib/fssm/tree.rb
|
61
|
+
- lib/fssm/version.rb
|
57
62
|
- profile/prof-cache.rb
|
58
63
|
- profile/prof-fssm-pathname.html
|
59
64
|
- profile/prof-pathname-rubinius.rb
|
@@ -70,7 +75,7 @@ files:
|
|
70
75
|
- spec/root/moo/cow.txt
|
71
76
|
- spec/spec_helper.rb
|
72
77
|
has_rdoc: true
|
73
|
-
homepage:
|
78
|
+
homepage: https://github.com/ttilley/fssm
|
74
79
|
licenses: []
|
75
80
|
|
76
81
|
post_install_message:
|
@@ -92,14 +97,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
97
|
version: "0"
|
93
98
|
requirements: []
|
94
99
|
|
95
|
-
rubyforge_project:
|
100
|
+
rubyforge_project: fssm
|
96
101
|
rubygems_version: 1.4.2
|
97
102
|
signing_key:
|
98
103
|
specification_version: 3
|
99
|
-
summary:
|
104
|
+
summary: File System State Monitor
|
100
105
|
test_files:
|
101
106
|
- spec/count_down_latch.rb
|
102
107
|
- spec/monitor_spec.rb
|
103
108
|
- spec/path_spec.rb
|
109
|
+
- spec/root/duck/quack.txt
|
110
|
+
- spec/root/file.css
|
104
111
|
- spec/root/file.rb
|
112
|
+
- spec/root/file.yml
|
113
|
+
- spec/root/moo/cow.txt
|
105
114
|
- spec/spec_helper.rb
|
data/.document
DELETED