fssm 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +7 -0
- data/LICENSE +20 -0
- data/README.markdown +55 -0
- data/Rakefile +69 -0
- data/VERSION.yml +4 -0
- data/example.rb +9 -0
- data/fssm.gemspec +77 -0
- data/lib/fssm.rb +40 -0
- data/lib/fssm/backends/fsevents.rb +37 -0
- data/lib/fssm/backends/polling.rb +26 -0
- data/lib/fssm/fsevents.rb +129 -0
- data/lib/fssm/monitor.rb +25 -0
- data/lib/fssm/path.rb +91 -0
- data/lib/fssm/pathname.rb +350 -0
- data/lib/fssm/state.rb +54 -0
- data/lib/fssm/support.rb +22 -0
- data/lib/fssm/tree.rb +176 -0
- data/profile/prof-cache.rb +40 -0
- data/profile/prof-fssm-pathname.html +1119 -0
- data/profile/prof-pathname.rb +68 -0
- data/profile/prof-plain-pathname.html +909 -0
- data/profile/prof.html +2163 -0
- data/spec/path_spec.rb +75 -0
- data/spec/root/duck/quack.txt +0 -0
- data/spec/root/file.css +0 -0
- data/spec/root/file.rb +0 -0
- data/spec/root/file.yml +0 -0
- data/spec/root/moo/cow.txt +0 -0
- data/spec/spec_helper.rb +14 -0
- metadata +106 -0
data/spec/path_spec.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "The File System State Monitor" do
|
4
|
+
describe "paths" do
|
5
|
+
it "should accept a valid filesystem directory" do
|
6
|
+
lambda {FSSM::Path.new("#{@watch_root}")}.should_not raise_error
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should not accept an invalid filesystem directory" do
|
10
|
+
lambda {FSSM::Path.new('/does/not/exist/kthxbye')}.should raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should default the path to the current directory" do
|
14
|
+
path = FSSM::Path.new
|
15
|
+
here = Pathname.new('.').realpath
|
16
|
+
|
17
|
+
"#{here}".should == "#{path}"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should accept an optional glob array parameter" do
|
21
|
+
path = FSSM::Path.new('.', ['**/*.yml'])
|
22
|
+
path.glob.should == ['**/*.yml']
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should accept an optional glob string parameter" do
|
26
|
+
path = FSSM::Path.new('.', '**/*.yml')
|
27
|
+
path.glob.should == ['**/*.yml']
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should default the glob to ['**/*']" do
|
31
|
+
path = FSSM::Path.new
|
32
|
+
path.glob.should == ['**/*']
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should accept a callback for update events" do
|
36
|
+
path = FSSM::Path.new
|
37
|
+
callback = lambda {|base, relative| return true}
|
38
|
+
path.update(callback)
|
39
|
+
(path.update).should == callback
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should accept a callback for delete events" do
|
43
|
+
path = FSSM::Path.new
|
44
|
+
callback = lambda {|base, relative| return true}
|
45
|
+
path.delete(callback)
|
46
|
+
(path.delete).should == callback
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should accept a callback for create events" do
|
50
|
+
path = FSSM::Path.new
|
51
|
+
callback = lambda {|base, relative| return true}
|
52
|
+
path.create(callback)
|
53
|
+
(path.create).should == callback
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should accept a configuration block" do
|
57
|
+
path = FSSM::Path.new "#{@watch_root}" do
|
58
|
+
glob '**/*.yml'
|
59
|
+
update {|base, relative| 'success'}
|
60
|
+
delete {|base, relative| 'success'}
|
61
|
+
create {|base, relative| 'success'}
|
62
|
+
end
|
63
|
+
|
64
|
+
"#{path}".should == "#{@watch_root}"
|
65
|
+
path.glob.should == ['**/*.yml']
|
66
|
+
path.update.should be_a_kind_of(Proc)
|
67
|
+
path.delete.should be_a_kind_of(Proc)
|
68
|
+
path.create.should be_a_kind_of(Proc)
|
69
|
+
path.update.call('','').should == 'success'
|
70
|
+
path.delete.call('','').should == 'success'
|
71
|
+
path.create.call('','').should == 'success'
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
File without changes
|
data/spec/root/file.css
ADDED
File without changes
|
data/spec/root/file.rb
ADDED
File without changes
|
data/spec/root/file.yml
ADDED
File without changes
|
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
require 'pathname'
|
5
|
+
require 'fssm'
|
6
|
+
|
7
|
+
require 'spec'
|
8
|
+
require 'spec/autorun'
|
9
|
+
|
10
|
+
Spec::Runner.configure do |config|
|
11
|
+
config.before :all do
|
12
|
+
@watch_root = Pathname.new(__FILE__).dirname.join('root').expand_path
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fssm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Travis Tilley
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-09-08 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
type: :development
|
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: yard
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: file system state monitor
|
36
|
+
email: ttilley@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.markdown
|
44
|
+
files:
|
45
|
+
- .document
|
46
|
+
- .gitignore
|
47
|
+
- LICENSE
|
48
|
+
- README.markdown
|
49
|
+
- Rakefile
|
50
|
+
- VERSION.yml
|
51
|
+
- example.rb
|
52
|
+
- fssm.gemspec
|
53
|
+
- lib/fssm.rb
|
54
|
+
- lib/fssm/backends/fsevents.rb
|
55
|
+
- lib/fssm/backends/polling.rb
|
56
|
+
- lib/fssm/fsevents.rb
|
57
|
+
- lib/fssm/monitor.rb
|
58
|
+
- lib/fssm/path.rb
|
59
|
+
- lib/fssm/pathname.rb
|
60
|
+
- lib/fssm/state.rb
|
61
|
+
- lib/fssm/support.rb
|
62
|
+
- lib/fssm/tree.rb
|
63
|
+
- profile/prof-cache.rb
|
64
|
+
- profile/prof-fssm-pathname.html
|
65
|
+
- profile/prof-pathname.rb
|
66
|
+
- profile/prof-plain-pathname.html
|
67
|
+
- profile/prof.html
|
68
|
+
- spec/path_spec.rb
|
69
|
+
- spec/root/duck/quack.txt
|
70
|
+
- spec/root/file.css
|
71
|
+
- spec/root/file.rb
|
72
|
+
- spec/root/file.yml
|
73
|
+
- spec/root/moo/cow.txt
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
has_rdoc: true
|
76
|
+
homepage: http://github.com/ttilley/fssm
|
77
|
+
licenses: []
|
78
|
+
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options:
|
81
|
+
- --charset=UTF-8
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
version:
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: "0"
|
95
|
+
version:
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.3.5
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: file system state monitor
|
103
|
+
test_files:
|
104
|
+
- spec/path_spec.rb
|
105
|
+
- spec/root/file.rb
|
106
|
+
- spec/spec_helper.rb
|