closure 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -218,9 +218,9 @@ background process. You’re only limited by your imagination.</p>
218
218
  </div></div>
219
219
 
220
220
  <div id="footer">
221
- Generated on Fri Mar 18 15:12:13 2016 by
221
+ Generated on Wed Jan 25 12:33:30 2017 by
222
222
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
223
- 0.8.7.6 (ruby-2.2.1).
223
+ 0.8.7.6 (ruby-2.1.8).
224
224
  </div>
225
225
 
226
226
  </body>
@@ -218,9 +218,9 @@ background process. You’re only limited by your imagination.</p>
218
218
  </div></div>
219
219
 
220
220
  <div id="footer">
221
- Generated on Fri Mar 18 15:12:13 2016 by
221
+ Generated on Wed Jan 25 12:33:30 2017 by
222
222
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
223
- 0.8.7.6 (ruby-2.2.1).
223
+ 0.8.7.6 (ruby-2.1.8).
224
224
  </div>
225
225
 
226
226
  </body>
@@ -94,8 +94,8 @@
94
94
 
95
95
 
96
96
  <li class="r2 ">
97
- <span class='object_link'><a href="Closure/ShowExceptions.html#call-instance_method" title="Closure::ShowExceptions#call (method)">#call</a></span>
98
- <small>Closure::ShowExceptions</small>
97
+ <span class='object_link'><a href="Closure/Server.html#call-instance_method" title="Closure::Server#call (method)">#call</a></span>
98
+ <small>Closure::Server</small>
99
99
  </li>
100
100
 
101
101
 
@@ -106,8 +106,8 @@
106
106
 
107
107
 
108
108
  <li class="r2 ">
109
- <span class='object_link'><a href="Closure/Server.html#call-instance_method" title="Closure::Server#call (method)">#call</a></span>
110
- <small>Closure::Server</small>
109
+ <span class='object_link'><a href="Closure/ShowExceptions.html#call-instance_method" title="Closure::ShowExceptions#call (method)">#call</a></span>
110
+ <small>Closure::ShowExceptions</small>
111
111
  </li>
112
112
 
113
113
 
@@ -148,14 +148,14 @@
148
148
 
149
149
 
150
150
  <li class="r1 ">
151
- <span class='object_link'><a href="Closure/Sources.html#deps_response-instance_method" title="Closure::Sources#deps_response (method)">#deps_response</a></span>
152
- <small>Closure::Sources</small>
151
+ <span class='object_link'><a href="Closure/Goog.html#deps_response-instance_method" title="Closure::Goog#deps_response (method)">#deps_response</a></span>
152
+ <small>Closure::Goog</small>
153
153
  </li>
154
154
 
155
155
 
156
156
  <li class="r2 ">
157
- <span class='object_link'><a href="Closure/Goog.html#deps_response-instance_method" title="Closure::Goog#deps_response (method)">#deps_response</a></span>
158
- <small>Closure::Goog</small>
157
+ <span class='object_link'><a href="Closure/Sources.html#deps_response-instance_method" title="Closure::Sources#deps_response (method)">#deps_response</a></span>
158
+ <small>Closure::Sources</small>
159
159
  </li>
160
160
 
161
161
 
@@ -184,59 +184,59 @@
184
184
 
185
185
 
186
186
  <li class="r1 ">
187
+ <span class='object_link'><a href="Closure.html#exclude-class_method" title="Closure.exclude (method)">exclude</a></span>
188
+ <small>Closure</small>
189
+ </li>
190
+
191
+
192
+ <li class="r2 ">
187
193
  <span class='object_link'><a href="Closure/Script.html#expand_path-instance_method" title="Closure::Script#expand_path (method)">#expand_path</a></span>
188
194
  <small>Closure::Script</small>
189
195
  </li>
190
196
 
191
197
 
192
- <li class="r2 ">
198
+ <li class="r1 ">
193
199
  <span class='object_link'><a href="Closure/Script.html#expand_src-instance_method" title="Closure::Script#expand_src (method)">#expand_src</a></span>
194
200
  <small>Closure::Script</small>
195
201
  </li>
196
202
 
197
203
 
198
- <li class="r1 ">
204
+ <li class="r2 ">
199
205
  <span class='object_link'><a href="Closure/FileResponse.html#filename-instance_method" title="Closure::FileResponse#filename (method)">#filename</a></span>
200
206
  <small>Closure::FileResponse</small>
201
207
  </li>
202
208
 
203
209
 
204
- <li class="r2 ">
210
+ <li class="r1 ">
205
211
  <span class='object_link'><a href="Closure/Sources.html#files_for-instance_method" title="Closure::Sources#files_for (method)">#files_for</a></span>
206
212
  <small>Closure::Sources</small>
207
213
  </li>
208
214
 
