haml-edge 2.3.187 → 2.3.188
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/script/operation.rb +1 -0
- data/lib/sass/script/parser.rb +3 -3
- data/test/haml/spec/README.md +97 -0
- data/test/haml/spec/lua_haml_spec.lua +30 -0
- data/test/haml/spec/ruby_haml_test.rb +19 -0
- data/test/haml/spec/tests.json +534 -0
- data/test/sass/conversion_test.rb +2 -2
- data/test/sass/script_conversion_test.rb +24 -0
- data/vendor/fssm/LICENSE +20 -0
- data/vendor/fssm/README.markdown +55 -0
- data/vendor/fssm/Rakefile +59 -0
- data/vendor/fssm/VERSION.yml +5 -0
- data/vendor/fssm/example.rb +9 -0
- data/vendor/fssm/fssm.gemspec +77 -0
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
- data/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
- data/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
- data/vendor/fssm/lib/fssm/monitor.rb +26 -0
- data/vendor/fssm/lib/fssm/path.rb +91 -0
- data/vendor/fssm/lib/fssm/pathname.rb +502 -0
- data/vendor/fssm/lib/fssm/state/directory.rb +57 -0
- data/vendor/fssm/lib/fssm/state/file.rb +24 -0
- data/vendor/fssm/lib/fssm/support.rb +63 -0
- data/vendor/fssm/lib/fssm/tree.rb +176 -0
- data/vendor/fssm/lib/fssm.rb +33 -0
- data/vendor/fssm/profile/prof-cache.rb +40 -0
- data/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
- data/vendor/fssm/profile/prof-pathname.rb +68 -0
- data/vendor/fssm/profile/prof-plain-pathname.html +988 -0
- data/vendor/fssm/profile/prof.html +2379 -0
- data/vendor/fssm/spec/path_spec.rb +75 -0
- data/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/fssm/spec/spec_helper.rb +14 -0
- metadata +36 -1
@@ -0,0 +1,176 @@
|
|
1
|
+
module FSSM::Tree
|
2
|
+
module NodeBase
|
3
|
+
def initialize
|
4
|
+
@children = {}
|
5
|
+
end
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def child(segment)
|
10
|
+
@children["#{segment}"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def child!(segment)
|
14
|
+
(@children["#{segment}"] ||= Node.new)
|
15
|
+
end
|
16
|
+
|
17
|
+
def has_child?(segment)
|
18
|
+
@children.has_key?("#{segment}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def remove_child(segment)
|
22
|
+
@children.delete("#{segment}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def remove_children
|
26
|
+
@children.clear
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module NodeEnumerable
|
31
|
+
include NodeBase
|
32
|
+
include Enumerable
|
33
|
+
|
34
|
+
def each(prefix=nil, &block)
|
35
|
+
@children.each do |segment, node|
|
36
|
+
cprefix = prefix ?
|
37
|
+
FSSM::Pathname.for(prefix).join(segment) :
|
38
|
+
FSSM::Pathname.for(segment)
|
39
|
+
block.call([cprefix, node])
|
40
|
+
node.each(cprefix, &block)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
module NodeInsertion
|
46
|
+
include NodeBase
|
47
|
+
|
48
|
+
def unset(path)
|
49
|
+
key = key_segments(path)
|
50
|
+
|
51
|
+
if key.empty?
|
52
|
+
remove_children
|
53
|
+
return nil
|
54
|
+
end
|
55
|
+
|
56
|
+
segment = key.pop
|
57
|
+
node = descendant(key)
|
58
|
+
|
59
|
+
return unless node
|
60
|
+
|
61
|
+
node.remove_child(segment)
|
62
|
+
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
|
66
|
+
def set(path)
|
67
|
+
node = descendant!(path)
|
68
|
+
node.from_path(path).mtime
|
69
|
+
end
|
70
|
+
|
71
|
+
protected
|
72
|
+
|
73
|
+
def key_segments(key)
|
74
|
+
return key if key.is_a?(Array)
|
75
|
+
FSSM::Pathname.for(key).segments
|
76
|
+
end
|
77
|
+
|
78
|
+
def descendant(path)
|
79
|
+
recurse(path, false)
|
80
|
+
end
|
81
|
+
|
82
|
+
def descendant!(path)
|
83
|
+
recurse(path, true)
|
84
|
+
end
|
85
|
+
|
86
|
+
def recurse(key, create=false)
|
87
|
+
key = key_segments(key)
|
88
|
+
node = self
|
89
|
+
|
90
|
+
until key.empty?
|
91
|
+
segment = key.shift
|
92
|
+
node = create ? node.child!(segment) : node.child(segment)
|
93
|
+
return nil unless node
|
94
|
+
end
|
95
|
+
|
96
|
+
node
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
module CacheDebug
|
101
|
+
def set(path)
|
102
|
+
FSSM.dbg("Cache#set(#{path})")
|
103
|
+
super
|
104
|
+
end
|
105
|
+
|
106
|
+
def unset(path)
|
107
|
+
FSSM.dbg("Cache#unset(#{path})")
|
108
|
+
super
|
109
|
+
end
|
110
|
+
|
111
|
+
def ftype(ft)
|
112
|
+
FSSM.dbg("Cache#ftype(#{ft})")
|
113
|
+
super
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
class Node
|
118
|
+
include NodeBase
|
119
|
+
include NodeEnumerable
|
120
|
+
|
121
|
+
attr_accessor :mtime
|
122
|
+
attr_accessor :ftype
|
123
|
+
|
124
|
+
def <=>(other)
|
125
|
+
return unless other.is_a?(::FSSM::Tree::Node)
|
126
|
+
self.mtime <=> other.mtime
|
127
|
+
end
|
128
|
+
|
129
|
+
def from_path(path)
|
130
|
+
path = FSSM::Pathname.for(path)
|
131
|
+
@ftype = path.ftype
|
132
|
+
# this handles bad symlinks without failing. why handle bad symlinks at
|
133
|
+
# all? well, we could still be interested in their creation and deletion.
|
134
|
+
@mtime = path.symlink? ? Time.at(0) : path.mtime
|
135
|
+
self
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
class Cache
|
140
|
+
include NodeBase
|
141
|
+
include NodeEnumerable
|
142
|
+
include NodeInsertion
|
143
|
+
include CacheDebug if $DEBUG
|
144
|
+
|
145
|
+
def set(path)
|
146
|
+
# all paths set from this level need to be absolute
|
147
|
+
# realpath will fail on broken links
|
148
|
+
path = FSSM::Pathname.for(path).expand_path
|
149
|
+
super(path)
|
150
|
+
end
|
151
|
+
|
152
|
+
def files
|
153
|
+
ftype('file')
|
154
|
+
end
|
155
|
+
|
156
|
+
def directories
|
157
|
+
ftype('directory')
|
158
|
+
end
|
159
|
+
|
160
|
+
def links
|
161
|
+
ftype('link')
|
162
|
+
end
|
163
|
+
|
164
|
+
alias symlinks links
|
165
|
+
|
166
|
+
private
|
167
|
+
|
168
|
+
def ftype(ft)
|
169
|
+
inject({}) do |hash, (path, node)|
|
170
|
+
hash["#{path}"] = node.mtime if node.ftype == ft
|
171
|
+
hash
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
dir = File.dirname(__FILE__)
|
2
|
+
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
3
|
+
|
4
|
+
module FSSM
|
5
|
+
FileNotFoundError = Class.new(StandardError)
|
6
|
+
CallbackError = Class.new(StandardError)
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def dbg(msg=nil)
|
10
|
+
STDERR.puts(msg)
|
11
|
+
end
|
12
|
+
|
13
|
+
def monitor(*args, &block)
|
14
|
+
monitor = FSSM::Monitor.new
|
15
|
+
FSSM::Support.use_block(args.empty? ? monitor : monitor.path(*args), block)
|
16
|
+
|
17
|
+
monitor.run
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'thread'
|
23
|
+
|
24
|
+
require 'fssm/pathname'
|
25
|
+
require 'fssm/support'
|
26
|
+
require 'fssm/tree'
|
27
|
+
require 'fssm/path'
|
28
|
+
require 'fssm/state/directory'
|
29
|
+
require 'fssm/state/file'
|
30
|
+
require 'fssm/monitor'
|
31
|
+
|
32
|
+
require "fssm/backends/#{FSSM::Support.backend.downcase}"
|
33
|
+
FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
|
3
|
+
require 'fssm'
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'ruby-prof'
|
7
|
+
|
8
|
+
$test_path = FSSM::Pathname.new('..').expand_path
|
9
|
+
$test_files = FSSM::Pathname.glob(File.join($test_path, '**', '*'))
|
10
|
+
|
11
|
+
RubyProf.start
|
12
|
+
RubyProf.pause
|
13
|
+
|
14
|
+
cache = FSSM::Tree::Cache.new
|
15
|
+
|
16
|
+
5000.times do |num|
|
17
|
+
iteration = "%-5d" % (num + 1)
|
18
|
+
print "iteration #{iteration}"
|
19
|
+
|
20
|
+
print '!'
|
21
|
+
RubyProf.resume
|
22
|
+
cache.unset($test_path)
|
23
|
+
RubyProf.pause
|
24
|
+
print '!'
|
25
|
+
|
26
|
+
$test_files.each do |fn|
|
27
|
+
print '.'
|
28
|
+
RubyProf.resume
|
29
|
+
cache.set(fn)
|
30
|
+
RubyProf.pause
|
31
|
+
end
|
32
|
+
|
33
|
+
print "\n\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
result = RubyProf.stop
|
37
|
+
output = File.new('prof.html', 'w+')
|
38
|
+
|
39
|
+
printer = RubyProf::GraphHtmlPrinter.new(result)
|
40
|
+
printer.print(output, :min_percent => 1)
|