sproutcore 1.0.1042 → 1.0.1043

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.
@@ -9,101 +9,4 @@ SC.RootResponder = SC.RootResponder.extend({
9
9
 
10
10
  platform: 'mobile',
11
11
 
12
- /**
13
- Setup event listeners for touch events.
14
- */
15
- setup: function() {
16
- sc_super();
17
- this.listenFor('touchstart touchmove touchend touchcancel'.w(), document);
18
- },
19
-
20
- touchstart: function(evt) {
21
- try {
22
- var view = this.targetViewForEvent(evt) ;
23
- view = this._touchView = this.sendEvent('touchStart', evt, view) ;
24
- if (view && view.respondsTo('touchDragged')) this._touchCanDrag = YES ;
25
- } catch (e) {
26
- console.log('Exception during touchStart: %@'.fmt(e)) ;
27
- this._touchView = null ;
28
- this._touchCanDrag = NO ;
29
- return NO ;
30
- }
31
- return view ? evt.hasCustomEventHandling : YES;
32
- },
33
-
34
- touchmove: function(evt) {
35
- SC.RunLoop.begin();
36
- try {
37
- var lh = this._lastHovered || [] ;
38
- var nh = [] ;
39
- var view = this.targetViewForEvent(evt) ;
40
-
41
- // work up the view chain. Notify of touchEntered and
42
- // touchMoved if implemented.
43
- while(view && (view !== this)) {
44
- if (lh.indexOf(view) !== -1) {
45
- view.tryToPerform('touchMoved', evt);
46
- nh.push(view) ;
47
- } else {
48
- view.tryToPerform('touchEntered', evt);
49
- nh.push(view) ;
50
- }
51
-
52
- view = view.get('nextResponder');
53
- }
54
-
55
- // now find those views last hovered over that were no longer found
56
- // in this chain and notify of mouseExited.
57
- for(var loc=0; loc < lh.length; loc++) {
58
- view = lh[loc] ;
59
- var exited = view.respondsTo('touchExited') ;
60
- if (exited && !(nh.indexOf(view) !== -1)) {
61
- view.tryToPerform('touchExited',evt);
62
- }
63
- }
64
-
65
- this._lastHovered = nh;
66
-
67
- // also, if a touchView exists, call the touchDragged action, if
68
- // it exists.
69
- if (this._touchView) this._touchView.tryToPerform('touchDragged', evt);
70
- } catch (e) {
71
- console.log('Exception during touchMove: %@'.fmt(e)) ;
72
- }
73
- SC.RunLoop.end();
74
- return YES ;
75
- },
76
-
77
- touchend: function(evt) {
78
- try {
79
- evt.cancel = NO ;
80
- var handler = null, view = this._touchView ;
81
-
82
- // attempt the call only if there's a target.
83
- // don't want a touch end going to anyone unless they handled the
84
- // touch start...
85
- if (view) handler = this.sendEvent('touchEnd', evt, view) ;
86
-
87
- // try whoever's under the mouse if we haven't handle the mouse up yet
88
- if (!handler) view = this.targetViewForEvent(evt) ;
89
-
90
- // cleanup
91
- this._touchCanDrag = NO; this._touchView = null ;
92
- } catch (e) {
93
- console.log('Exception during touchEnd: %@'.fmt(e)) ;
94
- this._touchCanDrag = NO; this._touchView = null ;
95
- return NO ;
96
- }
97
- return (handler) ? evt.hasCustomEventHandling : YES ;
98
- },
99
-
100
- /** @private
101
- Handle touch cancel event. Works just like touch end except evt.cancel
102
- is set to YES.
103
- */
104
- touchcancel: function(evt) {
105
- evt.cancel = YES ;
106
- return this.touchend(evt);
107
- }
108
-
109
12
  }) ;
