closure 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +12 -12
- data/closure-compiler/README.md +503 -0
- data/closure-compiler/compiler.jar +0 -0
- data/closure-templates/SoyToJsSrcCompiler.jar +0 -0
- data/closure-templates/soyutils.js +1593 -469
- data/closure-templates/soyutils_usegoog.js +1105 -223
- data/docs/SCRIPT.md +5 -5
- data/docs/closure/Closure/BeanShell.html +63 -54
- data/docs/closure/Closure/Compiler/Compilation.html +124 -107
- data/docs/closure/Closure/Compiler/Error.html +28 -21
- data/docs/closure/Closure/Compiler.html +81 -76
- data/docs/closure/Closure/FileResponse.html +113 -98
- data/docs/closure/Closure/Goog.html +264 -253
- data/docs/closure/Closure/Middleware.html +66 -55
- data/docs/closure/Closure/Script/NotFound.html +28 -21
- data/docs/closure/Closure/Script/RenderStackOverflow.html +28 -21
- data/docs/closure/Closure/Script.html +212 -203
- data/docs/closure/Closure/Server.html +100 -90
- data/docs/closure/Closure/ShowExceptions.html +63 -52
- data/docs/closure/Closure/Sources.html +254 -246
- data/docs/closure/Closure/Templates/Error.html +28 -21
- data/docs/closure/Closure/Templates.html +88 -80
- data/docs/closure/Closure.html +181 -163
- data/docs/closure/_index.html +42 -38
- data/docs/closure/class_list.html +19 -8
- data/docs/closure/css/full_list.css +4 -2
- data/docs/closure/css/style.css +68 -51
- data/docs/closure/file.LICENSE.html +24 -217
- data/docs/closure/file.README.html +54 -47
- data/docs/closure/file_list.html +20 -9
- data/docs/closure/frames.html +18 -5
- data/docs/closure/index.html +54 -47
- data/docs/closure/js/app.js +60 -46
- data/docs/closure/js/full_list.js +24 -10
- data/docs/closure/js/jquery.js +4 -16
- data/docs/closure/method_list.html +74 -175
- data/docs/closure/top-level-namespace.html +29 -20
- data/lib/closure/compiler.rb +32 -42
- data/lib/closure/goog.rb +12 -12
- data/lib/closure/server.rb +6 -6
- data/lib/closure/show_exceptions.rb +15 -12
- data/lib/closure/version.rb +1 -1
- data/scripts/git.erb +183 -0
- data/scripts/hello/compiler.js.erb +2 -2
- data/scripts/hello/hello.js +1 -1
- data/scripts/hello/index.erb +6 -0
- data/scripts/hello/legume.js +12 -7
- data/scripts/index.erb +15 -13
- data/scripts/modules/compiler.js.erb +3 -3
- data/scripts/modules/compiler_build.js +3 -3
- data/scripts/modules/compiler_build.map +13 -12159
- data/scripts/modules/compiler_build_api.js +1 -1
- data/scripts/modules/compiler_build_app.js +74 -71
- data/scripts/modules/compiler_build_settings.js +2 -2
- data/scripts/modules/index.erb +5 -3
- data/scripts/modules/settings.js +1 -1
- data/scripts/svn.erb +11 -11
- data/scripts/welcome.erb +7 -6
- metadata +65 -81
- data/closure-compiler/README +0 -292
- data/scripts/hello/compiler_build.js +0 -5
- data/scripts/hello/compiler_build.map +0 -748
- data/scripts/hello/compiler_debug.js +0 -119
- data/scripts/modules/compiler_debug.js +0 -6
- data/scripts/modules/compiler_debug_api.js +0 -11
- data/scripts/modules/compiler_debug_app.js +0 -2414
- data/scripts/modules/compiler_debug_settings.js +0 -39
- data/scripts/rails/index.erb +0 -46
- data/scripts/rails/rails_ujs.js +0 -96
data/lib/closure/compiler.rb
CHANGED
@@ -14,15 +14,15 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
class Closure
|
17
|
-
|
17
|
+
|
18
18
|
class Compiler
|
19
|
-
|
19
|
+
|
20
20
|
class Error < StandardError
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
# Java won't let you change working directories and the Closure Compiler
|
24
24
|
# doesn't allow setting a base path. No problem, we can do it.
|
25
|
-
|
25
|
+
|
26
26
|
# These are filename options and will be expanded to a new base.
|
27
27
|
OUTPUT_OPTIONS = %w{
|
28
28
|
--js_output_file
|
@@ -32,7 +32,7 @@ class Closure
|
|
32
32
|
--variable_map_output_file
|
33
33
|
--module_output_path_prefix
|
34
34
|
}
|
35
|
-
|
35
|
+
|
36
36
|
# These are filename options and will be expanded to a new base.
|
37
37
|
# These will have their modification times checked against js_output_file.
|
38
38
|
INPUT_OPTIONS = %w{
|
@@ -41,7 +41,7 @@ class Closure
|
|
41
41
|
--property_map_input_file
|
42
42
|
--variable_map_input_file
|
43
43
|
}
|
44
|
-
|
44
|
+
|
45
45
|
# Compile Javascript. Checks file modification times
|
46
46
|
# but does not support namespaces like {Goog#compile} does.
|
47
47
|
# @param (Array) args Arguments for the compiler.
|
@@ -88,28 +88,18 @@ class Closure
|
|
88
88
|
end
|
89
89
|
Compilation.new(env, js_output_file, log) << stdout
|
90
90
|
end
|
91
|
-
|
92
|
-
|
91
|
+
|
92
|
+
|
93
93
|
class Compilation
|
94
94
|
attr_reader :log
|
95
95
|
attr_reader :js_output_file
|
96
|
-
|
96
|
+
|
97
97
|
def initialize(env, js_output_file=nil, log=nil)
|
98
98
|
@javascript = []
|
99
99
|
@env = env
|
100
100
|
@js_output_file = js_output_file
|
101
101
|
@log = log
|
102
102
|
end
|
103
|
-
|
104
|
-
# @private deprecated
|
105
|
-
def to_response_with_console
|
106
|
-
response = to_response
|
107
|
-
if response.class == Rack::Response
|
108
|
-
msg = "#to_response_with_console deprecated, use #to_response"
|
109
|
-
response.write "try{console.warn(#{msg.dump})}catch(err){};\n"
|
110
|
-
end
|
111
|
-
response
|
112
|
-
end
|
113
103
|
|
114
104
|
# Turn the compiled javascript into a Rack::Response object.
|
115
105
|
# Success and warning messages, which aren't raised like errors,
|
@@ -136,7 +126,7 @@ class Closure
|
|
136
126
|
end
|
137
127
|
response
|
138
128
|
end
|
139
|
-
|
129
|
+
|
140
130
|
# Appends a string to the javascript.
|
141
131
|
# @param [String] javascript
|
142
132
|
def <<(javascript)
|
@@ -156,10 +146,10 @@ class Closure
|
|
156
146
|
end
|
157
147
|
end
|
158
148
|
alias :to_s :javascript
|
159
|
-
|
149
|
+
|
160
150
|
end
|
161
|
-
|
162
|
-
|
151
|
+
|
152
|
+
|
163
153
|
# Closure Script extends compiler.jar by transforming the arguments in novel ways.
|
164
154
|
# The most obvious augmentation is to support --ns for compiling namespaces.
|
165
155
|
# We can also expand paths to a new base, work with modules, and much more.
|
@@ -183,8 +173,8 @@ class Closure
|
|
183
173
|
end
|
184
174
|
args
|
185
175
|
end
|
186
|
-
|
187
|
-
|
176
|
+
|
177
|
+
|
188
178
|
# The javascript snippet for module info
|
189
179
|
# @param [Array<Hash>] mods
|
190
180
|
def self.module_info(mods)
|
@@ -207,8 +197,8 @@ class Closure
|
|
207
197
|
end.join ",\n"
|
208
198
|
js += "\n};\n"
|
209
199
|
end
|
210
|
-
|
211
|
-
|
200
|
+
|
201
|
+
|
212
202
|
# The javascript snippet for compiled module file locations
|
213
203
|
# @param [Array<Hash>] mods
|
214
204
|
def self.module_uris_compiled(mods, sources, prefix)
|
@@ -219,8 +209,8 @@ class Closure
|
|
219
209
|
end.join ",\n"
|
220
210
|
js += "\n};\n"
|
221
211
|
end
|
222
|
-
|
223
|
-
|
212
|
+
|
213
|
+
|
224
214
|
# Main function to convert --ns arguments into --js arguments.
|
225
215
|
# Returns module info when modules are processed.
|
226
216
|
# @param [Array<String>] args
|
@@ -234,8 +224,8 @@ class Closure
|
|
234
224
|
end
|
235
225
|
mods
|
236
226
|
end
|
237
|
-
|
238
|
-
|
227
|
+
|
228
|
+
|
239
229
|
# Extracts the values for a options in the arguments.
|
240
230
|
# Use Array#last to emulate compiler.jar for single options.
|
241
231
|
# Will collect from an array of options.
|
@@ -248,17 +238,17 @@ class Closure
|
|
248
238
|
args_index = 0
|
249
239
|
while args_index < args.length
|
250
240
|
if options.include? args[args_index]
|
251
|
-
values << args[args_index+1]
|
241
|
+
values << args[args_index+1]
|
252
242
|
end
|
253
243
|
args_index = args_index + 2
|
254
244
|
end
|
255
245
|
values
|
256
246
|
end
|
257
|
-
|
258
|
-
|
247
|
+
|
248
|
+
|
259
249
|
private
|
260
|
-
|
261
|
-
|
250
|
+
|
251
|
+
|
262
252
|
# Converts --ns arguments into --js arguments
|
263
253
|
# @param [Array<String>] args
|
264
254
|
def self.module_augment(args, sources, mods, env)
|
@@ -285,8 +275,8 @@ class Closure
|
|
285
275
|
end
|
286
276
|
end
|
287
277
|
end
|
288
|
-
|
289
|
-
|
278
|
+
|
279
|
+
|
290
280
|
# Converts --ns arguments into --js arguments
|
291
281
|
# @param [Array<String>] args
|
292
282
|
def self.namespace_augment(args, sources, files, env)
|
@@ -309,7 +299,7 @@ class Closure
|
|
309
299
|
end
|
310
300
|
end
|
311
301
|
|
312
|
-
|
302
|
+
|
313
303
|
# Insanity-inducing recursive explorer to find common files in child modules.
|
314
304
|
# Try every branch in the tree and bubble up common files as we see them.
|
315
305
|
def self.walk_modules(sources, mods, env, seek=nil, mods_seen=[], files_seen=[])
|
@@ -344,7 +334,7 @@ class Closure
|
|
344
334
|
end
|
345
335
|
files
|
346
336
|
end
|
347
|
-
|
337
|
+
|
348
338
|
|
349
339
|
# @param [Array<String>] args
|
350
340
|
# @return [Array<Hash>] mods
|
@@ -362,7 +352,7 @@ class Closure
|
|
362
352
|
mod_args.unshift args.delete_at args_index
|
363
353
|
elsif option == '--module'
|
364
354
|
if mod_args.empty?
|
365
|
-
raise "No --js or --ns files for --module #{value}"
|
355
|
+
raise "No --js or --ns files for --module #{value}"
|
366
356
|
end
|
367
357
|
mod = value.split ':'
|
368
358
|
if mod[1] == '*'
|
@@ -392,7 +382,7 @@ class Closure
|
|
392
382
|
mods
|
393
383
|
end
|
394
384
|
end
|
395
|
-
|
385
|
+
|
396
386
|
end
|
397
387
|
end
|
398
388
|
end
|
data/lib/closure/goog.rb
CHANGED
@@ -14,9 +14,9 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
class Closure
|
17
|
-
|
17
|
+
|
18
18
|
# Scripts render with an instance named goog in the context.
|
19
|
-
|
19
|
+
|
20
20
|
class Goog
|
21
21
|
|
22
22
|
def initialize(env, sources, render_stack)
|
@@ -25,7 +25,7 @@ class Closure
|
|
25
25
|
@render_stack = render_stack
|
26
26
|
@dependencies = []
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
# You can add additional files to have their mtimes scanned.
|
30
30
|
# Perhaps you want to use a .yml file to define build options.
|
31
31
|
# Closure::Script calls this for every render so you don't need
|
@@ -34,13 +34,13 @@ class Closure
|
|
34
34
|
dependency = File.expand_path dependency, File.dirname(@render_stack.last)
|
35
35
|
@dependencies << dependency unless @dependencies.include? dependency
|
36
36
|
end
|
37
|
-
|
38
|
-
# If
|
37
|
+
|
38
|
+
# If your Script changes any javascript sources then call this.
|
39
39
|
# This is a lazy refresh, you may call it repeatedly.
|
40
40
|
def refresh
|
41
41
|
@sources.invalidate @env
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
# Convert soy templates to javascript. Accepts all arguments that
|
45
45
|
# SoyToJsSrcCompiler.jar support plus it expands filename globs.
|
46
46
|
# All source filenames are relative to the script calling #soy_to_js.
|
@@ -125,11 +125,11 @@ class Closure
|
|
125
125
|
ensure
|
126
126
|
if pre_js_tempfile
|
127
127
|
pre_js_tempfile.close
|
128
|
-
pre_js_tempfile.unlink
|
128
|
+
pre_js_tempfile.unlink
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
# Calculate the deps src for a filename.
|
134
134
|
# @param (String) filename
|
135
135
|
# @return (String) http path info with forward caching query.
|
@@ -159,7 +159,7 @@ class Closure
|
|
159
159
|
def base_js
|
160
160
|
@sources.base_js(@env)
|
161
161
|
end
|
162
|
-
|
162
|
+
|
163
163
|
# This is where base.js looks to find deps.js by default. You will always
|
164
164
|
# be served a Closure Script generated deps.js from this location.
|
165
165
|
# Very old Library versions may get confused by the forward caching query
|
@@ -183,12 +183,12 @@ class Closure
|
|
183
183
|
# @example
|
184
184
|
# goog.each {|directory, path| ... }
|
185
185
|
def each
|
186
|
-
@sources.each do |directory, path|
|
186
|
+
@sources.each do |directory, path|
|
187
187
|
yield directory, path
|
188
188
|
end
|
189
189
|
end
|
190
190
|
include Enumerable
|
191
|
-
|
191
|
+
|
192
192
|
end
|
193
|
-
|
193
|
+
|
194
194
|
end
|
data/lib/closure/server.rb
CHANGED
@@ -21,9 +21,9 @@ class Closure
|
|
21
21
|
# sources = Closure::Sources.new
|
22
22
|
# sources.add '/myapp', '../src'
|
23
23
|
# run Closure::Server.new sources
|
24
|
-
|
24
|
+
|
25
25
|
class Server
|
26
|
-
|
26
|
+
|
27
27
|
# @param (Sources) sources An instance configured with your scripts.
|
28
28
|
# @param (home_page) home_page Optional file or closure-script to serve as root.
|
29
29
|
def initialize(sources, home_page = nil)
|
@@ -31,7 +31,7 @@ class Closure
|
|
31
31
|
@home_page = home_page
|
32
32
|
@working_dir = Dir.getwd
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
# Rack interface.
|
36
36
|
# @param (Hash) env Rack environment.
|
37
37
|
# @return (Array)[status, headers, body]
|
@@ -74,9 +74,9 @@ class Closure
|
|
74
74
|
end
|
75
75
|
not_found
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
private
|
79
|
-
|
79
|
+
|
80
80
|
# Status 404 with X-Cascade => pass.
|
81
81
|
# @return (Array)[status, headers, body]
|
82
82
|
def not_found
|
@@ -90,5 +90,5 @@ class Closure
|
|
90
90
|
end
|
91
91
|
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
class Closure
|
17
|
-
|
17
|
+
|
18
18
|
# This is Rack middleware to show Ruby exceptions. It is automatically loaded when
|
19
19
|
# using Closure::Middleware. It works very much like Rack::ShowExceptions but will
|
20
20
|
# use the Javascript console when it can detect the request was for javascript.
|
@@ -22,9 +22,9 @@ class Closure
|
|
22
22
|
# If Javascript detection isn't working because you're not using .js.erb for the
|
23
23
|
# extension, add this as the first line of your script:
|
24
24
|
# <% @response.headers['Content-Type'] = 'application/javascript' %>
|
25
|
-
|
25
|
+
|
26
26
|
class ShowExceptions
|
27
|
-
|
27
|
+
|
28
28
|
# @private - internal use only
|
29
29
|
class Javascript
|
30
30
|
def initialize(app)
|
@@ -36,7 +36,7 @@ class Closure
|
|
36
36
|
rescue Closure::Compiler::Error => e
|
37
37
|
raise e unless env[Script::ENV_ERROR_CONTENT_TYPE] == 'application/javascript'
|
38
38
|
body = 'try{console.error('
|
39
|
-
body += '"Closure Compiler: %s\n
|
39
|
+
body += '"Closure Compiler: %s\n", '
|
40
40
|
body += "#{e.message.rstrip.dump}"
|
41
41
|
body += ')}catch(err){}'
|
42
42
|
body
|
@@ -47,7 +47,7 @@ class Closure
|
|
47
47
|
rescue Closure::Templates::Error => e
|
48
48
|
raise e unless env[Script::ENV_ERROR_CONTENT_TYPE] == 'application/javascript'
|
49
49
|
body = 'try{console.error('
|
50
|
-
body += '"Closure Templates: 1 error(s)\n
|
50
|
+
body += '"Closure Templates: 1 error(s)\n$s", '
|
51
51
|
body += "#{e.message.rstrip.dump}"
|
52
52
|
body += ')}catch(err){}'
|
53
53
|
body
|
@@ -58,10 +58,13 @@ class Closure
|
|
58
58
|
rescue StandardError, LoadError, SyntaxError => e
|
59
59
|
raise e unless env[Script::ENV_ERROR_CONTENT_TYPE] == 'application/javascript'
|
60
60
|
body = 'try{console.error('
|
61
|
-
|
62
|
-
|
61
|
+
if e.class.to_s == e.message.rstrip
|
62
|
+
body += '"Closure Script: %s\n%s", '
|
63
|
+
else
|
64
|
+
body += '"Closure Script: %s\n\n%s\n\n%s", '
|
65
|
+
body += "#{e.class.to_s.dump}, "
|
66
|
+
end
|
63
67
|
body += "#{e.message.rstrip.dump}, "
|
64
|
-
body += '"\n\n", '
|
65
68
|
body += "#{e.backtrace.join("\n").dump}"
|
66
69
|
body += ')}catch(err){}'
|
67
70
|
body
|
@@ -70,14 +73,14 @@ class Closure
|
|
70
73
|
"Content-Length" => body.size.to_s},
|
71
74
|
[body]]
|
72
75
|
end
|
73
|
-
|
76
|
+
|
74
77
|
end
|
75
|
-
|
78
|
+
|
76
79
|
# @private - internal use only
|
77
80
|
class Html < Rack::ShowExceptions
|
78
81
|
#TODO make our own someday
|
79
82
|
end
|
80
|
-
|
83
|
+
|
81
84
|
def initialize(app)
|
82
85
|
@app = Html.new(Javascript.new(app))
|
83
86
|
end
|
@@ -87,4 +90,4 @@ class Closure
|
|
87
90
|
end
|
88
91
|
end
|
89
92
|
|
90
|
-
end
|
93
|
+
end
|
data/lib/closure/version.rb
CHANGED
data/scripts/git.erb
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
<%
|
2
|
+
# Copyright 2011 The Closure Script Authors
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'rexml/document'
|
17
|
+
require 'thread'
|
18
|
+
|
19
|
+
# This is an example of a complex Closure Script.
|
20
|
+
# It would be easier to read and more performant if split up
|
21
|
+
# into an includable .rb file and multiple templates.
|
22
|
+
# But speed isn't a problem and the single file format makes
|
23
|
+
# it just a touch easier to share and move around.
|
24
|
+
|
25
|
+
# Example usage:
|
26
|
+
# render 'git', :git_name => 'Closure Library', :git_path => 'closure-library',
|
27
|
+
# :git_url => 'http://closure-library.googlecode.com/git/trunk/'
|
28
|
+
#
|
29
|
+
# Include as many as you want and they can all be updating at once.
|
30
|
+
# Don't supply any locals if you just want Closure::Git for manual use.
|
31
|
+
|
32
|
+
class Closure::Git
|
33
|
+
|
34
|
+
# Repository objects are held in global class variable.
|
35
|
+
# Checking out runs in a background thread.
|
36
|
+
# repo = Closure::Git['lib-folder', 'http://git.example.org/trunk']
|
37
|
+
@repos ||= {}
|
38
|
+
def self.[](path, url=nil, name=nil)
|
39
|
+
repo = @repos[path]
|
40
|
+
raise "url and name requried for setup" if !repo and (!url or !name)
|
41
|
+
repo = @repos[path] ||= new(path, url)
|
42
|
+
repo.name ||= url
|
43
|
+
repo.name = name if name
|
44
|
+
repo
|
45
|
+
end
|
46
|
+
|
47
|
+
# Configurable Subversion shell command
|
48
|
+
def self.git; @git ||= 'git'; end
|
49
|
+
def self.git=(git); @git = git; end
|
50
|
+
|
51
|
+
def initialize(path, url)
|
52
|
+
@semaphore = Mutex.new
|
53
|
+
@running = false
|
54
|
+
@path = path
|
55
|
+
@url = url
|
56
|
+
@name = ''
|
57
|
+
@log = nil
|
58
|
+
end
|
59
|
+
|
60
|
+
attr_reader :running
|
61
|
+
attr_reader :path
|
62
|
+
attr_reader :url
|
63
|
+
attr_accessor :name
|
64
|
+
attr_accessor :log
|
65
|
+
|
66
|
+
# Update or checkout a Git repository.
|
67
|
+
# Closure Script is thread-safe and so is this.
|
68
|
+
# Although the locks in Subversion would prevent it
|
69
|
+
# from corrupting (one would hope), we don't want our
|
70
|
+
# global object to be in an indeterminate state with two
|
71
|
+
# threads running because submit was hit twice.
|
72
|
+
def update(version='TODO')
|
73
|
+
@semaphore.synchronize do
|
74
|
+
return if running
|
75
|
+
@running = true
|
76
|
+
Thread.new do
|
77
|
+
@log = "Cloning. Stand by..."
|
78
|
+
@local_revision = 'CLONING'
|
79
|
+
cmd = "#{self.class.git.dump} clone #{url.dump} #{path.dump}"
|
80
|
+
@log = "$ #{cmd}\n" + `#{cmd} 2>&1`
|
81
|
+
@local_revision = nil
|
82
|
+
@running = false
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def info(location)
|
88
|
+
result = `#{self.class.git.dump} -C #{location.dump} name-rev --name-only HEAD`
|
89
|
+
return result if $? == 0
|
90
|
+
return nil
|
91
|
+
end
|
92
|
+
|
93
|
+
def local_revision
|
94
|
+
return @local_revision if @local_revision
|
95
|
+
@local_revision = info(path)
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
if defined? git_path and defined? git_url and defined? git_name
|
102
|
+
git = Closure::Git[git_path, git_url, git_name]
|
103
|
+
if defined? git_update
|
104
|
+
git.update git_update
|
105
|
+
end
|
106
|
+
elsif params['git_path']
|
107
|
+
git = Closure::Git[params['git_path']]
|
108
|
+
if post?
|
109
|
+
git.update params['git_update']
|
110
|
+
response.redirect params['return_to']
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
if get? and git and render_stack.size > 1
|
116
|
+
is_running = !!git.running
|
117
|
+
action = expand_src File.join File.dirname(__FILE__), File.basename(__FILE__, File.extname(__FILE__))
|
118
|
+
-%>
|
119
|
+
<form action='<%=h action %>' method="post">
|
120
|
+
<input type="hidden" name="git_path" value="<%=h git_path %>" size="8" />
|
121
|
+
<input type="hidden" name="return_to" value="<%=h path %>" size="8" />
|
122
|
+
|
123
|
+
<%=h git.name %>
|
124
|
+
<% if is_running -%>
|
125
|
+
is cloning.
|
126
|
+
<% elsif git.local_revision -%>
|
127
|
+
installed: <%=h git.local_revision %>
|
128
|
+
<% else -%>
|
129
|
+
not installed.
|
130
|
+
<% end -%>
|
131
|
+
|
132
|
+
|
133
|
+
<% if is_running %>
|
134
|
+
<% unless @git_document_reload_on_page
|
135
|
+
@git_document_reload_on_page = true -%>
|
136
|
+
<script type="text/javascript" charset="utf-8">
|
137
|
+
setTimeout("document.location.reload()", 2500);
|
138
|
+
</script>
|
139
|
+
<% end
|
140
|
+
elsif !git.local_revision -%>
|
141
|
+
<input type="submit" value="Clone" />
|
142
|
+
|
143
|
+
<% end -%>
|
144
|
+
|
145
|
+
<% if is_running -%>
|
146
|
+
Stand by...
|
147
|
+
<% elsif git.log -%>
|
148
|
+
<% unless git.local_revision -%>
|
149
|
+
<span style="color:red">ERROR: </span>
|
150
|
+
<% end -%>
|
151
|
+
<a href="<%= action %>?git_path=<%=u git.path %>&return_to=<%=u path %>">VIEW LOG</a>
|
152
|
+
<% end -%>
|
153
|
+
|
154
|
+
</form>
|
155
|
+
<% elsif get? and git -%>
|
156
|
+
<!DOCTYPE html>
|
157
|
+
<html>
|
158
|
+
<head>
|
159
|
+
<style type="text/css" media="screen">
|
160
|
+
body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
|
161
|
+
select,input,button,textarea,button{font:99% arial,helvetica,clean,sans-serif;}
|
162
|
+
table{font-size:inherit;font:100%;}
|
163
|
+
pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
|
164
|
+
th {text-align: right; padding: 2px 10px 2px 0px}
|
165
|
+
</style>
|
166
|
+
</head>
|
167
|
+
<body>
|
168
|
+
<a href="<%=h params['return_to'] %>">Back</a>
|
169
|
+
<h1><%=h git.name %></h1>
|
170
|
+
<table border="0" cellspacing="0" cellpadding="0">
|
171
|
+
<tr><th>Local folder:</th><td><%=h git.path %></td></tr>
|
172
|
+
<tr><th>Local revision:</th><td><%=h git.local_revision %></td></tr>
|
173
|
+
<tr><th>Repository URL:</th><td><%=h git.url %></td></tr>
|
174
|
+
</table>
|
175
|
+
<% if git.log -%>
|
176
|
+
<h2>Results of last run:</h2>
|
177
|
+
<pre><%=h git.log %></pre>
|
178
|
+
<a href="<%=h params['return_to'] %>">Back</a>
|
179
|
+
<% git.log = nil %>
|
180
|
+
<% end -%>
|
181
|
+
</body>
|
182
|
+
</html>
|
183
|
+
<% end -%>
|
@@ -1,10 +1,10 @@
|
|
1
|
-
<%
|
1
|
+
<%
|
2
2
|
# Closure Compiler is run from a Script. To obtain
|
3
3
|
# the dynamically generated javascript from this file:
|
4
4
|
# http://localhost:8080/hello/compiler.js
|
5
5
|
|
6
6
|
# These are the same options as compiler.jar. Two exceptions:
|
7
|
-
# 1. No --compilation_level will load the original sources
|
7
|
+
# 1. No --compilation_level will load the original sources
|
8
8
|
# instead of using the compiler.jar default.
|
9
9
|
# 2. The --ns argument compiles a namespace. Closure Script simply
|
10
10
|
# turns these into --js arguments before calling the compiler.
|
data/scripts/hello/hello.js
CHANGED
data/scripts/hello/index.erb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
+
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
5
|
+
<meta content="utf-8" http-equiv="encoding">
|
6
|
+
<style type="text/css" media="screen">
|
7
|
+
html {font-family: sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;}
|
8
|
+
button,input,optgroup,select,textarea {font-family: sans-serif; font-size: inherit;}
|
9
|
+
</style>
|
4
10
|
<script src='compiler.js?<%= query_string %>'></script>
|
5
11
|
</head>
|
6
12
|
<body>
|
data/scripts/hello/legume.js
CHANGED
@@ -1,20 +1,25 @@
|
|
1
1
|
// This file was automatically generated from legume.soy.
|
2
2
|
// Please don't edit this file by hand.
|
3
3
|
|
4
|
+
/**
|
5
|
+
* @fileoverview Templates in namespace myapp.legume.
|
6
|
+
*/
|
7
|
+
|
4
8
|
goog.provide('myapp.legume');
|
5
9
|
|
6
10
|
goog.require('soy');
|
7
|
-
goog.require('
|
11
|
+
goog.require('soydata');
|
8
12
|
|
9
13
|
|
10
14
|
/**
|
11
15
|
* @param {Object.<string, *>=} opt_data
|
12
|
-
* @param {
|
16
|
+
* @param {(null|undefined)=} opt_ignored
|
13
17
|
* @return {string}
|
14
|
-
* @
|
18
|
+
* @suppress {checkTypes|uselessCode}
|
15
19
|
*/
|
16
|
-
myapp.legume.hello = function(opt_data,
|
17
|
-
|
18
|
-
output.append('\tHello ', soy.$$escapeHtml(opt_data.subject), '!');
|
19
|
-
return opt_sb ? '' : output.toString();
|
20
|
+
myapp.legume.hello = function(opt_data, opt_ignored) {
|
21
|
+
return 'Hello ' + soy.$$escapeHtml(opt_data.subject) + '!';
|
20
22
|
};
|
23
|
+
if (goog.DEBUG) {
|
24
|
+
myapp.legume.hello.soyTemplateName = 'myapp.legume.hello';
|
25
|
+
}
|