sass 3.1.4 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/REVISION +1 -0
- data/VERSION +1 -1
- data/test/sass/logger_test.rb +0 -0
- data/vendor/fssm/Gemfile +3 -0
- data/vendor/fssm/LICENSE +1 -1
- data/vendor/fssm/README.markdown +55 -27
- data/vendor/fssm/Rakefile +6 -54
- data/vendor/fssm/example.rb +6 -3
- data/vendor/fssm/fssm.gemspec +17 -70
- data/vendor/fssm/lib/fssm.rb +7 -3
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +1 -1
- data/vendor/fssm/lib/fssm/backends/inotify.rb +2 -2
- data/vendor/fssm/lib/fssm/backends/polling.rb +2 -2
- data/vendor/fssm/lib/fssm/backends/rbfsevent.rb +42 -0
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +10 -10
- data/vendor/fssm/lib/fssm/monitor.rb +19 -9
- data/vendor/fssm/lib/fssm/path.rb +24 -21
- data/vendor/fssm/lib/fssm/pathname.rb +13 -479
- data/vendor/fssm/lib/fssm/state/directory.rb +29 -11
- data/vendor/fssm/lib/fssm/state/file.rb +1 -1
- data/vendor/fssm/lib/fssm/support.rb +41 -12
- data/vendor/fssm/lib/fssm/tree.rb +6 -6
- data/vendor/fssm/lib/fssm/version.rb +3 -0
- data/vendor/fssm/profile/prof-cache.rb +3 -3
- data/vendor/fssm/profile/prof-pathname-rubinius.rb +35 -0
- data/vendor/fssm/profile/prof-pathname.rb +7 -7
- data/vendor/fssm/spec/count_down_latch.rb +151 -0
- data/vendor/fssm/spec/monitor_spec.rb +202 -0
- data/vendor/fssm/spec/path_spec.rb +36 -15
- data/vendor/fssm/spec/spec_helper.rb +6 -6
- metadata +218 -299
- data/lib/sass.rbc +0 -865
- data/lib/sass/cache_stores.rbc +0 -210
- data/lib/sass/cache_stores/base.rbc +0 -1110
- data/lib/sass/cache_stores/chain.rbc +0 -759
- data/lib/sass/cache_stores/filesystem.rbc +0 -1170
- data/lib/sass/cache_stores/memory.rbc +0 -892
- data/lib/sass/callbacks.rbc +0 -623
- data/lib/sass/css.rbc +0 -3483
- data/lib/sass/engine.rbc +0 -19260
- data/lib/sass/environment.rbc +0 -1829
- data/lib/sass/error.rbc +0 -2858
- data/lib/sass/importers.rbc +0 -162
- data/lib/sass/importers/base.rbc +0 -677
- data/lib/sass/importers/filesystem.rbc +0 -2910
- data/lib/sass/less.rbc +0 -11309
- data/lib/sass/plugin.rbc +0 -1360
- data/lib/sass/plugin/compiler.rbc +0 -4205
- data/lib/sass/plugin/configuration.rbc +0 -1514
- data/lib/sass/plugin/generic.rbc +0 -206
- data/lib/sass/plugin/staleness_checker.rbc +0 -2545
- data/lib/sass/railtie.rbc +0 -259
- data/lib/sass/root.rbc +0 -160
- data/lib/sass/script.rbc +0 -728
- data/lib/sass/script/bool.rbc +0 -366
- data/lib/sass/script/color.rbc +0 -7884
- data/lib/sass/script/css_lexer.rbc +0 -793
- data/lib/sass/script/css_parser.rbc +0 -620
- data/lib/sass/script/funcall.rbc +0 -4325
- data/lib/sass/script/functions.rbc +0 -15331
- data/lib/sass/script/interpolation.rbc +0 -1181
- data/lib/sass/script/lexer.rbc +0 -7136
- data/lib/sass/script/list.rbc +0 -1795
- data/lib/sass/script/literal.rbc +0 -3411
- data/lib/sass/script/node.rbc +0 -1176
- data/lib/sass/script/number.rbc +0 -5978
- data/lib/sass/script/operation.rbc +0 -1684
- data/lib/sass/script/parser.rbc +0 -9739
- data/lib/sass/script/string.rbc +0 -965
- data/lib/sass/script/string_interpolation.rbc +0 -1619
- data/lib/sass/script/unary_operation.rbc +0 -1120
- data/lib/sass/script/variable.rbc +0 -899
- data/lib/sass/scss.rbc +0 -242
- data/lib/sass/scss/css_parser.rbc +0 -1098
- data/lib/sass/scss/parser.rbc +0 -20522
- data/lib/sass/scss/rx.rbc +0 -2878
- data/lib/sass/scss/sass_parser.rbc +0 -287
- data/lib/sass/scss/script_lexer.rbc +0 -404
- data/lib/sass/scss/script_parser.rbc +0 -482
- data/lib/sass/scss/static_parser.rbc +0 -963
- data/lib/sass/selector.rbc +0 -4125
- data/lib/sass/selector/abstract_sequence.rbc +0 -798
- data/lib/sass/selector/comma_sequence.rbc +0 -1806
- data/lib/sass/selector/sequence.rbc +0 -4727
- data/lib/sass/selector/simple.rbc +0 -1490
- data/lib/sass/selector/simple_sequence.rbc +0 -2298
- data/lib/sass/shared.rbc +0 -1093
- data/lib/sass/tree/charset_node.rbc +0 -381
- data/lib/sass/tree/comment_node.rbc +0 -1175
- data/lib/sass/tree/debug_node.rbc +0 -365
- data/lib/sass/tree/directive_node.rbc +0 -298
- data/lib/sass/tree/each_node.rbc +0 -347
- data/lib/sass/tree/extend_node.rbc +0 -335
- data/lib/sass/tree/for_node.rbc +0 -407
- data/lib/sass/tree/function_node.rbc +0 -395
- data/lib/sass/tree/if_node.rbc +0 -995
- data/lib/sass/tree/import_node.rbc +0 -1327
- data/lib/sass/tree/media_node.rbc +0 -423
- data/lib/sass/tree/mixin_def_node.rbc +0 -395
- data/lib/sass/tree/mixin_node.rbc +0 -377
- data/lib/sass/tree/node.rbc +0 -2394
- data/lib/sass/tree/prop_node.rbc +0 -2695
- data/lib/sass/tree/return_node.rbc +0 -365
- data/lib/sass/tree/root_node.rbc +0 -558
- data/lib/sass/tree/rule_node.rbc +0 -1597
- data/lib/sass/tree/variable_node.rbc +0 -425
- data/lib/sass/tree/visitors/base.rbc +0 -981
- data/lib/sass/tree/visitors/check_nesting.rbc +0 -3247
- data/lib/sass/tree/visitors/convert.rbc +0 -6529
- data/lib/sass/tree/visitors/cssize.rbc +0 -4133
- data/lib/sass/tree/visitors/perform.rbc +0 -8169
- data/lib/sass/tree/visitors/to_css.rbc +0 -6971
- data/lib/sass/tree/warn_node.rbc +0 -365
- data/lib/sass/tree/while_node.rbc +0 -317
- data/lib/sass/util.rbc +0 -9956
- data/lib/sass/util/subset_map.rbc +0 -1304
- data/lib/sass/version.rbc +0 -1763
- data/test/sass/cache_test.rbc +0 -2159
- data/test/sass/callbacks_test.rbc +0 -1518
- data/test/sass/conversion_test.rbc +0 -7840
- data/test/sass/css2sass_test.rbc +0 -3805
- data/test/sass/engine_test.rbc +0 -30858
- data/test/sass/extend_test.rbc +0 -8794
- data/test/sass/functions_test.rbc +0 -21318
- data/test/sass/importer_test.rbc +0 -4520
- data/test/sass/less_conversion_test.rbc +0 -5328
- data/test/sass/mock_importer.rbc +0 -1203
- data/test/sass/plugin_test.rbc +0 -11014
- data/test/sass/script_conversion_test.rbc +0 -4953
- data/test/sass/script_test.rbc +0 -13038
- data/test/sass/scss/css_test.rbc +0 -9621
- data/test/sass/scss/rx_test.rbc +0 -3183
- data/test/sass/scss/scss_test.rbc +0 -10997
- data/test/sass/scss/test_helper.rbc +0 -1103
- data/test/sass/test_helper.rbc +0 -306
- data/test/sass/util/subset_map_test.rbc +0 -2755
- data/test/sass/util_test.rbc +0 -6899
- data/test/test_helper.rbc +0 -2020
- data/vendor/fssm/VERSION.yml +0 -5
- data/vendor/fssm/pkg/fssm-0.0.8.gem +0 -0
data/REVISION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
(release)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.5
|
data/test/sass/logger_test.rb
CHANGED
File without changes
|
data/vendor/fssm/Gemfile
ADDED
data/vendor/fssm/LICENSE
CHANGED
data/vendor/fssm/README.markdown
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# FSSM ![project status](http://stillmaintained.com/ttilley/fssm.png) #
|
2
|
+
|
1
3
|
Monitor API
|
2
4
|
===========
|
3
5
|
|
@@ -12,44 +14,70 @@ Monitor with path
|
|
12
14
|
|
13
15
|
This form watches one path, and enters the run loop automatically. The first parameter is the path to watch, and the second parameter is an optional glob pattern or array of glob patterns that a file must match in order to trigger a callback. The default glob, if ommitted, is `'**/*'`.
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
FSSM.monitor('/some/directory/', '**/*') do
|
18
|
+
update {|base, relative|}
|
19
|
+
delete {|base, relative|}
|
20
|
+
create {|base, relative|}
|
21
|
+
end
|
20
22
|
|
21
23
|
Monitor with block
|
22
24
|
------------------
|
23
25
|
|
24
26
|
This form watches one or more paths, and enters the run loop automatically. The glob configuration call can be ommitted, and defaults to `'**/*'`.
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
28
|
+
FSSM.monitor do
|
29
|
+
path '/some/directory/' do
|
30
|
+
glob '**/*.yml'
|
31
|
+
|
32
|
+
update {|base, relative|}
|
33
|
+
delete {|base, relative|}
|
34
|
+
create {|base, relative|}
|
35
|
+
end
|
36
|
+
|
37
|
+
path '/some/other/directory/' do
|
38
|
+
update {|base, relative|}
|
39
|
+
delete {|base, relative|}
|
40
|
+
create {|base, relative|}
|
41
|
+
end
|
42
|
+
end
|
41
43
|
|
42
44
|
Monitor object
|
43
45
|
--------------
|
44
46
|
|
45
47
|
This form doesn't enter the run loop automatically.
|
46
48
|
|
47
|
-
|
49
|
+
monitor = FSSM::Monitor.new
|
50
|
+
|
51
|
+
monitor.path '/some/directory/' do
|
52
|
+
update {|base, relative|}
|
53
|
+
delete {|base, relative|}
|
54
|
+
create {|base, relative|}
|
55
|
+
end
|
56
|
+
|
57
|
+
monitor.run
|
58
|
+
|
59
|
+
Monitoring directories
|
60
|
+
----------------------
|
61
|
+
|
62
|
+
By default, FSSM monitors changes in files only. To enable monitoring of files and directories, pass option `directories => true` in a hash to the monitor. Please note that this may not work as expected in all backends. For example:
|
63
|
+
|
64
|
+
FSSM::Monitor.new(:directories => true)
|
65
|
+
FSSM.monitor(dir, file_glob, :directories => true)
|
66
|
+
|
67
|
+
When directories are monitored, there's an additional third argument to the callbacks. Instead of
|
68
|
+
|
69
|
+
FSSM.monitor('/some/directory/', '**/*') do
|
70
|
+
update {|base, relative|}
|
71
|
+
delete {|base, relative|}
|
72
|
+
create {|base, relative|}
|
73
|
+
end
|
74
|
+
|
75
|
+
you get this:
|
48
76
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
77
|
+
FSSM.monitor('/some/directory/', '**/*', :directories => true) do
|
78
|
+
update {|base, relative, type|}
|
79
|
+
delete {|base, relative, type|}
|
80
|
+
create {|base, relative, type|}
|
81
|
+
end
|
54
82
|
|
55
|
-
|
83
|
+
The value of `type` argument is either `:file` or `:directory`.
|
data/vendor/fssm/Rakefile
CHANGED
@@ -1,59 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
19
|
-
|
20
|
-
require 'spec/rake/spectask'
|
21
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
22
|
-
spec.libs << 'lib' << 'spec'
|
23
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
-
end
|
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
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
7
|
+
spec.rspec_opts = ["--color", "--backtrace", "--format", "documentation"]
|
8
|
+
spec.verbose = true
|
57
9
|
end
|
58
10
|
|
59
11
|
task :default => :spec
|
data/vendor/fssm/example.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
2
2
|
|
3
|
+
# for rb-inotify/rb-fsevent
|
4
|
+
require 'rubygems'
|
5
|
+
|
3
6
|
require 'fssm'
|
4
7
|
|
5
8
|
FSSM.monitor('.', '**/*') do
|
6
|
-
update {|b, r| puts "Update in #{b} to #{r}"}
|
7
|
-
delete {|b, r| puts "Delete in #{b} to #{r}"}
|
8
|
-
create {|b, r| puts "Create in #{b} to #{r}"}
|
9
|
+
update { |b, r| puts "Update in #{b} to #{r}" }
|
10
|
+
delete { |b, r| puts "Delete in #{b} to #{r}" }
|
11
|
+
create { |b, r| puts "Create in #{b} to #{r}" }
|
9
12
|
end
|
data/vendor/fssm/fssm.gemspec
CHANGED
@@ -1,77 +1,24 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
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{2010-03-10}
|
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
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.markdown",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION.yml",
|
26
|
-
"example.rb",
|
27
|
-
"fssm.gemspec",
|
28
|
-
"lib/fssm.rb",
|
29
|
-
"lib/fssm/backends/fsevents.rb",
|
30
|
-
"lib/fssm/backends/inotify.rb",
|
31
|
-
"lib/fssm/backends/polling.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.rb",
|
43
|
-
"profile/prof-plain-pathname.html",
|
44
|
-
"profile/prof.html",
|
45
|
-
"spec/path_spec.rb",
|
46
|
-
"spec/root/duck/quack.txt",
|
47
|
-
"spec/root/file.css",
|
48
|
-
"spec/root/file.rb",
|
49
|
-
"spec/root/file.yml",
|
50
|
-
"spec/root/moo/cow.txt",
|
51
|
-
"spec/spec_helper.rb"
|
52
|
-
]
|
53
|
-
s.homepage = %q{http://github.com/ttilley/fssm}
|
54
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
55
|
-
s.require_paths = ["lib"]
|
56
|
-
s.rubygems_version = %q{1.3.6}
|
57
|
-
s.summary = %q{file system state monitor}
|
58
|
-
s.test_files = [
|
59
|
-
"spec/path_spec.rb",
|
60
|
-
"spec/spec_helper.rb",
|
61
|
-
"spec/root/file.rb"
|
62
|
-
]
|
16
|
+
s.rubyforge_project = "fssm"
|
63
17
|
|
64
|
-
|
65
|
-
|
66
|
-
|
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"]
|
67
22
|
|
68
|
-
|
69
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
70
|
-
else
|
71
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
72
|
-
end
|
73
|
-
else
|
74
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
75
|
-
end
|
23
|
+
s.add_development_dependency "rspec", ">= 2.4.0"
|
76
24
|
end
|
77
|
-
|
data/vendor/fssm/lib/fssm.rb
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
dir = File.dirname(__FILE__)
|
2
2
|
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
3
3
|
|
4
|
+
#noinspection ALL
|
4
5
|
module FSSM
|
5
6
|
FileNotFoundError = Class.new(StandardError)
|
6
|
-
|
7
|
+
FileNotRealError = Class.new(StandardError)
|
8
|
+
CallbackError = Class.new(StandardError)
|
7
9
|
|
8
10
|
class << self
|
9
11
|
def dbg(msg=nil)
|
10
|
-
STDERR.puts(msg)
|
12
|
+
STDERR.puts("FSSM -> #{msg}")
|
11
13
|
end
|
12
14
|
|
13
15
|
def monitor(*args, &block)
|
14
|
-
|
16
|
+
options = args[-1].is_a?(Hash) ? args.pop : {}
|
17
|
+
monitor = FSSM::Monitor.new(options)
|
15
18
|
FSSM::Support.use_block(args.empty? ? monitor : monitor.path(*args), block)
|
16
19
|
|
17
20
|
monitor.run
|
@@ -21,6 +24,7 @@ end
|
|
21
24
|
|
22
25
|
require 'thread'
|
23
26
|
|
27
|
+
require 'fssm/version'
|
24
28
|
require 'fssm/pathname'
|
25
29
|
require 'fssm/support'
|
26
30
|
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
|
@@ -5,8 +5,8 @@ module FSSM::Backends
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def add_handler(handler, preload=true)
|
8
|
-
@notifier.watch(handler.path.to_s, :recursive, :attrib, :
|
9
|
-
|
8
|
+
@notifier.watch(handler.path.to_s, :recursive, :attrib, :close_write, :create,
|
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
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module FSSM::Backends
|
2
|
+
class RBFSEvent
|
3
|
+
def initialize
|
4
|
+
@handlers = []
|
5
|
+
end
|
6
|
+
|
7
|
+
def add_handler(handler, preload=true)
|
8
|
+
@handlers << handler
|
9
|
+
handler.refresh(nil, true) if preload
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
begin
|
14
|
+
@fsevent = FSEvent.new
|
15
|
+
@fsevent.watch(temporary_multipath_hack) do |paths|
|
16
|
+
paths.each do |path|
|
17
|
+
temporary_multipath_handler(path)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
@fsevent.run
|
21
|
+
rescue Interrupt
|
22
|
+
@fsevent.stop
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def temporary_multipath_handler(path)
|
27
|
+
@handlers.each do |handler|
|
28
|
+
handler_path = File.join(handler.path.to_s, "")
|
29
|
+
if path.start_with?(handler_path)
|
30
|
+
handler.refresh(path)
|
31
|
+
break
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def temporary_multipath_hack
|
37
|
+
@handlers = @handlers.sort {|x,y| y.path.to_pathname.segments.length <=> x.path.to_pathname.segments.length}
|
38
|
+
return @handlers.map {|handler| handler.path.to_s}
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
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
|