@@ -1328,6 +1328,7 @@ SC.logChange = function logChange(target, key, value) {
1328
1328
  SC.mixin(SC, {
1329
1329
  get: function(object, key) {
1330
1330
  if (!object) return undefined;
1331
+ if (key === undefined) return this[object];
1331
1332
  if (object.get) return object.get(key);
1332
1333
  return object[key];
1333
1334
  }
@@ -126,6 +126,12 @@ test("should return undefined if the provided object is undefined", function() {
126
126
  equals(SC.get(undefined, 'key'), undefined);
127
127
  });
128
128
 
129
+ test("should work when object is SC (used in SC.objectForPropertyPath)", function() {
130
+ equals(SC.objectForPropertyPath('SC.RunLoop'), SC.RunLoop);
131
+ equals(SC.get('RunLoop'), SC.RunLoop);
132
+ equals(SC.get(SC, 'RunLoop'), SC.RunLoop);
133
+ });
134
+
129
135
  // ..........................................................
130
136
  // SET()
131
137
  //
@@ -35,7 +35,7 @@ module SC
35
35
  def build_css(dst_path)
36
36
  a = Regexp.new('^'+MANIFEST.build_root)
37
37
  if dst_path =~ a
38
- $to_minify= $to_minify+" "+dst_path
38
+ $to_minify << dst_path
39
39
  FileUtils.mkdir_p(File.dirname(dst_path))
40
40
  FileUtils.copy(entry.source_path, dst_path)
41
41
  else
@@ -45,7 +45,7 @@ module SC
45
45
  filecompress = "java -jar " + jar_path + " --charset utf-8 --line-break 0 --nomunge --preserve-semi --disable-optimizations " + entry.source_path + " -o \"" + dst_path + "\" 2>&1"
46
46
  SC.logger.info 'Compressing CSS with YUI .... '+ dst_path
47
47
  SC.logger.debug `#{filecompress}`
48
-
48
+
49
49
  if $?.exitstatus != 0
50
50
  _report_error(output, entry.filename, entry.source_path)
51
51
  SC.logger.fatal("!!!!YUI compressor failed, please check that your css code is valid.")
@@ -58,7 +58,7 @@ module SC
58
58
  def build_javascript(dst_path)
59
59
  a = Regexp.new('^'+MANIFEST.build_root)
60
60
  if dst_path =~ a
61
- $to_minify= $to_minify+" "+dst_path
61
+ $to_minify << dst_path
62
62
  FileUtils.mkdir_p(File.dirname(dst_path))
63
63
  FileUtils.copy(entry.source_path, dst_path)
64
64
  else
@@ -67,7 +67,7 @@ module SC
67
67
  FileUtils.mkdir_p(File.dirname(dst_path)) # make sure loc exists...
68
68
  filecompress = "java -jar " + jar_path + " --charset utf-8 --line-break 80 " + entry.source_path + " -o \"" + dst_path + "\" 2>&1"
69
69
  SC.logger.info 'Compressing with YUI: '+ dst_path + "..."
70
-
70
+
71
71
  output = `#{filecompress}` # It'd be nice to just read STDERR, but
72
72
  # I can't find a reasonable, commonly-
73
73
  # installed, works-on-all-OSes solution.
@@ -81,7 +81,6 @@ module SC
81
81
 
82
82
  def build_inline_javascript(dst_path)
83
83
  SC.logger.info 'Compressing inline Javascript with YUI: ' + dst_path + "..."
84
- system(yui_command('--line-break 0', dst_path))
85
84
  yui_root = File.expand_path(File.join(LIBPATH, '..', 'vendor', 'yui-compressor'))
86
85
  jar_path = File.join(yui_root, 'yuicompressor-2.4.2.jar')
87
86
  FileUtils.mkdir_p(File.dirname(dst_path)) # make sure loc exists...
@@ -89,8 +88,8 @@ module SC
89
88
  SC.logger.info 'Compressing with YUI: '+ dst_path + "..."
90
89
 
91
90
  output = `#{filecompress}` # It'd be nice to just read STDERR, but
92
- # I can't find a reasonable, commonly-
93
- # installed, works-on-all-OSes solution.
91
+ # I can't find a reasonable, commonly-
92
+ # installed, works-on-all-OSes solution.
94
93
  if $?.exitstatus != 0
95
94
  _report_error(output, entry.filename, entry.source_path)
96
95
  SC.logger.fatal("!!!!YUI compressor failed, please check that your js code is valid")
@@ -332,15 +332,15 @@ module SC
332
332
  def file_attr(attr_name, path, &block)
333
333
 
334
334
  # read cache from disk if needed
335
- if @file_attr_cache.nil?
336
- if File.exists?(file_attr_cache_path)
337
- require 'yaml'
338
- @file_attr_cache = YAML.load File.read(file_attr_cache_path)
339
- else
340
- @file_attr_cache = {}
341
- end
335
+ if @file_attr_cache.nil? && File.exists?(file_attr_cache_path)
336
+ require 'yaml'
337
+ @file_attr_cache = YAML.load_file file_attr_cache_path
338
+
339
+ # Sometimes the file is corrupted, in this case, clear the cache
340
+ File.delete file_attr_cache_path unless @file_attr_cache
342
341
  end
343
-
342
+ @file_attr_cache ||= {}
343
+
344
344
  path_root = (@file_attr_cache[path] ||= {})
345
345
  attr_info = (path_root[attr_name.to_s] ||= {})
346
346
  attr_mtime = attr_info['mtime'].to_i
@@ -322,7 +322,16 @@ module SC
322
322
  # a few bug fixes.
323
323
  def mime_type(build_path)
324
324
  ext = File.extname(build_path)
325
- (ext == '.js') ? 'text/javascript' : ::Rack::Mime.mime_type(ext, 'text/plain')
325
+
326
+ case ext
327
+ when '.js'
328
+ 'text/javascript'
329
+ when '.ttf'
330
+ 'font/ttf'
331
+ else
332
+ ::Rack::Mime.mime_type(ext, 'text/plain')
333
+ end
334
+
326
335
  end
327
336
 
328
337
  end
@@ -6,8 +6,9 @@
6
6
  # ===========================================================================
7
7
 
8
8
  require File.expand_path(File.join(File.dirname(__FILE__), 'manifest'))
9
+ require 'pathname'
9
10
 
10
- $to_minify=''
11
+ $to_minify = []
11
12
 
12
13
  module SC
13
14
  class Tools
@@ -69,27 +70,31 @@ module SC
69
70
  if entries.size > 0
70
71
  info "Building entries for #{manifest.target.target_name}:#{manifest.language}..."
71
72
 
73
+ target_build_root = Pathname.new(manifest.target.project.project_root)
72
74
  entries.each do |entry|
73
- info " #{entry.filename} -> #{entry.build_path}"
75
+ dst = Pathname.new(entry.build_path).relative_path_from(target_build_root)
76
+ info " #{entry.filename} -> #{dst}"
74
77
  entry.build!
75
78
  end
76
79
  end
77
80
  end
78
- yui_root = File.expand_path(File.join(LIBPATH, '..', 'vendor', 'yui-compressor'))
79
- jar_path = File.join(yui_root, 'SCyuicompressor-2.4.2.jar')
80
- filecompress = "java -jar " + jar_path + " --charset utf-8 --line-break 80 " + $to_minify + " 2>&1"
81
- SC.logger.info filecompress
82
- SC.logger.info 'Compressing with YUI: '+ $to_minify + "..."
83
81
 
84
- output = `#{filecompress}` # It'd be nice to just read STDERR, but
85
- # I can't find a reasonable, commonly-
86
- # installed, works-on-all-OSes solution.
87
- SC.logger.info output
88
- if $?.exitstatus != 0
89
- SC.logger.fatal(output)
90
- SC.logger.fatal("!!!!YUI compressor failed, please check that your js code is valid")
91
- SC.logger.fatal("!!!!Failed compressing ... "+ build_root)
92
- exit(1)
82
+ if $to_minify.length > 0
83
+ yui_root = File.expand_path(File.join(LIBPATH, '..', 'vendor', 'yui-compressor'))
84
+ jar_path = File.join(yui_root, 'SCyuicompressor-2.4.2.jar')
85
+ filecompress = "java -jar " + jar_path + " --charset utf-8 --line-break 80 " + $to_minify * ' ' + " 2>&1"
86
+ SC.logger.info 'Compressing with YUI...'
87
+
88
+ output = `#{filecompress}` # It'd be nice to just read STDERR, but
89
+ # I can't find a reasonable, commonly-
90
+ # installed, works-on-all-OSes solution.
91
+ SC.logger.info output
92
+ if $?.exitstatus != 0
93
+ SC.logger.fatal(output)
94
+ SC.logger.fatal("!!!!YUI compressor failed, please check that your js code is valid")
95
+ SC.logger.fatal("!!!!Failed compressing ... "+ build_root)
96
+ exit(1)
97
+ end
93
98
  end
94
99
  end
95
100
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sproutcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1042
4
+ version: 1.0.1043
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sprout Systems, Inc. Apple Inc. and contributors
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-21 00:00:00 -08:00
12
+ date: 2010-01-16 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -696,6 +696,7 @@ files:
696
696
  - frameworks/sproutcore/frameworks/foundation/tests/mixins/button/content.js
697
697
  - frameworks/sproutcore/frameworks/foundation/tests/mixins/button/displayProperties.js
698
698
  - frameworks/sproutcore/frameworks/foundation/tests/mixins/button/keyEquivalents.js
699
+ - frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
699
700
  - frameworks/sproutcore/frameworks/foundation/tests/mixins/control/content.js
700
701
  - frameworks/sproutcore/frameworks/foundation/tests/mixins/control/displayProperties.js
701
702
  - frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js
@@ -933,6 +934,7 @@ files:
933
934
  - frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/Data
934
935
  - frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Preview.jpg
935
936
  - frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Thumbnail.jpg
937
+ - frameworks/sproutcore/themes/standard_theme/Source/SproutCore Theme Buttons.psd
936
938
  - frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/Data
937
939
  - frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Preview.jpg
938
940
  - frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Thumbnail.jpg