209
215
 
210
- <li class="r1 ">
216
+ <li class="r2 ">
211
217
  <span class='object_link'><a href="Closure/Goog.html#files_for-instance_method" title="Closure::Goog#files_for (method)">#files_for</a></span>
212
218
  <small>Closure::Goog</small>
213
219
  </li>
214
220
 
215
221
 
216
- <li class="r2 ">
222
+ <li class="r1 ">
217
223
  <span class='object_link'><a href="Closure/FileResponse.html#finish-instance_method" title="Closure::FileResponse#finish (method)">#finish</a></span>
218
224
  <small>Closure::FileResponse</small>
219
225
  </li>
220
226
 
221
227
 
222
- <li class="r1 ">
228
+ <li class="r2 ">
223
229
  <span class='object_link'><a href="Closure/FileResponse.html#found%3F-instance_method" title="Closure::FileResponse#found? (method)">#found?</a></span>
224
230
  <small>Closure::FileResponse</small>
225
231
  </li>
226
232
 
227
233
 
228
- <li class="r2 ">
234
+ <li class="r1 ">
229
235
  <span class='object_link'><a href="Closure/Script.html#goog-instance_method" title="Closure::Script#goog (method)">#goog</a></span>
230
236
  <small>Closure::Script</small>
231
237
  </li>
232
238
 
233
239
 
234
- <li class="r1 ">
235
- <span class='object_link'><a href="Closure/Server.html#initialize-instance_method" title="Closure::Server#initialize (method)">#initialize</a></span>
236
- <small>Closure::Server</small>
237
- </li>
238
-
239
-
240
240
  <li class="r2 ">
241
241
  <span class='object_link'><a href="Closure/Goog.html#initialize-instance_method" title="Closure::Goog#initialize (method)">#initialize</a></span>
242
242
  <small>Closure::Goog</small>
@@ -244,14 +244,14 @@
244
244
 
245
245
 
246
246
  <li class="r1 ">
247
- <span class='object_link'><a href="Closure/Sources.html#initialize-instance_method" title="Closure::Sources#initialize (method)">#initialize</a></span>
248
- <small>Closure::Sources</small>
247
+ <span class='object_link'><a href="Closure/BeanShell.html#initialize-instance_method" title="Closure::BeanShell#initialize (method)">#initialize</a></span>
248
+ <small>Closure::BeanShell</small>
249
249
  </li>
250
250
 
251
251
 
252
252
  <li class="r2 ">
253
- <span class='object_link'><a href="Closure/ShowExceptions.html#initialize-instance_method" title="Closure::ShowExceptions#initialize (method)">#initialize</a></span>
254
- <small>Closure::ShowExceptions</small>
253
+ <span class='object_link'><a href="Closure/Sources.html#initialize-instance_method" title="Closure::Sources#initialize (method)">#initialize</a></span>
254
+ <small>Closure::Sources</small>
255
255
  </li>
256
256
 
257
257
 
@@ -262,59 +262,71 @@
262
262
 
263
263
 
264
264
  <li class="r2 ">
265
- <span class='object_link'><a href="Closure/Middleware.html#initialize-instance_method" title="Closure::Middleware#initialize (method)">#initialize</a></span>
266
- <small>Closure::Middleware</small>
265
+ <span class='object_link'><a href="Closure/ShowExceptions.html#initialize-instance_method" title="Closure::ShowExceptions#initialize (method)">#initialize</a></span>
266
+ <small>Closure::ShowExceptions</small>
267
267
  </li>
268
268
 
269
269
 
270
270
  <li class="r1 ">
271
- <span class='object_link'><a href="Closure/Compiler/Compilation.html#initialize-instance_method" title="Closure::Compiler::Compilation#initialize (method)">#initialize</a></span>
272
- <small>Closure::Compiler::Compilation</small>
271
+ <span class='object_link'><a href="Closure/Script.html#initialize-instance_method" title="Closure::Script#initialize (method)">#initialize</a></span>
272
+ <small>Closure::Script</small>
273
273
  </li>
274
274
 
275
275
 
276
276
  <li class="r2 ">
277
- <span class='object_link'><a href="Closure/Script.html#initialize-instance_method" title="Closure::Script#initialize (method)">#initialize</a></span>
278
- <small>Closure::Script</small>
277
+ <span class='object_link'><a href="Closure/Compiler/Compilation.html#initialize-instance_method" title="Closure::Compiler::Compilation#initialize (method)">#initialize</a></span>
278
+ <small>Closure::Compiler::Compilation</small>
279
279
  </li>
280
280
 
281
281
 
282
282
  <li class="r1 ">
