sproutcore 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +70 -2
- data/Manifest.txt +3 -15
- data/config/hoe.rb +1 -1
- data/frameworks/sproutcore/animation/animation.js +411 -0
- data/frameworks/sproutcore/controllers/array.js +68 -21
- data/frameworks/sproutcore/controllers/object.js +21 -2
- data/frameworks/sproutcore/drag/drag.js +13 -4
- data/frameworks/sproutcore/drag/drop_target.js +26 -19
- data/frameworks/sproutcore/english.lproj/core.css +4 -0
- data/frameworks/sproutcore/english.lproj/strings.js +5 -0
- data/frameworks/sproutcore/english.lproj/theme.css +5 -0
- data/frameworks/sproutcore/foundation/application.js +1 -2
- data/frameworks/sproutcore/foundation/set.js +31 -12
- data/frameworks/sproutcore/foundation/sorted_set.js +590 -0
- data/frameworks/sproutcore/foundation/string.js +43 -9
- data/frameworks/sproutcore/globals/window.js +34 -9
- data/frameworks/sproutcore/lib/button_views.rb +1 -0
- data/frameworks/sproutcore/lib/collection_view.rb +1 -0
- data/frameworks/sproutcore/lib/core_views.rb +3 -0
- data/frameworks/sproutcore/lib/index.rhtml +1 -1
- data/frameworks/sproutcore/mixins/collection_view_delegate.js +201 -0
- data/frameworks/sproutcore/mixins/observable.js +2 -7
- data/frameworks/sproutcore/models/record.js +1 -1
- data/frameworks/sproutcore/models/store.js +81 -28
- data/frameworks/sproutcore/tests/views/view/clippingFrame.rhtml +9 -6
- data/frameworks/sproutcore/views/collection/collection.js +649 -211
- data/frameworks/sproutcore/views/collection/grid.js +62 -26
- data/frameworks/sproutcore/views/collection/list.js +57 -21
- data/frameworks/sproutcore/views/collection/source_list.js +61 -13
- data/frameworks/sproutcore/views/image.js +7 -0
- data/frameworks/sproutcore/views/inline_text_field.js +4 -5
- data/frameworks/sproutcore/views/slider.js +2 -0
- data/frameworks/sproutcore/views/view.js +2 -2
- data/lib/sproutcore/build_tools/html_builder.rb +4 -6
- data/lib/sproutcore/build_tools/resource_builder.rb +32 -20
- data/lib/sproutcore/bundle.rb +130 -32
- data/lib/sproutcore/bundle_manifest.rb +24 -21
- data/lib/sproutcore/helpers/static_helper.rb +22 -9
- data/lib/sproutcore/merb/bundle_controller.rb +4 -3
- data/lib/sproutcore/version.rb +1 -1
- metadata +14 -17
- data/clients/view_builder/builders/builder.js +0 -339
- data/clients/view_builder/builders/button.js +0 -81
- data/clients/view_builder/controllers/document.js +0 -21
- data/clients/view_builder/core.js +0 -19
- data/clients/view_builder/english.lproj/body.css +0 -77
- data/clients/view_builder/english.lproj/body.rhtml +0 -39
- data/clients/view_builder/english.lproj/controls.css +0 -0
- data/clients/view_builder/english.lproj/strings.js +0 -14
- data/clients/view_builder/main.js +0 -38
- data/clients/view_builder/mixins/design_mode.js +0 -92
- data/clients/view_builder/tests/controllers/document.rhtml +0 -20
- data/clients/view_builder/tests/views/builder.rhtml +0 -20
- data/clients/view_builder/tests/views/palette.rhtml +0 -21
- data/clients/view_builder/views/builder.js +0 -26
- data/clients/view_builder/views/palette.js +0 -30
@@ -2,8 +2,6 @@ require 'erubis'
|
|
2
2
|
require 'sproutcore/helpers'
|
3
3
|
require 'sproutcore/view_helpers'
|
4
4
|
|
5
|
-
puts "LOADED HTML_BUILDER"
|
6
|
-
|
7
5
|
module SproutCore
|
8
6
|
|
9
7
|
module BuildTools
|
@@ -49,9 +47,7 @@ module SproutCore
|
|
49
47
|
@entries.reject! { |entry| entry.composite? || (entry.type == :html && !entry.localized?) }
|
50
48
|
|
51
49
|
# Load any helpers before we continue
|
52
|
-
puts "*************REQUIRE"
|
53
50
|
bundle.all_required_bundles.each do |cur_bundle|
|
54
|
-
puts "requiring: #{cur_bundle.bundle_name}"
|
55
51
|
require_helpers(nil, cur_bundle)
|
56
52
|
end
|
57
53
|
|
@@ -63,11 +59,13 @@ module SproutCore
|
|
63
59
|
|
64
60
|
@layout_path = bundle.layout_path
|
65
61
|
|
66
|
-
# Render each filename. By default, the output goes to the resources
|
62
|
+
# Render each filename. By default, the output goes to the resources
|
63
|
+
# string
|
67
64
|
@content_for_resources = ''
|
68
65
|
entries.each { |fn| _render_one(fn) }
|
69
66
|
|
70
|
-
# Finally, render the layout. This should produce the final output to
|
67
|
+
# Finally, render the layout. This should produce the final output to
|
68
|
+
# return
|
71
69
|
input = File.read(@layout_path)
|
72
70
|
return eval(Erubis::Eruby.new.convert(input))
|
73
71
|
end
|
@@ -53,12 +53,23 @@ module SproutCore
|
|
53
53
|
return join(lines)
|
54
54
|
end
|
55
55
|
|
56
|
-
# Join the lines together. This is one last chance to do some prep of
|
57
|
-
# (such as minifcation and comment stripping)
|
56
|
+
# Join the lines together. This is one last chance to do some prep of
|
57
|
+
# the data (such as minifcation and comment stripping)
|
58
58
|
def join(lines); lines.join; end
|
59
59
|
|
60
|
-
#
|
61
|
-
#
|
60
|
+
# Rewrites any inline content such as static urls. Subclasseses can
|
61
|
+
# override this to rewrite any other inline content.
|
62
|
+
#
|
63
|
+
# The default will rewrite calls to static_url().
|
64
|
+
def rewrite_inline_code(line, filename)
|
65
|
+
line.gsub(/static_url\([\'\"](.+)[\'\"]\)/) do | rsrc |
|
66
|
+
entry = bundle.find_resource_entry($1, :language => language)
|
67
|
+
static_url(entry.nil? ? '' : entry.url)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Tries to build a single resource. This may call itself recursively to
|
72
|
+
# handle requires.
|
62
73
|
#
|
63
74
|
# ==== Returns
|
64
75
|
# [lines, required] to be passed into the next call
|
@@ -77,19 +88,19 @@ module SproutCore
|
|
77
88
|
io = (entry.source_path.nil? || !File.exists?(entry.source_path)) ? [] : File.new(entry.source_path)
|
78
89
|
io.each do | line |
|
79
90
|
|
80
|
-
# check for requires. Only follow a require if the require is in
|
81
|
-
# of filenames.
|
91
|
+
# check for requires. Only follow a require if the require is in
|
92
|
+
# the list of filenames.
|
82
93
|
required_file = _require_for(filename, line)
|
83
94
|
unless required_file.nil? || !filenames.include?(required_file)
|
84
95
|
lines, required = _build_one(required_file, lines, required, link_only)
|
85
96
|
end
|
86
97
|
|
87
|
-
file_lines <<
|
98
|
+
file_lines << rewrite_inline_code(line, filename) unless link_only
|
88
99
|
end
|
89
100
|
|
90
|
-
# The list of already required filenames is slightly out of order from
|
91
|
-
# load order. Instead, we use the lines array to hold the
|
92
|
-
# are processed.
|
101
|
+
# The list of already required filenames is slightly out of order from
|
102
|
+
# the actual load order. Instead, we use the lines array to hold the
|
103
|
+
# list of filenames as they are processed.
|
93
104
|
if link_only
|
94
105
|
lines << filename
|
95
106
|
|
@@ -104,16 +115,8 @@ module SproutCore
|
|
104
115
|
# Overridden by subclasses to choose first filename.
|
105
116
|
def next_filename; filenames.delete(filenames.first); end
|
106
117
|
|
107
|
-
#
|
108
|
-
#
|
109
|
-
def _rewrite_static_urls(line)
|
110
|
-
line.gsub(/static_url\([\'\"](.+)[\'\"]\)/) do | rsrc |
|
111
|
-
entry = bundle.find_resource_entry($1, :language => language)
|
112
|
-
static_url(entry.nil? ? '' : entry.url)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
# Overridden by subclass to handle static_url() in a language specific way.
|
118
|
+
# Overridden by subclass to handle static_url() in a language specific
|
119
|
+
# way.
|
117
120
|
def static_url(url); "url('#{url}')"; end
|
118
121
|
|
119
122
|
# check line for required() pattern. understands JS and CSS.
|
@@ -156,6 +159,15 @@ module SproutCore
|
|
156
159
|
lines.join
|
157
160
|
end
|
158
161
|
|
162
|
+
# If the file is a strings.js file, then remove server-side strings...
|
163
|
+
def rewrite_inline_code(line, filename)
|
164
|
+
if filename == 'strings.js'
|
165
|
+
line = line.gsub(/["']@@.*["']\s*?:\s*?["'].*["'],\s*$/,'')
|
166
|
+
end
|
167
|
+
|
168
|
+
super(line, filename)
|
169
|
+
end
|
170
|
+
|
159
171
|
def static_url(url); "'#{url}'"; end
|
160
172
|
def filename_for_require(ret); "#{ret}.js"; end
|
161
173
|
|
data/lib/sproutcore/bundle.rb
CHANGED
@@ -234,7 +234,11 @@ module SproutCore
|
|
234
234
|
#
|
235
235
|
def entries_for(resource_type, opts={})
|
236
236
|
with_hidden = opts[:hidden] || :none
|
237
|
-
|
237
|
+
|
238
|
+
language = opts[:language] || preferred_language
|
239
|
+
mode = opts[:build_mode] || build_mode
|
240
|
+
manifest = manifest_for(language, mode)
|
241
|
+
|
238
242
|
ret = manifest.entries_for(resource_type)
|
239
243
|
|
240
244
|
case with_hidden
|
@@ -257,7 +261,11 @@ module SproutCore
|
|
257
261
|
#
|
258
262
|
def entry_for(resource_name, opts={})
|
259
263
|
with_hidden = opts[:hidden] || :none
|
260
|
-
|
264
|
+
|
265
|
+
language = opts[:language] || preferred_language
|
266
|
+
mode = opts[:build_mode] || build_mode
|
267
|
+
manifest = manifest_for(language, mode)
|
268
|
+
|
261
269
|
ret = manifest.entry_for(resource_name)
|
262
270
|
|
263
271
|
case with_hidden
|
@@ -269,26 +277,43 @@ module SproutCore
|
|
269
277
|
return ret
|
270
278
|
end
|
271
279
|
|
272
|
-
# Returns the entry for the specified URL. This will extract the language
|
280
|
+
# Returns the entry for the specified URL. This will extract the language
|
281
|
+
# from the URL and try to get the entry from both the manifest in the
|
282
|
+
# current build mode and in the production build mode (if one is
|
283
|
+
# provided)
|
273
284
|
#
|
274
285
|
# ==== Params
|
275
286
|
# url<String>:: The url
|
276
287
|
#
|
277
288
|
# ==== Options
|
278
289
|
# hidden:: Use :include,:none,:only to control hidden options
|
279
|
-
# language:: Explicitly include the language. Leave this out to
|
290
|
+
# language:: Explicitly include the language. Leave this out to
|
291
|
+
# autodetect from URL.
|
280
292
|
#
|
281
293
|
def entry_for_url(url, opts={})
|
282
294
|
# get the language
|
283
|
-
opts[:language] ||= url.match(/^#{url_root}\/([^\/]+)\//).to_a[1] || preferred_language
|
295
|
+
opts[:language] ||= url.match(/^#{url_root}\/([^\/]+)\//).to_a[1] || url.match(/^#{index_root}\/([^\/]+)\//).to_a[1] || preferred_language
|
296
|
+
|
297
|
+
# use the current build mode
|
298
|
+
opts[:build_mode] = build_mode
|
284
299
|
entries(opts).each do |entry|
|
285
300
|
return entry if entry.url == url
|
286
301
|
end
|
302
|
+
|
303
|
+
# try production is necessary...
|
304
|
+
if (build_mode != :production)
|
305
|
+
opts[:build_mode] = :production
|
306
|
+
entries(opts).each do |entry|
|
307
|
+
return entry if entry.url == url
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
287
311
|
return nil # not found!
|
288
312
|
end
|
289
313
|
|
290
|
-
# Helper method. This will normalize a URL into one that can map directly
|
291
|
-
# entry in the bundle. If the URL is of a format that cannot be
|
314
|
+
# Helper method. This will normalize a URL into one that can map directly
|
315
|
+
# to an entry in the bundle. If the URL is of a format that cannot be
|
316
|
+
# converted, returns nil.
|
292
317
|
#
|
293
318
|
# ==== Params
|
294
319
|
# url<String>:: The URL
|
@@ -299,7 +324,7 @@ module SproutCore
|
|
299
324
|
if (url == index_root)
|
300
325
|
url = [index_root, preferred_language.to_s, 'index.html'].join('/')
|
301
326
|
|
302
|
-
# Requests to
|
327
|
+
# Requests to index_root/lang should have index.html appended to them
|
303
328
|
elsif /^#{index_root}\/[^\/\.]+$/ =~ url
|
304
329
|
url << '/index.html'
|
305
330
|
end
|
@@ -315,7 +340,11 @@ module SproutCore
|
|
315
340
|
#
|
316
341
|
def entries(opts ={})
|
317
342
|
with_hidden = opts[:hidden] || :none
|
318
|
-
|
343
|
+
|
344
|
+
language = opts[:language] || preferred_language
|
345
|
+
mode = opts[:build_mode] || build_mode
|
346
|
+
manifest = manifest_for(language, mode)
|
347
|
+
|
319
348
|
ret = manifest.entries
|
320
349
|
|
321
350
|
case with_hidden
|
@@ -327,9 +356,9 @@ module SproutCore
|
|
327
356
|
return ret
|
328
357
|
end
|
329
358
|
|
330
|
-
# Does a deep search of the entries, looking for a resource that is a
|
331
|
-
# match of the specified resource. This does not need to match the
|
332
|
-
# exactly and it can omit the extension
|
359
|
+
# Does a deep search of the entries, looking for a resource that is a
|
360
|
+
# close match of the specified resource. This does not need to match the
|
361
|
+
# filename exactly and it can omit the extension
|
333
362
|
def find_resource_entry(filename, opts={}, seen=nil)
|
334
363
|
extname = File.extname(filename)
|
335
364
|
rootname = filename.gsub(/#{extname}$/,'')
|
@@ -420,14 +449,15 @@ module SproutCore
|
|
420
449
|
@seen = nil if created_seen
|
421
450
|
end
|
422
451
|
|
423
|
-
# Easy singular form of build_entries(). Take same parameters except for
|
424
|
-
# instead of an array.
|
452
|
+
# Easy singular form of build_entries(). Take same parameters except for
|
453
|
+
# a single entry instead of an array.
|
425
454
|
def build_entry(entry, opts={})
|
426
455
|
build_entries([entry], opts)
|
427
456
|
end
|
428
457
|
|
429
|
-
# Invoked by build tools when they build a dependent entry. This will add
|
430
|
-
# to the list of seen entries during a build so that it will not
|
458
|
+
# Invoked by build tools when they build a dependent entry. This will add
|
459
|
+
# the entry to the list of seen entries during a build so that it will not
|
460
|
+
# be rebuilt.
|
431
461
|
def did_build_entry(entry)
|
432
462
|
@seen << entry unless @seen.nil?
|
433
463
|
end
|
@@ -439,8 +469,9 @@ module SproutCore
|
|
439
469
|
SC.logger.debug("~ Done.\n")
|
440
470
|
end
|
441
471
|
|
442
|
-
# This will perform a complete build for all languages that have a
|
443
|
-
# You can also pass in an array of languages you would
|
472
|
+
# This will perform a complete build for all languages that have a
|
473
|
+
# matching lproj. You can also pass in an array of languages you would
|
474
|
+
# like to build
|
444
475
|
def build(*languages)
|
445
476
|
|
446
477
|
# Get the installed languages (and the preferred language, just in case)
|
@@ -512,22 +543,87 @@ module SproutCore
|
|
512
543
|
|
513
544
|
return cached[:contents]
|
514
545
|
end
|
546
|
+
|
547
|
+
######################################################
|
548
|
+
## LOCALIZATION
|
549
|
+
##
|
550
|
+
|
551
|
+
# Returns all of the strings.js entries for this bundle and any required
|
552
|
+
# bundles. The return array is in the order the entries should be
|
553
|
+
# processed to build the strings hash.
|
554
|
+
#
|
555
|
+
# ==== Options
|
556
|
+
# language: optional language. otherwise preferred language is used.
|
557
|
+
#
|
558
|
+
def strings_entries(opts = {})
|
559
|
+
opts[:hidden] = true # include hidden files for prod mode.
|
560
|
+
all_required_bundles.map { |q| q.entry_for('strings.js', opts) }.compact
|
561
|
+
end
|
562
|
+
|
563
|
+
# This will load a strings resource and convert it into a hash of key
|
564
|
+
# value pairs.
|
565
|
+
def strings_for_entry(strings_entry)
|
566
|
+
source_path = strings_entry.source_path
|
567
|
+
return {} if !File.exists?(source_path)
|
568
|
+
|
569
|
+
# read the file in and strip out comments...
|
570
|
+
str = File.read(source_path)
|
571
|
+
str = str.gsub(/\/\/.*$/,'').gsub(/\/\*.*\*\//m,'')
|
572
|
+
|
573
|
+
# Now build the hash
|
574
|
+
ret = {}
|
575
|
+
str.scan(/['"](.+)['"]\s*:\s*['"](.+)['"],?\s*$/) do |x,y|
|
576
|
+
# x & y are JS strings that must be evaled as such..
|
577
|
+
#x = eval(%("#{x}"))
|
578
|
+
y = eval(%("#{y}"))
|
579
|
+
ret[x] = y
|
580
|
+
end
|
581
|
+
|
582
|
+
return ret
|
583
|
+
end
|
584
|
+
|
585
|
+
# Strings the string hash for the current bundle. If this strings hash
|
586
|
+
# has not been loaded yet, it will be loaded now.
|
587
|
+
#
|
588
|
+
# ==== Options
|
589
|
+
# language: optional language. otherwise preferred language is used.
|
590
|
+
#
|
591
|
+
def strings_hash(opts={})
|
592
|
+
|
593
|
+
build_mode = opts[:build_mode] ||= build_mode
|
594
|
+
language = opts[:language] ||= preferred_language
|
595
|
+
key = [build_mode.to_s, language.to_s].join(':').to_sym
|
596
|
+
|
597
|
+
@strings_hash ||= {}
|
598
|
+
if @strings_hash[key].nil?
|
599
|
+
ret = {}
|
600
|
+
strings_entries(opts).each do |entry|
|
601
|
+
ret.merge! strings_for_entry(entry)
|
602
|
+
end
|
603
|
+
@strings_hash[key] = ret
|
604
|
+
end
|
605
|
+
|
606
|
+
return @strings_hash[key]
|
607
|
+
end
|
515
608
|
|
516
609
|
######################################################
|
517
610
|
## MANIFESTS
|
518
611
|
##
|
519
612
|
|
520
|
-
# Invoke this method whenever you think the bundle's contents on disk
|
521
|
-
# this will throw away any cached information in
|
522
|
-
# operation so it is OK to call it
|
613
|
+
# Invoke this method whenever you think the bundle's contents on disk
|
614
|
+
# might have changed this will throw away any cached information in
|
615
|
+
# bundle. This is generally a cheap operation so it is OK to call it
|
616
|
+
# often, though it will be less performant overall.
|
523
617
|
def reload!
|
524
618
|
@manifests = {}
|
619
|
+
@strings_hash = {}
|
525
620
|
end
|
526
621
|
|
527
|
-
# Returns the bundle manifest for the specified language
|
528
|
-
# if it does not yet exist.
|
529
|
-
def manifest_for(language)
|
530
|
-
|
622
|
+
# Returns the bundle manifest for the specified language and build mode.
|
623
|
+
# The manifest will be created if it does not yet exist.
|
624
|
+
def manifest_for(language, build_mode)
|
625
|
+
manifest_key = [build_mode.to_s, language.to_s].join(':').to_sym
|
626
|
+
@manifests[manifest_key] ||= BundleManifest.new(self, language.to_sym, build_mode.to_sym)
|
531
627
|
end
|
532
628
|
|
533
629
|
# ==== Returns
|
@@ -541,8 +637,9 @@ module SproutCore
|
|
541
637
|
ret.compact.map { |x| LONG_LANGUAGE_MAP[x.to_sym] || x.to_sym }.uniq
|
542
638
|
end
|
543
639
|
|
544
|
-
# Finds the actual lproj directory (in the source) for the language code.
|
545
|
-
# language does not exist, returns the lproj for the
|
640
|
+
# Finds the actual lproj directory (in the source) for the language code.
|
641
|
+
# If the named language does not exist, returns the lproj for the
|
642
|
+
# preferred language.
|
546
643
|
def lproj_for(language)
|
547
644
|
|
548
645
|
# try language as passed in.
|
@@ -561,12 +658,13 @@ module SproutCore
|
|
561
658
|
return ret if File.exists?(File.join(source_root,ret))
|
562
659
|
end
|
563
660
|
|
564
|
-
# failed, return using preferred_language unless this is the preferred
|
661
|
+
# failed, return using preferred_language unless this is the preferred
|
662
|
+
# language
|
565
663
|
ret = (language != preferred_language) ? lproj_for(preferred_language) : nil
|
566
664
|
return ret unless ret.nil?
|
567
665
|
|
568
|
-
# Super-ultra massive fail. Possible that no localized resources exist
|
569
|
-
# Return english.lproj and hope for the best
|
666
|
+
# Super-ultra massive fail. Possible that no localized resources exist
|
667
|
+
# at all. Return english.lproj and hope for the best
|
570
668
|
return 'english.lproj'
|
571
669
|
end
|
572
670
|
|
@@ -577,8 +675,8 @@ module SproutCore
|
|
577
675
|
|
578
676
|
protected
|
579
677
|
|
580
|
-
# Converts the named path to a fully qualified path name using the library
|
581
|
-
# does not begin with a slash
|
678
|
+
# Converts the named path to a fully qualified path name using the library
|
679
|
+
# root, if it does not begin with a slash
|
582
680
|
def normalize_path(path)
|
583
681
|
(path[0] == '/'[0]) ? path : File.join(library_root, path)
|
584
682
|
end
|
@@ -2,22 +2,24 @@ require 'yaml'
|
|
2
2
|
|
3
3
|
module SproutCore
|
4
4
|
|
5
|
-
# A Bundle Manifest describes all of the resources in a bundle, including
|
6
|
-
# source paths, destination paths, and urls.
|
5
|
+
# A Bundle Manifest describes all of the resources in a bundle, including
|
6
|
+
# mapping their source paths, destination paths, and urls.
|
7
7
|
#
|
8
|
-
# A Bundle will create a manifest for every language you request from it.
|
9
|
-
# reload! on the bundle, it will dispose of its manifests and
|
8
|
+
# A Bundle will create a manifest for every language you request from it.
|
9
|
+
# If you invoke reload! on the bundle, it will dispose of its manifests and
|
10
|
+
# rebuild them.
|
10
11
|
#
|
11
12
|
class BundleManifest
|
12
13
|
|
13
14
|
CACHED_TYPES = [:javascript, :stylesheet, :fixture, :test]
|
14
15
|
SYMLINKED_TYPES = [:resource]
|
15
16
|
|
16
|
-
attr_reader :bundle, :language
|
17
|
+
attr_reader :bundle, :language, :build_mode
|
17
18
|
|
18
|
-
def initialize(bundle, language)
|
19
|
+
def initialize(bundle, language, build_mode)
|
19
20
|
@bundle = bundle
|
20
21
|
@language = language
|
22
|
+
@build_mode = build_mode
|
21
23
|
@entries_by_type = {} # entries by type
|
22
24
|
@entries_by_filename = {} # entries by files
|
23
25
|
build!
|
@@ -67,15 +69,16 @@ module SproutCore
|
|
67
69
|
end
|
68
70
|
|
69
71
|
# STEP 3: If in development build mode:
|
70
|
-
if
|
72
|
+
if self.build_mode == :development
|
71
73
|
|
72
74
|
# a. Merge fixture types into JS types & tests
|
73
75
|
unless entries[:fixture].nil?
|
74
76
|
entries[:javascript] = (entries[:javascript] || []) + entries[:fixture]
|
75
77
|
end
|
76
78
|
|
77
|
-
# b. Rewrite all of the JS & CSS file paths and URLs to point to
|
78
|
-
#
|
79
|
+
# b. Rewrite all of the JS & CSS file paths and URLs to point to
|
80
|
+
# cached versions
|
81
|
+
# (Cached versions are written to _cache/filename-ctime.ext)
|
79
82
|
(entries[:javascript] ||= []).each do | entry |
|
80
83
|
setup_timestamp_token(entry)
|
81
84
|
end
|
@@ -99,7 +102,7 @@ module SproutCore
|
|
99
102
|
# STEP 5: Add entry for javascript.js & stylesheet.js. If in production mode, set
|
100
103
|
# these to visible and hide the composite. If in dev mode, do the opposite.
|
101
104
|
|
102
|
-
hide_composite = (
|
105
|
+
hide_composite = (self.build_mode != :development)
|
103
106
|
|
104
107
|
# a. Combine the JS file paths into a single entry for the javascript.js
|
105
108
|
if (working = entries[:javascript]) && working.size>0
|
@@ -204,8 +207,6 @@ module SproutCore
|
|
204
207
|
:test
|
205
208
|
when /^fixtures\/.+\.js$/
|
206
209
|
:fixture
|
207
|
-
when /\.html$/
|
208
|
-
:html
|
209
210
|
when /\.rhtml$/
|
210
211
|
:html
|
211
212
|
when /\.html.erb$/
|
@@ -221,9 +222,10 @@ module SproutCore
|
|
221
222
|
end
|
222
223
|
end
|
223
224
|
|
224
|
-
# Build an entry for the resource at the named src_path (relative to the
|
225
|
-
# This should assume we are in going to simply build each
|
226
|
-
# without combining files, but not using our
|
225
|
+
# Build an entry for the resource at the named src_path (relative to the
|
226
|
+
# source_root) This should assume we are in going to simply build each
|
227
|
+
# resource into the build root without combining files, but not using our
|
228
|
+
# _src symlink magic.
|
227
229
|
def build_entry_for(src_path, src_type, composite=nil, hide_composite = true)
|
228
230
|
ret = ManifestEntry.new
|
229
231
|
ret.ext = File.extname(src_path)[1..-1] || '' # easy stuff
|
@@ -248,15 +250,15 @@ module SproutCore
|
|
248
250
|
|
249
251
|
# The build path is the build_root + the filename
|
250
252
|
# The URL is the url root + the language code + filename
|
251
|
-
# also add in _cache or _sym in certain cases. This is just more
|
252
|
-
# it later.
|
253
|
+
# also add in _cache or _sym in certain cases. This is just more
|
254
|
+
# efficient than doing it later.
|
253
255
|
url_root = (src_path == 'index.html') ? bundle.index_root : bundle.url_root
|
254
256
|
cache_link = nil
|
255
257
|
use_symlink =false
|
256
258
|
|
257
|
-
# Note: you can only access real resources via the cache. If the entry
|
258
|
-
# then do not go through cache.
|
259
|
-
if (
|
259
|
+
# Note: you can only access real resources via the cache. If the entry
|
260
|
+
# is a composite then do not go through cache.
|
261
|
+
if (self.build_mode == :development) && composite.nil?
|
260
262
|
cache_link = '_cache' if CACHED_TYPES.include?(src_type)
|
261
263
|
use_symlink = true if SYMLINKED_TYPES.include?(src_type)
|
262
264
|
end
|
@@ -293,7 +295,8 @@ module SproutCore
|
|
293
295
|
# filename:: path relative to the built language (e.g. sproutcore/en) less file extension
|
294
296
|
# ext:: the file extension
|
295
297
|
# source_path:: absolute paths into source that will comprise this resource
|
296
|
-
# url:: the url that should be used to reference this resource
|
298
|
+
# url:: the url that should be used to reference this resource in the current mode.
|
299
|
+
# build_url:: the url that will be used to referene this resource in production.
|
297
300
|
# build_path:: absolute path to the compiled resource
|
298
301
|
# type:: the top-level category
|
299
302
|
# original_path:: save the original path used to build this entry
|