sproutcore 1.6.0.1-java → 1.7.1.beta-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +21 -0
- data/Gemfile +5 -0
- data/Rakefile +26 -13
- data/VERSION.yml +2 -2
- data/lib/Buildfile +43 -4
- data/lib/buildtasks/build.rake +10 -0
- data/lib/buildtasks/helpers/file_rule.rb +22 -0
- data/lib/buildtasks/helpers/file_rule_list.rb +137 -0
- data/lib/buildtasks/manifest.rake +133 -122
- data/lib/frameworks/sproutcore/CHANGELOG.md +69 -2
- data/lib/frameworks/sproutcore/apps/tests/english.lproj/strings.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -22
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +9 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +18 -13
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/action_support.js +80 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +84 -116
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +8 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +157 -157
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +10 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +106 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +71 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/attribute_bindings_test.js +38 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/class_name_bindings_test.js +47 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutChildViews.js +18 -18
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +42 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +158 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +26 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +14 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +15 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +108 -108
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +26 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +4 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +6 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +26 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +97 -96
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +17 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +12 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +23 -14
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +5 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/render_delegates/menu_scroller.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/tests/menu/scroll.js +235 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +363 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroller.js +250 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/desktop_scroller.js +92 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/native_scroll.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/scroll.js +33 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/touch_scroller.js +76 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/integration.js +50 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/methods.js +143 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/ui.js +258 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +1164 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroller.js +332 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +236 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroller.js +347 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroll.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroller.js +10 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +804 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroller.js +133 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +3 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/number.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/media/views/media_slider.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/media/views/video.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +29 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
- data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/segmented.css +1 -1
- data/lib/gen/app/templates/apps/@target_name@/Buildfile +3 -5
- data/lib/gen/app/templates/apps/@target_name@/resources/_theme.css +18 -0
- data/lib/gen/project/templates/@filename@/Buildfile +2 -2
- data/lib/sproutcore.rb +30 -5
- data/lib/sproutcore/builders.rb +1 -0
- data/lib/sproutcore/builders/chance_file.rb +9 -16
- data/lib/sproutcore/builders/html.rb +2 -1
- data/lib/sproutcore/builders/minify.rb +4 -35
- data/lib/sproutcore/builders/module.rb +38 -1
- data/lib/sproutcore/builders/split.rb +63 -0
- data/lib/sproutcore/builders/strings.rb +7 -1
- data/lib/sproutcore/helpers.rb +1 -1
- data/lib/sproutcore/helpers/css_split.rb +190 -0
- data/lib/sproutcore/helpers/entry_sorter.rb +2 -0
- data/lib/sproutcore/helpers/minifier.rb +40 -16
- data/lib/sproutcore/helpers/static_helper.rb +35 -17
- data/lib/sproutcore/models/manifest.rb +26 -0
- data/lib/sproutcore/models/target.rb +12 -1
- data/lib/sproutcore/rack.rb +1 -0
- data/lib/sproutcore/rack/proxy.rb +244 -225
- data/lib/sproutcore/rack/restrict_ip.rb +67 -0
- data/lib/sproutcore/rack/service.rb +8 -2
- data/lib/sproutcore/tools.rb +102 -46
- data/lib/sproutcore/tools/build.rb +91 -43
- data/lib/sproutcore/tools/gen.rb +2 -3
- data/lib/sproutcore/tools/manifest.rb +22 -16
- data/lib/sproutcore/tools/server.rb +21 -0
- data/spec/buildtasks/helpers/accept_list +22 -0
- data/spec/buildtasks/helpers/accept_list.rb +128 -0
- data/spec/buildtasks/helpers/list.json +11 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/chance_2x_spec.rb +1 -39
- data/spec/buildtasks/manifest/prepare_build_tasks/chance_spec.rb +0 -38
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +4 -4
- data/spec/buildtasks/manifest/prepare_build_tasks/module_spec.rb +2 -2
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_2x_indirect_spec.rb +7 -16
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_2x_spec.rb +7 -17
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +11 -6
- data/spec/fixtures/builder_tests/Buildfile +2 -1
- data/spec/fixtures/builder_tests/apps/module_test/modules/required_module/core.js +0 -0
- data/spec/lib/builders/module_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/sproutcore.gemspec +4 -9
- data/vendor/chance/lib/chance.rb +25 -6
- data/vendor/chance/lib/chance/factory.rb +45 -0
- data/vendor/chance/lib/chance/instance.rb +173 -28
- data/vendor/chance/lib/chance/instance/data_url.rb +0 -29
- data/vendor/chance/lib/chance/instance/slicing.rb +57 -4
- data/vendor/chance/lib/chance/instance/spriting.rb +112 -21
- data/vendor/chance/lib/chance/parser.rb +80 -52
- data/vendor/sproutcore/SCCompiler.jar +0 -0
- data/vendor/sproutcore/lib/args4j-2.0.12.jar +0 -0
- data/vendor/sproutcore/lib/yuicompressor-2.4.2.jar +0 -0
- metadata +84 -25
@@ -0,0 +1,67 @@
|
|
1
|
+
# ===========================================================================
|
2
|
+
# Project: Abbot - SproutCore Build Tools
|
3
|
+
# Copyright: ©2009-2011 Apple Inc.
|
4
|
+
# portions copyright @2006-2011 Strobe Inc.
|
5
|
+
# and contributors
|
6
|
+
# ===========================================================================
|
7
|
+
|
8
|
+
# For all those working in internet cafes...
|
9
|
+
# We feel for you. Go to a real cafe instead. They have internet, too.
|
10
|
+
module SC
|
11
|
+
module Rack
|
12
|
+
class RestrictIP
|
13
|
+
def initialize(app, allow_ips=[])
|
14
|
+
@app = app
|
15
|
+
@allow = allow_ips
|
16
|
+
end
|
17
|
+
|
18
|
+
# checks if an IP, such as 127.0.0.1, matches a mask, such as 127.*.*.*
|
19
|
+
def ip_is_valid(ip, mask)
|
20
|
+
ip_parts = ip.split('.')
|
21
|
+
mask_parts = mask.split('.')
|
22
|
+
|
23
|
+
if mask_parts.length != 4
|
24
|
+
SC.logger.fatal "Invalid IP mask: #{mask}\n"
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
|
28
|
+
ip_idx = 0
|
29
|
+
mask_parts.each {|mask_part|
|
30
|
+
ip_part = ip_parts[ip_idx]
|
31
|
+
|
32
|
+
# * means anything matches
|
33
|
+
if mask_part == '*'
|
34
|
+
next
|
35
|
+
end
|
36
|
+
|
37
|
+
if ip_part != mask_part
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
|
41
|
+
ip_idx = ip_idx + 1
|
42
|
+
}
|
43
|
+
|
44
|
+
return true
|
45
|
+
end
|
46
|
+
|
47
|
+
def call(env)
|
48
|
+
ip = env['REMOTE_ADDR']
|
49
|
+
|
50
|
+
is_valid = false
|
51
|
+
@allow.each {|mask|
|
52
|
+
if ip_is_valid(ip, mask)
|
53
|
+
is_valid = true
|
54
|
+
break
|
55
|
+
end
|
56
|
+
}
|
57
|
+
|
58
|
+
if is_valid
|
59
|
+
return @app.call(env)
|
60
|
+
else
|
61
|
+
SC.logger << "Blocked connection attempt by ip: #{ip}\n"
|
62
|
+
return [403, { 'Content-Type' => 'text/plain' }, "YOU CANNOT BEEZ HERE."]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -59,7 +59,7 @@ module SC
|
|
59
59
|
self.filesystem = opts[:Filesystem]
|
60
60
|
|
61
61
|
projects = opts.delete(:projects) || [opts.delete(:project)].compact
|
62
|
-
app = self.new(*projects)
|
62
|
+
app = self.new(*projects, opts)
|
63
63
|
|
64
64
|
opts[:Host] ||= opts[:host] # allow either case.
|
65
65
|
opts[:Port] ||= opts[:port] || '4020'
|
@@ -93,7 +93,7 @@ module SC
|
|
93
93
|
server.run app, opts
|
94
94
|
end
|
95
95
|
|
96
|
-
def initialize(*projects)
|
96
|
+
def initialize(*projects, opts)
|
97
97
|
@projects = projects.flatten
|
98
98
|
|
99
99
|
# Get apps for each project & cascade if needed
|
@@ -105,6 +105,12 @@ module SC
|
|
105
105
|
@app = ::Rack::ConditionalGet.new(@app)
|
106
106
|
#@app = ::Rack::Deflater.new(@app)
|
107
107
|
|
108
|
+
# preprocess IPs so we can restrict properly
|
109
|
+
ips = opts[:allow_from_ips] || '127.0.0.1'
|
110
|
+
SC.logger << "Allowing access only from IPs: #{ips}. Use --allow-from-ips='*.*.*.*' to allow all\n"
|
111
|
+
ips = ips.split(',')
|
112
|
+
|
113
|
+
@app = SC::Rack::RestrictIP.new(@app, ips)
|
108
114
|
end
|
109
115
|
|
110
116
|
def call(env); @app.call(env); end
|
data/lib/sproutcore/tools.rb
CHANGED
@@ -32,17 +32,27 @@ module SC
|
|
32
32
|
|
33
33
|
# All sproutcore tools can take some standard options. These are
|
34
34
|
# processed automatically when the tool is loaded
|
35
|
-
class_option "project",
|
36
|
-
class_option "mode",
|
37
|
-
class_option "logfile",
|
38
|
-
class_option "build",
|
39
|
-
class_option "build-targets"
|
40
|
-
|
41
|
-
|
42
|
-
class_option "
|
43
|
-
|
44
|
-
|
45
|
-
class_option "
|
35
|
+
class_option "project", :type => :string
|
36
|
+
class_option "mode", :type => :string
|
37
|
+
class_option "logfile", :type => :string
|
38
|
+
class_option "build", :type => :string, :aliases => "-b"
|
39
|
+
class_option "build-targets",:type => :string,
|
40
|
+
:desc => "Targets to build (excluding their dependencies)"
|
41
|
+
|
42
|
+
class_option "yui-minification", :type => :boolean,
|
43
|
+
:desc => "Deprecated. Does nothing."
|
44
|
+
|
45
|
+
class_option "dont-minify", :type => :boolean,
|
46
|
+
:desc => "Disables minification for the build."
|
47
|
+
|
48
|
+
class_option "verbose", :type => :boolean, :aliases => "-v"
|
49
|
+
class_option "very-verbose", :type => :boolean, :aliases => "-V"
|
50
|
+
|
51
|
+
class_option "library", :type => :string, #deprecated
|
52
|
+
:desc => "Deprecated."
|
53
|
+
class_option "environment", :type => :string, #deprecated
|
54
|
+
:desc => "Deprecated."
|
55
|
+
class_option "help", :type => :boolean
|
46
56
|
|
47
57
|
default_task :banner
|
48
58
|
|
@@ -199,6 +209,20 @@ module SC
|
|
199
209
|
end
|
200
210
|
end
|
201
211
|
|
212
|
+
# This is the root project, so we must also load the "include targets" used to
|
213
|
+
# make additional frameworks available to SC apps.
|
214
|
+
SC.include_targets.each {|target|
|
215
|
+
target_path = File.expand_path target[:path]
|
216
|
+
target_name = File.join "/", target[:name]
|
217
|
+
|
218
|
+
# Note: target names must begin with / to be valid.
|
219
|
+
t = ret.add_target target_name, :framework, { :source_root => target_path }
|
220
|
+
|
221
|
+
if t.config[:allow_nested_targets]
|
222
|
+
ret.find_targets_for(target_path, target_name, t.config)
|
223
|
+
end
|
224
|
+
}
|
225
|
+
|
202
226
|
info "Loaded project at: #{ret.project_root}" unless ret.nil?
|
203
227
|
@project = ret
|
204
228
|
end
|
@@ -269,26 +293,6 @@ module SC
|
|
269
293
|
targets = tar
|
270
294
|
end
|
271
295
|
|
272
|
-
# If include required was specified, merge in all required bundles as
|
273
|
-
# well. Note that we do this whether --build-targets is specified or not.
|
274
|
-
if options[:'include-required']
|
275
|
-
tar = targets.clone
|
276
|
-
targets.each do |target|
|
277
|
-
required = target.expand_required_targets :theme => true,
|
278
|
-
:debug => target.config.load_debug,
|
279
|
-
:tests => target.config.load_tests
|
280
|
-
|
281
|
-
required.each {|t|
|
282
|
-
t.config[:minify_javascript] = false if not targets.include? t
|
283
|
-
}
|
284
|
-
|
285
|
-
tar += required
|
286
|
-
end
|
287
|
-
|
288
|
-
targets = tar.flatten.uniq.compact
|
289
|
-
end
|
290
|
-
|
291
|
-
|
292
296
|
targets
|
293
297
|
|
294
298
|
end
|
@@ -342,35 +346,87 @@ module SC
|
|
342
346
|
SC.logger.info "Using build numbers: #{numbers.map { |k,v| "#{k}: #{v}" }.join(',')}"
|
343
347
|
end
|
344
348
|
end
|
345
|
-
|
346
|
-
|
347
|
-
# Shared by sc-manifest, sc-build and sc-docs commands.
|
348
|
-
def build_manifests(*targets)
|
349
|
-
|
349
|
+
|
350
|
+
def each_manifest_for_targets(*targets)
|
350
351
|
# setup build numbers
|
351
352
|
find_build_numbers(*targets)
|
352
353
|
|
353
354
|
requires_project! # get project
|
355
|
+
|
354
356
|
targets = find_targets(*targets) # get targets
|
355
|
-
languages = find_languages(*targets) # get languages
|
356
357
|
|
357
358
|
# log output
|
358
359
|
SC.logger.info "Building targets: #{targets.map { |t| t.target_name } * ","}"
|
360
|
+
|
361
|
+
languages = find_languages(*targets) # get languages
|
359
362
|
SC.logger.info "Building languages: #{ languages * "," }"
|
363
|
+
|
364
|
+
index = 1
|
365
|
+
count = targets.length * languages.length
|
366
|
+
SC.logger.info "Total target/language combinations to build: #{count}"
|
367
|
+
|
368
|
+
targets.each {|target|
|
369
|
+
languages.each {|l|
|
370
|
+
manifest = target.manifest_for :language => l
|
371
|
+
SC.logger.info "Creating manifest #{index} of #{count} for: #{manifest.target.target_name}:#{manifest.language}"
|
372
|
+
|
373
|
+
yield manifest
|
374
|
+
|
375
|
+
index += 1
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
end
|
360
380
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
end
|
365
|
-
manifests.flatten!
|
366
|
-
|
381
|
+
# Core method to process command line options and then build a manifest.
|
382
|
+
# Shared by sc-manifest, sc-build and sc-docs commands.
|
383
|
+
def build_manifests(*targets)
|
367
384
|
# Build'em
|
368
|
-
|
369
|
-
SC.logger.info "Building manifest for: #{manifest.target.target_name}:#{manifest.language}"
|
385
|
+
each_manifest_for_targets(*targets) do |manifest|
|
370
386
|
manifest.build!
|
387
|
+
|
388
|
+
yield manifest
|
371
389
|
end
|
390
|
+
end
|
391
|
+
|
392
|
+
# Loops over all of the manifest's entries and builds all essential entries.
|
393
|
+
# Entries such as javascript.js are considered non-essential because they will
|
394
|
+
# not actually be used in a fully built app (except for modules).
|
395
|
+
#
|
396
|
+
# It also does a check to ensure that all JS being written is minified.
|
397
|
+
def build_entries_for_manifest(manifest, allow_comments)
|
398
|
+
if manifest.entries.size > 0
|
399
|
+
target = manifest.target
|
400
|
+
info "Building entries for #{target.target_name}:#{manifest.language}..."
|
401
|
+
|
402
|
+
# we ONLY generate non-packed javascript.js files for modules, which may need
|
403
|
+
# to lazily load them. Otherwise: NOPE!
|
404
|
+
generate_javascript = false
|
405
|
+
if target[:target_type] === :module
|
406
|
+
generate_javascript = true
|
407
|
+
end
|
372
408
|
|
373
|
-
|
409
|
+
target_build_root = Pathname.new(manifest.target.project.project_root)
|
410
|
+
manifest.entries.each do |entry|
|
411
|
+
# Skip combined JS when it is a target that doesn't need it.
|
412
|
+
# We can't just skip all non-packed JS, because you can use sc_resource to split
|
413
|
+
# the JS out, and that won't work properly. :combine, likewise, is used for sc_resource.
|
414
|
+
# So, we skip the entry IF it is javascript.js--because that is how the pack task itself
|
415
|
+
# knows the difference.
|
416
|
+
next if not generate_javascript and entry[:filename] == 'javascript.js'
|
417
|
+
|
418
|
+
# For security, skip AND WARN about files which are not minified
|
419
|
+
if not SC.env[:dont_minify] and not allow_comments and entry[:entry_type] == :javascript and not entry[:minified]
|
420
|
+
SC.logger.fatal "SECURITY: Entry not minified: #{entry[:filename]}; target: #{target[:target_name]}"
|
421
|
+
SC.logger.fatal "All entries must be minified in a final build UNLESS --allow-commented-js argument is supplied."
|
422
|
+
exit(1)
|
423
|
+
end
|
424
|
+
|
425
|
+
dst = Pathname.new(entry.build_path).relative_path_from(target_build_root)
|
426
|
+
info " #{entry.filename} -> #{dst}"
|
427
|
+
entry.build!
|
428
|
+
end
|
429
|
+
end
|
374
430
|
end
|
375
431
|
|
376
432
|
# Logs the contents of the passed file path to the logger
|
@@ -13,49 +13,70 @@ $to_html5_manifest_networks = []
|
|
13
13
|
|
14
14
|
module SC
|
15
15
|
class Tools
|
16
|
-
|
16
|
+
|
17
17
|
desc "build [TARGET..]", "Builds one or more targets"
|
18
|
-
|
18
|
+
|
19
|
+
# Standard manifest options. Used by build tool as well.
|
20
|
+
method_option :languages, :type => :string,
|
21
|
+
:desc => "The languages to build."
|
22
|
+
|
23
|
+
method_option :symlink, :default => false
|
24
|
+
|
25
|
+
method_option :buildroot, :type => :string,
|
26
|
+
:desc => "The path to build to."
|
27
|
+
method_option :stageroot, :type => :string,
|
28
|
+
:aliases => %w(--target -t),
|
29
|
+
:desc => "The path to stage to."
|
30
|
+
method_option :format, :type => :string
|
31
|
+
method_option :output, :type => :string
|
32
|
+
method_option :all, :type => false
|
33
|
+
method_option :build_numbers, :type => :string, :aliases => ['-B'],
|
34
|
+
:desc => "The identifier(s) for the build."
|
35
|
+
method_option :include_required, :default => false, :aliases => '-r',
|
36
|
+
:desc => "Deprecated. All builds build dependencies."
|
37
|
+
|
38
|
+
|
19
39
|
method_option :entries, :type => :string
|
20
|
-
method_option :
|
21
|
-
|
22
|
-
method_option :
|
40
|
+
method_option :whitelist, :type => :string,
|
41
|
+
:desc => "The whitelist to use when building. By default, Whitelist (if present)"
|
42
|
+
method_option :blacklist, :type => :string,
|
43
|
+
:desc => "The blacklist to use when building. By default, Blacklist (if present)"
|
44
|
+
method_option :accept, :type => :string,
|
45
|
+
:desc => "The SproutCore Accept file to determine which files to include. By default, Accept (if present)"
|
46
|
+
method_option :allow_commented_js, :type => :boolean,
|
47
|
+
:desc => "If supplied, commented JS will be allowed into the build."
|
23
48
|
def build(*targets)
|
49
|
+
if options.help
|
50
|
+
help('build')
|
51
|
+
return
|
52
|
+
end
|
53
|
+
|
24
54
|
t1 = Time.now
|
25
55
|
SC.logger.info 'Starting build process...'
|
26
56
|
# Copy some key props to the env
|
57
|
+
SC.env.whitelist_name = options.whitelist
|
58
|
+
SC.env.blacklist_name = options.blacklist
|
59
|
+
SC.env.accept_name = options.accept
|
27
60
|
SC.env.build_prefix = options.buildroot if options.buildroot
|
28
61
|
SC.env.staging_prefix = options.stageroot if options.stageroot
|
29
62
|
SC.env.use_symlink = options.symlink
|
30
|
-
SC.env.clean = options.clean
|
31
63
|
|
32
64
|
# Get entries option
|
33
65
|
entry_filters = nil
|
34
66
|
if options[:entries]
|
35
67
|
entry_filters = options[:entries].split(',')
|
36
68
|
end
|
37
|
-
|
69
|
+
|
70
|
+
# We want Chance to clear files like sprites immediately after they're asked for,
|
71
|
+
# because we'll only need them once during a build.
|
72
|
+
Chance.clear_files_immediately
|
73
|
+
|
38
74
|
# Get the manifests to build
|
39
|
-
manifests = build_manifests(*targets)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
if SC.env.clean
|
45
|
-
manifests.each do |manifest|
|
46
|
-
build_root = manifest.target.build_root
|
47
|
-
info "Cleaning #{build_root}"
|
48
|
-
FileUtils.rm_r(build_root) if File.directory?(build_root)
|
49
|
-
|
50
|
-
staging_root = manifest.target.staging_root
|
51
|
-
info "Cleaning #{staging_root}"
|
52
|
-
FileUtils.rm_r(staging_root) if File.directory?(staging_root)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# Now build entries for each manifest...
|
57
|
-
manifests.each do |manifest|
|
58
|
-
|
75
|
+
manifests = build_manifests(*targets) do |manifest|
|
76
|
+
# This is our own logic to prevent processing a manifest twice
|
77
|
+
next if manifest[:built_by_builder]
|
78
|
+
manifest[:built_by_builder] = true
|
79
|
+
|
59
80
|
# get entries. If "entries" option was specified, use to filter
|
60
81
|
# filename. Must match end of filename.
|
61
82
|
entries = manifest.entries
|
@@ -71,24 +92,49 @@ module SC
|
|
71
92
|
end
|
72
93
|
|
73
94
|
# if there are entries to build, log and build
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
95
|
+
build_entries_for_manifest manifest, options.allow_commented_js
|
96
|
+
|
97
|
+
# Build dependencies
|
98
|
+
target = manifest.target
|
99
|
+
required = target.expand_required_targets :theme => true,
|
100
|
+
:debug => target.config.load_debug,
|
101
|
+
:tests => target.config.load_tests,
|
102
|
+
|
103
|
+
# Modules are not 'required' technically, as they may be loaded
|
104
|
+
# lazily. However, we want to know all targets that should be built,
|
105
|
+
# so we'll include modules as well.
|
106
|
+
:modules => true
|
107
|
+
|
108
|
+
|
109
|
+
required.each {|t|
|
110
|
+
m = t.manifest_for (manifest.variation)
|
111
|
+
|
112
|
+
|
113
|
+
# And, yes, the same as above. We're just building entries for all required targets.
|
114
|
+
# We're also going to mark them as fully-built so they don't get built again.
|
115
|
+
next if m[:built_by_builder]
|
116
|
+
m[:built_by_builder] = true
|
117
|
+
m.build!
|
118
|
+
|
119
|
+
build_entries_for_manifest m, options.allow_commented_js
|
120
|
+
|
121
|
+
|
122
|
+
}
|
123
|
+
|
124
|
+
# Clean up
|
125
|
+
manifest.reset!
|
126
|
+
Chance::ChanceFactory.clear_instances
|
85
127
|
end
|
86
128
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
129
|
+
# The HTML5 manifest generator does not work properly; it is unstable (can cause crashes)
|
130
|
+
# and won't pick up modules. We need an alternative implemenation, preferably one that uses
|
131
|
+
# Abbot's own manifests to figure out what files are required. This is non-trivial, however.
|
132
|
+
#
|
133
|
+
# if $to_html5_manifest.length > 0
|
134
|
+
# $to_html5_manifest.each do |entry|
|
135
|
+
# SC::Helpers::HTML5Manifest.new.build(entry)
|
136
|
+
# end
|
137
|
+
# end
|
92
138
|
|
93
139
|
SC::Helpers::Minifier.wait
|
94
140
|
|
@@ -98,5 +144,7 @@ module SC
|
|
98
144
|
seconds = seconds%60
|
99
145
|
puts 'Build time '+minutes.floor.to_s+ ' minutes '+seconds.floor.to_s+' secs'
|
100
146
|
end
|
147
|
+
|
101
148
|
end
|
149
|
+
|
102
150
|
end
|