283
- <span class='object_link'><a href="Closure/BeanShell.html#initialize-instance_method" title="Closure::BeanShell#initialize (method)">#initialize</a></span>
284
- <small>Closure::BeanShell</small>
283
+ <span class='object_link'><a href="Closure/Middleware.html#initialize-instance_method" title="Closure::Middleware#initialize (method)">#initialize</a></span>
284
+ <small>Closure::Middleware</small>
285
285
  </li>
286
286
 
287
287
 
288
288
  <li class="r2 ">
289
+ <span class='object_link'><a href="Closure/Server.html#initialize-instance_method" title="Closure::Server#initialize (method)">#initialize</a></span>
290
+ <small>Closure::Server</small>
291
+ </li>
292
+
293
+
294
+ <li class="r1 ">
289
295
  <span class='object_link'><a href="Closure/Sources.html#invalidate-instance_method" title="Closure::Sources#invalidate (method)">#invalidate</a></span>
290
296
  <small>Closure::Sources</small>
291
297
  </li>
292
298
 
293
299
 
294
- <li class="r1 ">
300
+ <li class="r2 ">
295
301
  <span class='object_link'><a href="Closure/Compiler/Compilation.html#javascript-instance_method" title="Closure::Compiler::Compilation#javascript (method)">#javascript</a></span>
296
302
  <small>Closure::Compiler::Compilation</small>
297
303
  </li>
298
304
 
299
305
 
300
- <li class="r2 ">
306
+ <li class="r1 ">
301
307
  <span class='object_link'><a href="Closure/Compiler/Compilation.html#js_output_file-instance_method" title="Closure::Compiler::Compilation#js_output_file (method)">#js_output_file</a></span>
302
308
  <small>Closure::Compiler::Compilation</small>
303
309
  </li>
304
310
 
305
311
 
306
- <li class="r1 ">
312
+ <li class="r2 ">
307
313
  <span class='object_link'><a href="Closure/Compiler/Compilation.html#log-instance_method" title="Closure::Compiler::Compilation#log (method)">#log</a></span>
308
314
  <small>Closure::Compiler::Compilation</small>
309
315
  </li>
310
316
 
311
317
 
312
- <li class="r2 ">
318
+ <li class="r1 ">
313
319
  <span class='object_link'><a href="Closure/Sources.html#namespaces_for-instance_method" title="Closure::Sources#namespaces_for (method)">#namespaces_for</a></span>
314
320
  <small>Closure::Sources</small>
315
321
  </li>
316
322
 
317
323
 
324
+ <li class="r2 ">
325
+ <span class='object_link'><a href="Closure/Goog.html#path%3D-instance_method" title="Closure::Goog#path= (method)">#path=</a></span>
326
+ <small>Closure::Goog</small>
327
+ </li>
328
+
329
+
318
330
  <li class="r1 ">
319
331
  <span class='object_link'><a href="Closure/Goog.html#refresh-instance_method" title="Closure::Goog#refresh (method)">#refresh</a></span>
320
332
  <small>Closure::Goog</small>
@@ -364,14 +376,14 @@
364
376
 
365
377
 
366
378
  <li class="r1 ">
367
- <span class='object_link'><a href="Closure/Sources.html#src_for-instance_method" title="Closure::Sources#src_for (method)">#src_for</a></span>
368
- <small>Closure::Sources</small>
379
+ <span class='object_link'><a href="Closure/Goog.html#src_for-instance_method" title="Closure::Goog#src_for (method)">#src_for</a></span>
380
+ <small>Closure::Goog</small>
369
381
  </li>
370
382
 
371
383
 
372
384
  <li class="r2 ">
373
- <span class='object_link'><a href="Closure/Goog.html#src_for-instance_method" title="Closure::Goog#src_for (method)">#src_for</a></span>
374
- <small>Closure::Goog</small>
385
+ <span class='object_link'><a href="Closure/Sources.html#src_for-instance_method" title="Closure::Sources#src_for (method)">#src_for</a></span>
386
+ <small>Closure::Sources</small>
375
387
  </li>
376
388
 
377
389
 
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Fri Mar 18 15:12:13 2016 by
106
+ Generated on Wed Jan 25 12:33:30 2017 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.7.6 (ruby-2.2.1).
108
+ 0.8.7.6 (ruby-2.1.8).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -267,47 +267,47 @@ class Closure
267
267
  @sources.each do |dir, path|
268
268
  dir_range = (dir.length..-1)
269
269
  Dir.glob(File.join(dir,'**','*.js')).each do |filename|
270
- dep = (@files[filename] ||= {})
271
- dep.delete(:not_found)
270
+ file = (@files[filename] ||= {})
271
+ file.delete(:not_found)
272
272
  mtime = File.mtime(filename)
273
273
  if previous_goog_base_filename == filename
274
- if dep[:mtime] == mtime
274
+ if file[:mtime] == mtime
275
275
  multiple_base_js_failure if goog
