valise 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/overview-diagram.svg +367 -0
- data/lib/valise/adapters/tilt.rb +47 -0
- data/lib/valise/adapters.rb +18 -0
- data/lib/valise/errors.rb +3 -6
- data/lib/valise/item-enum.rb +39 -0
- data/lib/valise/item.rb +8 -41
- data/lib/valise/path-matcher.rb +11 -4
- data/lib/valise/search-root.rb +13 -14
- data/lib/valise/set/definer.rb +9 -8
- data/lib/valise/set/extensions-decorator.rb +35 -0
- data/lib/valise/set.rb +88 -57
- data/lib/valise/stack/extensions-decorator.rb +53 -0
- data/lib/valise/stack.rb +45 -138
- data/lib/valise/stem-decorator.rb +0 -4
- data/lib/valise/strategies/merge-diff.rb +68 -0
- data/lib/valise/strategies/serialization.rb +33 -0
- data/lib/valise/strategies/set.rb +53 -0
- data/lib/valise/utils.rb +40 -1
- data/lib/valise.rb +9 -0
- data/spec/addable.rb +15 -9
- data/spec/fileset.rb +0 -44
- data/spec/glob-handling.rb +44 -0
- metadata +32 -17
- data/spec/glob_handling.rb +0 -28
- /data/spec/{dump_load.rb → dump-load.rb} +0 -0
- /data/spec/{error_handling.rb → error-handling.rb} +0 -0
- /data/spec/{merge_diff.rb → merge-diff.rb} +0 -0
- /data/spec/{search_root.rb → search-root.rb} +0 -0
@@ -0,0 +1,367 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3
|
+
|
4
|
+
<svg
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
7
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
8
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
10
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
11
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
12
|
+
width="744.09448819"
|
13
|
+
height="1052.3622047"
|
14
|
+
id="svg2"
|
15
|
+
version="1.1"
|
16
|
+
inkscape:version="0.48.4 r9939"
|
17
|
+
sodipodi:docname="New document 1">
|
18
|
+
<defs
|
19
|
+
id="defs4">
|
20
|
+
<marker
|
21
|
+
inkscape:stockid="Arrow2Lend"
|
22
|
+
orient="auto"
|
23
|
+
refY="0.0"
|
24
|
+
refX="0.0"
|
25
|
+
id="Arrow2Lend"
|
26
|
+
style="overflow:visible;">
|
27
|
+
<path
|
28
|
+
id="path4033"
|
29
|
+
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
|
30
|
+
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
|
31
|
+
transform="scale(1.1) rotate(180) translate(1,0)" />
|
32
|
+
</marker>
|
33
|
+
<marker
|
34
|
+
inkscape:stockid="Arrow1Lstart"
|
35
|
+
orient="auto"
|
36
|
+
refY="0.0"
|
37
|
+
refX="0.0"
|
38
|
+
id="Arrow1Lstart"
|
39
|
+
style="overflow:visible">
|
40
|
+
<path
|
41
|
+
id="path4012"
|
42
|
+
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
|
43
|
+
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
|
44
|
+
transform="scale(0.8) translate(12.5,0)" />
|
45
|
+
</marker>
|
46
|
+
</defs>
|
47
|
+
<sodipodi:namedview
|
48
|
+
id="base"
|
49
|
+
pagecolor="#ffffff"
|
50
|
+
bordercolor="#666666"
|
51
|
+
borderopacity="1.0"
|
52
|
+
inkscape:pageopacity="0.0"
|
53
|
+
inkscape:pageshadow="2"
|
54
|
+
inkscape:zoom="0.69120603"
|
55
|
+
inkscape:cx="343.55061"
|
56
|
+
inkscape:cy="810.9786"
|
57
|
+
inkscape:document-units="px"
|
58
|
+
inkscape:current-layer="layer1"
|
59
|
+
showgrid="false"
|
60
|
+
inkscape:window-width="1313"
|
61
|
+
inkscape:window-height="537"
|
62
|
+
inkscape:window-x="0"
|
63
|
+
inkscape:window-y="24"
|
64
|
+
inkscape:window-maximized="0" />
|
65
|
+
<metadata
|
66
|
+
id="metadata7">
|
67
|
+
<rdf:RDF>
|
68
|
+
<cc:Work
|
69
|
+
rdf:about="">
|
70
|
+
<dc:format>image/svg+xml</dc:format>
|
71
|
+
<dc:type
|
72
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
73
|
+
<dc:title></dc:title>
|
74
|
+
</cc:Work>
|
75
|
+
</rdf:RDF>
|
76
|
+
</metadata>
|
77
|
+
<g
|
78
|
+
inkscape:label="Layer 1"
|
79
|
+
inkscape:groupmode="layer"
|
80
|
+
id="layer1">
|
81
|
+
<g
|
82
|
+
id="g3798"
|
83
|
+
transform="translate(-19.949479,41.955652)">
|
84
|
+
<rect
|
85
|
+
rx="8.6162024"
|
86
|
+
y="200.83377"
|
87
|
+
x="62.030285"
|
88
|
+
height="27.033594"
|
89
|
+
width="531.12671"
|
90
|
+
id="rect2985"
|
91
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.71428078;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
92
|
+
<text
|
93
|
+
sodipodi:linespacing="100%"
|
94
|
+
id="text3755"
|
95
|
+
y="217.47655"
|
96
|
+
x="76.677567"
|
97
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
98
|
+
xml:space="preserve"><tspan
|
99
|
+
y="217.47655"
|
100
|
+
x="76.677567"
|
101
|
+
id="tspan3757"
|
102
|
+
sodipodi:role="line">./.appname</tspan></text>
|
103
|
+
<text
|
104
|
+
sodipodi:linespacing="100%"
|
105
|
+
id="text3759"
|
106
|
+
y="218.8242"
|
107
|
+
x="610.65436"
|
108
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
109
|
+
xml:space="preserve"><tspan
|
110
|
+
y="218.8242"
|
111
|
+
x="610.65436"
|
112
|
+
id="tspan3761"
|
113
|
+
sodipodi:role="line">Valise::SearchRoot</tspan></text>
|
114
|
+
</g>
|
115
|
+
<g
|
116
|
+
id="g3798-0"
|
117
|
+
transform="translate(-19.949479,95.600395)">
|
118
|
+
<rect
|
119
|
+
rx="8.6162024"
|
120
|
+
y="200.83377"
|
121
|
+
x="62.030285"
|
122
|
+
height="27.033594"
|
123
|
+
width="531.12671"
|
124
|
+
id="rect2985-0"
|
125
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.71428078;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
126
|
+
<text
|
127
|
+
sodipodi:linespacing="100%"
|
128
|
+
id="text3755-0"
|
129
|
+
y="217.47655"
|
130
|
+
x="76.677567"
|
131
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
132
|
+
xml:space="preserve"><tspan
|
133
|
+
y="217.47655"
|
134
|
+
x="76.677567"
|
135
|
+
id="tspan3757-9"
|
136
|
+
sodipodi:role="line">~/.appname</tspan></text>
|
137
|
+
<text
|
138
|
+
sodipodi:linespacing="100%"
|
139
|
+
id="text3759-9"
|
140
|
+
y="218.8242"
|
141
|
+
x="610.65436"
|
142
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
143
|
+
xml:space="preserve"><tspan
|
144
|
+
y="218.8242"
|
145
|
+
x="610.65436"
|
146
|
+
id="tspan3761-9"
|
147
|
+
sodipodi:role="line">Valise::SearchRoot</tspan></text>
|
148
|
+
</g>
|
149
|
+
<g
|
150
|
+
id="g3798-06"
|
151
|
+
transform="translate(-19.949479,149.2451)">
|
152
|
+
<rect
|
153
|
+
rx="8.6162024"
|
154
|
+
y="200.83377"
|
155
|
+
x="62.030285"
|
156
|
+
height="27.033594"
|
157
|
+
width="531.12671"
|
158
|
+
id="rect2985-4"
|
159
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.71428078;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
160
|
+
<text
|
161
|
+
sodipodi:linespacing="100%"
|
162
|
+
id="text3755-6"
|
163
|
+
y="217.47655"
|
164
|
+
x="76.677567"
|
165
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
166
|
+
xml:space="preserve"><tspan
|
167
|
+
y="217.47655"
|
168
|
+
x="76.677567"
|
169
|
+
id="tspan3757-92"
|
170
|
+
sodipodi:role="line">//usr/share/conf/appname</tspan></text>
|
171
|
+
<text
|
172
|
+
sodipodi:linespacing="100%"
|
173
|
+
id="text3759-2"
|
174
|
+
y="218.8242"
|
175
|
+
x="610.65436"
|
176
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
177
|
+
xml:space="preserve"><tspan
|
178
|
+
y="218.8242"
|
179
|
+
x="610.65436"
|
180
|
+
id="tspan3761-6"
|
181
|
+
sodipodi:role="line">Valise::SearchRoot</tspan></text>
|
182
|
+
</g>
|
183
|
+
<g
|
184
|
+
id="g3798-2"
|
185
|
+
transform="translate(-19.949479,202.88984)">
|
186
|
+
<rect
|
187
|
+
rx="8.6162024"
|
188
|
+
y="200.83377"
|
189
|
+
x="62.030285"
|
190
|
+
height="27.033594"
|
191
|
+
width="531.12671"
|
192
|
+
id="rect2985-3"
|
193
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.71428078;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
194
|
+
<text
|
195
|
+
sodipodi:linespacing="100%"
|
196
|
+
id="text3755-8"
|
197
|
+
y="217.47655"
|
198
|
+
x="76.677567"
|
199
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
200
|
+
xml:space="preserve"><tspan
|
201
|
+
y="217.47655"
|
202
|
+
x="76.677567"
|
203
|
+
id="tspan3757-1"
|
204
|
+
sodipodi:role="line">/etc/appname/</tspan></text>
|
205
|
+
<text
|
206
|
+
sodipodi:linespacing="100%"
|
207
|
+
id="text3759-8"
|
208
|
+
y="218.8242"
|
209
|
+
x="610.65436"
|
210
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
211
|
+
xml:space="preserve"><tspan
|
212
|
+
y="218.8242"
|
213
|
+
x="610.65436"
|
214
|
+
id="tspan3761-8"
|
215
|
+
sodipodi:role="line">Valise::SearchRoot</tspan></text>
|
216
|
+
</g>
|
217
|
+
<g
|
218
|
+
id="g3973">
|
219
|
+
<rect
|
220
|
+
rx="5.5654726"
|
221
|
+
y="130.67731"
|
222
|
+
x="234.26569"
|
223
|
+
height="321.39227"
|
224
|
+
width="23.362465"
|
225
|
+
id="rect3872"
|
226
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.69948387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
227
|
+
<text
|
228
|
+
transform="matrix(0,1,-1,0,0,0)"
|
229
|
+
sodipodi:linespacing="100%"
|
230
|
+
id="text3874"
|
231
|
+
y="-242.63637"
|
232
|
+
x="150.679"
|
233
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
234
|
+
xml:space="preserve"><tspan
|
235
|
+
y="-242.63637"
|
236
|
+
x="150.679"
|
237
|
+
id="tspan3876"
|
238
|
+
sodipodi:role="line">conf.yaml</tspan></text>
|
239
|
+
<text
|
240
|
+
transform="matrix(0,1,-1,0,0,0)"
|
241
|
+
sodipodi:linespacing="100%"
|
242
|
+
id="text3935"
|
243
|
+
y="-241.47328"
|
244
|
+
x="470.08115"
|
245
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
246
|
+
xml:space="preserve"><tspan
|
247
|
+
id="tspan3939"
|
248
|
+
y="-241.47328"
|
249
|
+
x="470.08115"
|
250
|
+
sodipodi:role="line">Valise::Stack</tspan></text>
|
251
|
+
</g>
|
252
|
+
<g
|
253
|
+
id="g3980">
|
254
|
+
<text
|
255
|
+
transform="matrix(0,1,-1,0,0,0)"
|
256
|
+
sodipodi:linespacing="100%"
|
257
|
+
id="text3878"
|
258
|
+
y="-310.91714"
|
259
|
+
x="151.69505"
|
260
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
261
|
+
xml:space="preserve"><tspan
|
262
|
+
y="-310.91714"
|
263
|
+
x="151.69505"
|
264
|
+
id="tspan3880"
|
265
|
+
sodipodi:role="line">cache.txt</tspan></text>
|
266
|
+
<rect
|
267
|
+
rx="5.5625463"
|
268
|
+
y="117.66273"
|
269
|
+
x="303.7157"
|
270
|
+
height="332.95395"
|
271
|
+
width="23.350182"
|
272
|
+
id="rect3872-3"
|
273
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.71176708;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
274
|
+
<text
|
275
|
+
transform="matrix(0,1,-1,0,0,0)"
|
276
|
+
sodipodi:linespacing="100%"
|
277
|
+
id="text3935-6"
|
278
|
+
y="-310.91714"
|
279
|
+
x="470.08115"
|
280
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
281
|
+
xml:space="preserve"><tspan
|
282
|
+
id="tspan3939-5"
|
283
|
+
y="-310.91714"
|
284
|
+
x="470.08115"
|
285
|
+
sodipodi:role="line">Valise::Stack</tspan></text>
|
286
|
+
</g>
|
287
|
+
<g
|
288
|
+
id="g3987">
|
289
|
+
<text
|
290
|
+
transform="matrix(0,1,-1,0,0,0)"
|
291
|
+
sodipodi:linespacing="100%"
|
292
|
+
id="text3882"
|
293
|
+
y="-381.52408"
|
294
|
+
x="54.397758"
|
295
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
296
|
+
xml:space="preserve"><tspan
|
297
|
+
y="-381.52408"
|
298
|
+
x="54.397758"
|
299
|
+
id="tspan3884"
|
300
|
+
sodipodi:role="line">templates/index.html.erb</tspan></text>
|
301
|
+
<rect
|
302
|
+
rx="5.5437078"
|
303
|
+
y="39.577957"
|
304
|
+
x="373.19907"
|
305
|
+
height="412.44595"
|
306
|
+
width="23.271101"
|
307
|
+
id="rect3872-0"
|
308
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.79084736;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
309
|
+
<text
|
310
|
+
transform="matrix(0,1,-1,0,0,0)"
|
311
|
+
sodipodi:linespacing="100%"
|
312
|
+
id="text3935-8"
|
313
|
+
y="-380.36099"
|
314
|
+
x="470.08115"
|
315
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
316
|
+
xml:space="preserve"><tspan
|
317
|
+
id="tspan3939-56"
|
318
|
+
y="-380.36099"
|
319
|
+
x="470.08115"
|
320
|
+
sodipodi:role="line">Valise::Stack</tspan></text>
|
321
|
+
</g>
|
322
|
+
<rect
|
323
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.91399997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
324
|
+
id="rect3994"
|
325
|
+
width="710.3526"
|
326
|
+
height="231.47946"
|
327
|
+
x="17.36096"
|
328
|
+
y="216.14262"
|
329
|
+
rx="5.5437078" />
|
330
|
+
<rect
|
331
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.91399997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
332
|
+
id="rect3996"
|
333
|
+
width="41.955654"
|
334
|
+
height="43.402401"
|
335
|
+
x="363.13339"
|
336
|
+
y="287.0332"
|
337
|
+
rx="5.5437078" />
|
338
|
+
<text
|
339
|
+
xml:space="preserve"
|
340
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
341
|
+
x="645.24902"
|
342
|
+
y="204.56866"
|
343
|
+
id="text3998"
|
344
|
+
sodipodi:linespacing="100%"><tspan
|
345
|
+
sodipodi:role="line"
|
346
|
+
id="tspan4000"
|
347
|
+
x="645.24902"
|
348
|
+
y="204.56866">Valise::Set</tspan></text>
|
349
|
+
<text
|
350
|
+
xml:space="preserve"
|
351
|
+
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
352
|
+
x="386.28137"
|
353
|
+
y="608.21094"
|
354
|
+
id="text4002"
|
355
|
+
sodipodi:linespacing="100%"><tspan
|
356
|
+
sodipodi:role="line"
|
357
|
+
id="tspan4004"
|
358
|
+
x="386.28137"
|
359
|
+
y="608.21094">Valise::Item for (~/.appname/templates/index.html.erb)</tspan></text>
|
360
|
+
<path
|
361
|
+
style="color:#000000;fill:none;stroke:#000000;stroke-width:0.91399997000000011;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;marker-end:url(#Arrow2Lend)"
|
362
|
+
d="m 543.97674,580.72278 c 0,0 -99.82553,-248.84042 -135.99419,-263.30789"
|
363
|
+
id="path4006"
|
364
|
+
inkscape:connector-curvature="0"
|
365
|
+
sodipodi:nodetypes="cc" />
|
366
|
+
</g>
|
367
|
+
</svg>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Valise
|
2
|
+
module Strategies
|
3
|
+
class Serialization
|
4
|
+
class Tilt < Serialization
|
5
|
+
register :tilt
|
6
|
+
|
7
|
+
def self.template_cache
|
8
|
+
@template_cache ||= ::Tilt::Cache.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(options)
|
12
|
+
options ||= {}
|
13
|
+
@template_options = options[:template_options] || {}
|
14
|
+
@template_cache = options[:template_cache] || self.class.template_cache
|
15
|
+
end
|
16
|
+
|
17
|
+
def dump(item)
|
18
|
+
super.data
|
19
|
+
end
|
20
|
+
|
21
|
+
def load(item)
|
22
|
+
@template_cache.fetch(item.full_path, @template_options) do
|
23
|
+
::Tilt.new(item.full_path, @template_options) do |tmpl|
|
24
|
+
super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Set
|
33
|
+
def templates(rel_path=nil)
|
34
|
+
rel_path ||= "templates"
|
35
|
+
new_set = self.sub_set(rel_path)
|
36
|
+
new_set = new_set.exts(*([""] + Tilt.mappings.map{|mapping, _| "." + mapping}))
|
37
|
+
::Tilt.mappings.each do |mapping, _|
|
38
|
+
options = nil
|
39
|
+
if block_given?
|
40
|
+
options = yield(mapping)
|
41
|
+
end
|
42
|
+
new_set.add_serialization_handler("**/*.#{mapping}", :tilt, options)
|
43
|
+
end
|
44
|
+
new_set
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
module Valise
|
3
|
+
module Adapters
|
4
|
+
def self.adapter_for(library, valise_file=nil)
|
5
|
+
begin
|
6
|
+
require library
|
7
|
+
rescue LoadError
|
8
|
+
return false
|
9
|
+
end
|
10
|
+
|
11
|
+
valise_file ||= "valise/adapters/#{library}"
|
12
|
+
require valise_file
|
13
|
+
return true
|
14
|
+
end
|
15
|
+
|
16
|
+
adapter_for "tilt"
|
17
|
+
end
|
18
|
+
end
|
data/lib/valise/errors.rb
CHANGED
@@ -12,13 +12,10 @@ module Valise
|
|
12
12
|
class RootNotInSet < Error; end
|
13
13
|
class UnderIndented < Error; end
|
14
14
|
|
15
|
-
class
|
16
|
-
def initialize(
|
17
|
-
|
18
|
-
super("Would clobber #{item.segments.inspect}")
|
15
|
+
class UnregisteredStrategy < Error
|
16
|
+
def initialize(klass, type)
|
17
|
+
super("No #{klass} strategy is registered for #{type.inspect}")
|
19
18
|
end
|
20
|
-
|
21
|
-
attr_reader :item
|
22
19
|
end
|
23
20
|
|
24
21
|
class CantPopulate < Error
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Valise
|
2
|
+
module ItemEnum
|
3
|
+
include Enumerable
|
4
|
+
|
5
|
+
class Enumerator
|
6
|
+
include ItemEnum
|
7
|
+
|
8
|
+
def initialize(list, &filter)
|
9
|
+
@list = list
|
10
|
+
@filter = proc(&filter)
|
11
|
+
end
|
12
|
+
|
13
|
+
def each
|
14
|
+
@list.each do |item|
|
15
|
+
next unless @filter[item]
|
16
|
+
yield(item)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def writable
|
22
|
+
Enumerator.new(self) do |item|
|
23
|
+
item.writable?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def absent
|
28
|
+
Enumerator.new(self) do |item|
|
29
|
+
not item.present?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def present
|
34
|
+
Enumerator.new(self) do |item|
|
35
|
+
item.present?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/valise/item.rb
CHANGED
@@ -1,52 +1,15 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'valise/utils'
|
3
|
+
require 'valise/strategies/serialization'
|
3
4
|
|
4
5
|
module Valise
|
5
|
-
class Serialization
|
6
|
-
@@classes = {}
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def [](index)
|
10
|
-
@@classes[index]
|
11
|
-
end
|
12
|
-
|
13
|
-
def register(index)
|
14
|
-
@@classes[index] = self
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class Raw < Serialization
|
19
|
-
register :raw
|
20
|
-
|
21
|
-
def self.dump(value)
|
22
|
-
value
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.load(raw)
|
26
|
-
raw
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class YAML < Serialization
|
31
|
-
register :yaml
|
32
|
-
|
33
|
-
def self.dump(value)
|
34
|
-
::YAML::dump(value)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.load(raw)
|
38
|
-
::YAML::load(raw)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
6
|
class Item
|
44
7
|
include Unpath
|
45
8
|
|
46
9
|
def initialize(stack, root, dump_load)
|
47
10
|
@stack = stack
|
48
11
|
@root = root
|
49
|
-
@dump_load = dump_load
|
12
|
+
@dump_load = dump_load
|
50
13
|
@contents = nil
|
51
14
|
end
|
52
15
|
|
@@ -85,6 +48,10 @@ module Valise
|
|
85
48
|
File::open(full_path)
|
86
49
|
end
|
87
50
|
|
51
|
+
def raw_contents
|
52
|
+
@root.get_from(self)
|
53
|
+
end
|
54
|
+
|
88
55
|
def open(&block)
|
89
56
|
File::open(full_path, "r", &block)
|
90
57
|
end
|
@@ -104,11 +71,11 @@ module Valise
|
|
104
71
|
end
|
105
72
|
|
106
73
|
def dump_contents
|
107
|
-
@dump_load.dump(
|
74
|
+
@dump_load.dump(self) #@contents?
|
108
75
|
end
|
109
76
|
|
110
77
|
def load_contents
|
111
|
-
@contents ||= @dump_load.load(
|
78
|
+
@contents ||= @dump_load.load(self)
|
112
79
|
end
|
113
80
|
end
|
114
81
|
end
|
data/lib/valise/path-matcher.rb
CHANGED
@@ -3,6 +3,7 @@ require 'valise/utils'
|
|
3
3
|
module Valise
|
4
4
|
class PathMatcher
|
5
5
|
include Unpath
|
6
|
+
include Enumerable
|
6
7
|
|
7
8
|
def self.build(path, value = true)
|
8
9
|
case path
|
@@ -36,6 +37,12 @@ module Valise
|
|
36
37
|
yield(segments, @value) if @value
|
37
38
|
end
|
38
39
|
|
40
|
+
def each(prefix = [])
|
41
|
+
each_pair do |segments, value|
|
42
|
+
yield(segments) if !!value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
39
46
|
def merge!(other)
|
40
47
|
other.each_pair do |path, value|
|
41
48
|
self[path] = value
|
@@ -84,7 +91,7 @@ module Valise
|
|
84
91
|
case index
|
85
92
|
when "**"; DirGlob.new.tap{|m| @children << m}
|
86
93
|
when /.*[*].*/; FileGlob.new(index).tap{|m| @children << m}
|
87
|
-
else; PathMatcher.new(index).tap{|m| @children
|
94
|
+
else; PathMatcher.new(index).tap{|m| @children.unshift m}
|
88
95
|
end
|
89
96
|
target.store(segments, result)
|
90
97
|
end
|
@@ -102,9 +109,9 @@ module Valise
|
|
102
109
|
|
103
110
|
def access(segments)
|
104
111
|
if segments.empty?
|
105
|
-
return
|
112
|
+
return @value
|
106
113
|
else
|
107
|
-
|
114
|
+
retreive(segments) || access(segments.drop(1))
|
108
115
|
end
|
109
116
|
end
|
110
117
|
end
|
@@ -112,7 +119,7 @@ module Valise
|
|
112
119
|
class FileGlob < PathMatcher
|
113
120
|
def initialize(segment)
|
114
121
|
super
|
115
|
-
@regex = %r{^#{segment.gsub(/[*]/,".*")}$}
|
122
|
+
@regex = %r{^#{segment.gsub(/[.]/, "[.]").gsub(/[*]/,".*")}$}
|
116
123
|
end
|
117
124
|
|
118
125
|
def match?(segment)
|
data/lib/valise/search-root.rb
CHANGED
@@ -15,7 +15,15 @@ module Valise
|
|
15
15
|
|
16
16
|
attr_accessor :segments
|
17
17
|
|
18
|
-
|
18
|
+
#ALL_FILES = PathMatcher.build('**')
|
19
|
+
def each(pathmatch = nil)
|
20
|
+
# pathmatch ||= ALL_FILES
|
21
|
+
# files = pathmatch.fnmatchers(@segments).inject([]) do |list, fnmatch|
|
22
|
+
# list + Dir.glob(fnmatch).find_all{|path| File::file?(path)}
|
23
|
+
# end
|
24
|
+
# pathmatch.sort(files).each
|
25
|
+
#
|
26
|
+
#
|
19
27
|
paths = [[]]
|
20
28
|
until paths.empty?
|
21
29
|
rel = paths.shift
|
@@ -63,15 +71,6 @@ module Valise
|
|
63
71
|
return File::exists?(full_path(segments))
|
64
72
|
end
|
65
73
|
|
66
|
-
def insert(item)
|
67
|
-
if(File::exists?(item.full_path))
|
68
|
-
raise Errors::WouldClobber.new(Item.new(item.stack.segments, self, nil))
|
69
|
-
else
|
70
|
-
write(item)
|
71
|
-
return item
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
74
|
def get_from(item)
|
76
75
|
File::read(item.full_path)
|
77
76
|
end
|
@@ -85,10 +84,6 @@ module Valise
|
|
85
84
|
def write(item)
|
86
85
|
raise Errors::ReadOnly
|
87
86
|
end
|
88
|
-
|
89
|
-
def insert(item)
|
90
|
-
raise Errors::ReadOnly
|
91
|
-
end
|
92
87
|
end
|
93
88
|
|
94
89
|
class DefinedDefaults < ReadOnlySearchRoot
|
@@ -100,6 +95,10 @@ module Valise
|
|
100
95
|
raise Errors::VirtualSearchPath, "does not have a real path"
|
101
96
|
end
|
102
97
|
|
98
|
+
def full_path(segments)
|
99
|
+
"<DEFAULTS>:" + repath(segments)
|
100
|
+
end
|
101
|
+
|
103
102
|
def present?(segments)
|
104
103
|
@files.has_key?(segments)
|
105
104
|
end
|