276
276
  goog = @goog
277
277
  end
278
278
  previous_goog_base_filename = nil
279
279
  end
280
- if dep[:mtime] != mtime
280
+ if path and !file.has_key?(:path)
281
+ raise unless filename.index(dir) == 0 # glob sanity
282
+ file[:path] = "#{path}#{filename.slice(dir_range)}"
283
+ added_files << filename unless file[:excluded]
284
+ end
285
+ if !path or file[:excluded]
286
+ file[:excluded] = true
287
+ file[:provide] = file[:require] = []
288
+ elsif file[:mtime] != mtime
281
289
  @deps = {}
282
- file = File.read filename
283
- old_dep_provide = dep[:provide]
284
- dep[:provide] = file.scan(PROVIDE_REGEX).flatten.uniq
285
- old_dep_require = dep[:require]
286
- dep[:require] = file.scan(REQUIRE_REGEX).flatten.uniq
287
- if !dep.has_key? :path
288
- raise unless filename.index(dir) == 0 # glob sanity
289
- if path
290
- dep[:path] = "#{path}#{filename.slice(dir_range)}"
291
- else
292
- dep[:path] = nil
293
- end
294
- added_files << filename
295
- elsif old_dep_provide != dep[:provide] or old_dep_require != dep[:require]
290
+ old_file_provide = file[:provide]
291
+ old_file_require = file[:require]
292
+ file_text = File.read filename
293
+ file[:provide] = file_text.scan(PROVIDE_REGEX).flatten.uniq
294
+ file[:require] = file_text.scan(REQUIRE_REGEX).flatten.uniq
295
+ if old_file_provide != file[:provide] or old_file_require != file[:require]
296
296
  # We're changed only if the provides or requires changes.
297
297
  # Other edits to the files don't actually alter the dependencies.
298
298
  changed_files << filename
299
299
  end
300
- dep[:mtime] = mtime
300
+ file[:mtime] = mtime
301
301
  # Record goog as we pass by
302
- if dep[:provide].empty? and dep[:require].empty?
302
+ if file[:provide].empty? and file[:require].empty?
303
303
  if File.basename(filename) == 'base.js'
304
- if file =~ BASE_JS_REGEX
304
+ if file_text =~ BASE_JS_REGEX
305
305
  multiple_base_js_failure if goog
306
306
  goog = {:base_filename => filename}
307
- if dep[:path]
308
- goog[:base_js] = dep[:path]
307
+ if file[:path]
308
+ goog[:base_js] = file[:path]
309
309
  goog[:base_js_mtime] = mtime
310
- goog[:deps_js] = dep[:path].gsub(/base.js$/, 'deps.js')
310
+ goog[:deps_js] = file[:path].gsub(/base.js$/, 'deps.js')
311
311
  end
312
312
  end
313
313
  end
@@ -14,5 +14,5 @@
14
14
 
15
15
 
16
16
  class Closure
17
- VERSION = "1.5.3"
17
+ VERSION = "1.5.4"
18
18
  end
data/lib/closure.rb CHANGED
@@ -50,12 +50,12 @@ class Closure
50
50
  # @example
51
51
  # Closure.add_source :soy, '/soy_js'
52
52
  # Closure.add_source './myapp', '/myapp'
53
- # @overload add_source(directory, path=nil)
54
- # @overload add_source(built_in, path=nil)
53
+ # @overload add_source(directory, path)
54
+ # @overload add_source(built_in, path)
55
55
  # @param (String) path http server mount point.
56
56
  # @param (String) directory Where the scripts are in the filesystem.
57
57
  # @param (Symbol) built_in
58
- def self.add_source(directory, path=nil)
58
+ def self.add_source(directory, path)
59
59
  if directory.kind_of? Symbol
60
60
  dir = BUILT_INS[directory]
61
61
  raise "Unknown built-in: #{directory}" unless dir
@@ -66,6 +66,15 @@ class Closure
66
66
  end
67
67
 
68
68
 
69
+ # Easy config. Exclude a subdirectories of sources.
70
+ # This is typically used to exclude the build folder
71
+ # for whitespace builds (which contain "goog.provide").
72
+ def self.exclude(directory)
73
+ # no check if exists, build may create later
74
+ sources.add directory, nil
75
+ end
76
+
77
+
69
78
  # This is a global instance of sources, configured with Closure.add_source()
70
79
  # and used for {Closure Script::Middleware} by default.
71
80
  # Path and directory pairs configured with Closure.add_source().
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: closure
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Turnbull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-20 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: 1.3.6
131
131
  requirements: []
132
132
  rubyforge_project:
133
- rubygems_version: 2.4.6
133
+ rubygems_version: 2.4.8
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Google Closure Compiler, Library, Script, and Templates.