rsence-pre 2.2.0.38 → 2.2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/INSTALL.rdoc +1 -1
  2. data/VERSION +1 -1
  3. data/conf/default_conf.yaml +0 -4
  4. data/conf/rsence_command_strings.yaml +1 -1
  5. data/js/comm/queue/queue.js +17 -8
  6. data/js/comm/transporter/transporter.js +117 -93
  7. data/js/comm/values/values.js +2 -2
  8. data/js/controls/button/themes/bright/button_parts1.png +0 -0
  9. data/js/controls/button/themes/default/button_parts1.png +0 -0
  10. data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
  11. data/js/controls/dialogs/sheet/sheet.js +1 -1
  12. data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
  13. data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
  14. data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
  15. data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
  16. data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
  17. data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
  18. data/js/controls/searchfield/themes/default/searchfield.css +3 -3
  19. data/js/controls/searchfield/themes/default/searchfield_parts1.png +0 -0
  20. data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
  21. data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
  22. data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
  23. data/js/controls/tab/tab.js +4 -3
  24. data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
  25. data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
  26. data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
  27. data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
  28. data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
  29. data/js/controls/tab/themes/default/tab_parts1.png +0 -0
  30. data/js/controls/textcontrol/textcontrol.js +3 -1
  31. data/js/controls/textcontrol/themes/default/textcontrol.css +1 -1
  32. data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
  33. data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
  34. data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
  35. data/js/controls/validatorview/themes/default/validator.png +0 -0
  36. data/js/controls/window/themes/default/window.css +66 -54
  37. data/js/controls/window/themes/default/window.html +6 -2
  38. data/js/controls/window/themes/default/window_bg_active.png +0 -0
  39. data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
  40. data/js/controls/window/themes/default/window_buttons.png +0 -0
  41. data/js/controls/window/themes/default/window_parts1.png +0 -0
  42. data/js/controls/window/themes/default/window_parts2.png +0 -0
  43. data/js/controls/window/window.js +167 -40
  44. data/js/core/class/class.js +10 -0
  45. data/js/core/elem/elem.coffee +54 -27
  46. data/js/core/event/event.js +2 -2
  47. data/js/datetime/calendar/calendar.coffee +24 -8
  48. data/js/datetime/calendar/themes/default/calendar.html +2 -2
  49. data/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  50. data/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
  51. data/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
  52. data/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
  53. data/js/datetime/timesheet_item/themes/default/timesheet_item_icons.png +0 -0
  54. data/js/datetime/timesheet_item/timesheet_item.js +1 -1
  55. data/js/foundation/application/application.js +28 -7
  56. data/js/foundation/control/eventresponder/eventresponder.js +7 -4
  57. data/js/foundation/eventmanager/eventmanager.js +28 -3
  58. data/js/foundation/geom/rect/rect.js +83 -46
  59. data/js/foundation/json_renderer/json_renderer.js +5 -5
  60. data/js/foundation/thememanager/thememanager.js +3 -0
  61. data/js/foundation/view/markupview/markupview.js +13 -13
  62. data/js/foundation/view/view.js +209 -56
  63. data/js/lists/propertylist/propertylist.js +33 -31
  64. data/js/menus/minimenu/minimenu.js +23 -6
  65. data/js/menus/minimenu/themes/default/minimenu.png +0 -0
  66. data/js/menus/minimenuitem/minimenuitem.js +11 -1
  67. data/js/menus/minimenuitem/themes/default/minimenuitem_checkmark.png +0 -0
  68. data/js/menus/popupmenu/themes/default/popupmenu.png +0 -0
  69. data/js/util/reloadapp/themes/default/reloadapp_warning.png +0 -0
  70. data/lib/rsence/argv/startup_argv.rb +1 -1
  71. data/lib/rsence/daemon.rb +2 -2
  72. data/lib/rsence/default_config.rb +2 -2
  73. data/lib/rsence/http/broker.rb +2 -4
  74. data/lib/rsence/msg.rb +1 -0
  75. data/lib/rsence/plugins/plugin.rb +11 -4
  76. data/lib/rsence/sessionmanager.rb +99 -37
  77. data/lib/rsence/sessionstorage.rb +29 -15
  78. data/lib/rsence/transporter.rb +3 -5
  79. data/plugins/client_pkg/client_pkg.rb +7 -8
  80. data/plugins/client_pkg/lib/client_pkg_build.rb +212 -95
  81. data/plugins/client_pkg/lib/client_pkg_cache.rb +1 -1
  82. data/plugins/main/main.rb +5 -1
  83. data/plugins/ticket/ticket.rb +9 -1
  84. metadata +72 -66
@@ -69,65 +69,110 @@ class ClientPkgBuild
69
69
  return [html_data, gz_html]
70
70
  end
71
71
 
72
- def read_gfx( src_path_theme, tgt_hash_gfx )
72
+ def read_gfx( src_path_theme, theme_newest )
73
73
  gfx_size = 0
74
+ gfx_data = {}
74
75
  src_files_gfx_path = File.join( src_path_theme, 'gfx' )
75
76
  [ src_path_theme, src_files_gfx_path ].each do |src_files_gfx|
76
77
  if File.exist?( src_files_gfx )
77
78
  Dir.entries( src_files_gfx ).each do |src_gfx_filename|
78
79
  src_file_gfx = File.join( src_files_gfx, src_gfx_filename )
79
80
  if @gfx_formats.include?( src_file_gfx[-4..-1] )
80
- tgt_hash_gfx[src_gfx_filename] = read_file( src_file_gfx )
81
- gfx_size += File.stat( src_file_gfx ).size
81
+ fstat = File.stat( src_file_gfx )
82
+ theme_newest = fstat.mtime.to_f if fstat.mtime.to_f > theme_newest
83
+ gfx_size += fstat.size
84
+ gfx_data[src_gfx_filename] = read_file( src_file_gfx )
82
85
  end
83
86
  end
84
87
  end
85
88
  end
86
- return gfx_size
89
+ return [ gfx_size, gfx_data, theme_newest ]
87
90
  end
88
91
 
89
92
  # processes theme-related files
90
93
  def read_theme( bundle_dir, bundle_name )
94
+ time_start = Time.now.to_f
91
95
  @theme_names.each do |theme_name|
92
- @theme_sizes[ theme_name ] = {
93
- :css => [0,0],
94
- :html => [0,0],
95
- :gfx => 0
96
- } unless @theme_sizes.has_key?( theme_name )
97
- tgt_hash_theme = @themes[theme_name]
98
96
  src_path_theme = File.join( bundle_dir, 'themes', theme_name )
99
- [ File.join( src_path_theme, bundle_name+'.css' ),
100
- File.join( src_path_theme, 'css', bundle_name+'.css' )
101
- ].each do |src_file_css|
102
- if File.exist?( src_file_css )
103
- ( css_data, gz_css ) = read_css( src_file_css )
104
- tgt_hash_css = tgt_hash_theme[:css][bundle_name] = {
105
- :data => css_data,
106
- :gzip => gz_css
107
- }
108
- @theme_sizes[ theme_name ][:css][0] += File.stat( src_file_css ).size
109
- @theme_sizes[ theme_name ][:css][1] += css_data.bytesize
110
- @css_by_theme[ theme_name ][ bundle_name ] = css_data
111
- end
97
+ if @src_cache[:theme_timestamp].has_key?(src_path_theme)
98
+ theme_newest = @src_cache[:theme_timestamp][src_path_theme]
99
+ else
100
+ theme_newest = 0
112
101
  end
113
- [ File.join( src_path_theme, bundle_name+'.html' ),
114
- File.join( src_path_theme, 'html', bundle_name+'.html' )
115
- ].each do |src_file_html|
116
- if File.exist?( src_file_html )
117
- ( html_data, gz_html ) = read_html( src_file_html )
118
- tgt_hash_html = tgt_hash_theme[:html][bundle_name] = {
119
- :data => html_data,
120
- :gzip => gz_html
121
- }
122
- @theme_sizes[ theme_name ][:html][0] += File.stat( src_file_html ).size
123
- @theme_sizes[ theme_name ][:html][1] += html_data.bytesize
124
- @html_by_theme[ theme_name ][ bundle_name ] = html_data
102
+ if theme_newest == 0 or find_newer( src_path_theme, theme_newest )
103
+ theme_css = { :data => '' }
104
+ theme_html = { :data => '' }
105
+ theme_size = {
106
+ :css => [0,0],
107
+ :html => [0,0],
108
+ :gfx => 0
109
+ }
110
+ [ File.join( src_path_theme, bundle_name+'.css' ),
111
+ File.join( src_path_theme, 'css', bundle_name+'.css' )
112
+ ].each do |src_file_css|
113
+ if File.exist?( src_file_css )
114
+ fstat = File.stat( src_file_css )
115
+ theme_newest = fstat.mtime.to_f if fstat.mtime.to_f > theme_newest
116
+ ( css_data, gz_css ) = read_css( src_file_css )
117
+ theme_css = { :data => css_data, :gzip => gz_css }
118
+ theme_size[:css][0] += fstat.size
119
+ theme_size[:css][1] += css_data.bytesize
120
+ break
121
+ end
122
+ end
123
+ [ File.join( src_path_theme, bundle_name+'.html' ),
124
+ File.join( src_path_theme, 'html', bundle_name+'.html' )
125
+ ].each do |src_file_html|
126
+ if File.exist?( src_file_html )
127
+ fstat = File.stat( src_file_html )
128
+ theme_newest = fstat.mtime.to_f if fstat.mtime.to_f > theme_newest
129
+ ( html_data, gz_html ) = read_html( src_file_html )
130
+ theme_html = { :data => html_data, :gzip => gz_html }
131
+ theme_size[:html][0] += fstat.size
132
+ theme_size[:html][1] += html_data.bytesize
133
+ break
134
+ end
125
135
  end
136
+ ( gfx_size, theme_gfx, theme_newest ) = read_gfx( src_path_theme, theme_newest )
137
+ theme_size[:gfx] += gfx_size
138
+ @src_cache[:theme_timestamp][src_path_theme] = theme_newest
139
+ @src_cache[:theme_data][src_path_theme] = {} unless @src_cache[:theme_data].has_key?(src_path_theme)
140
+ @src_cache[:theme_data][src_path_theme][:size] = theme_size
141
+ @src_cache[:theme_data][src_path_theme][:data] = {
142
+ :css => theme_css,
143
+ :html => theme_html,
144
+ :gfx => theme_gfx
145
+ }
146
+ else
147
+ theme_size = @src_cache[:theme_data][src_path_theme][:size]
148
+ tc = @src_cache[:theme_data][src_path_theme][:data]
149
+ theme_css = tc[:css]
150
+ theme_html = tc[:html]
151
+ theme_gfx = tc[:gfx]
152
+ end
153
+ @html_by_theme[theme_name][bundle_name] = theme_html[:data]
154
+ @css_by_theme[theme_name][bundle_name] = theme_css[:data]
155
+ th = @themes[theme_name]
156
+ th[:css][bundle_name] = theme_css
157
+ th[:html][bundle_name] = theme_html
158
+ th[:gfx].merge!(theme_gfx)
159
+ unless @theme_sizes.has_key?( theme_name )
160
+ @theme_sizes[ theme_name ] = {
161
+ :css => [0,0],
162
+ :html => [0,0],
163
+ :gfx => 0
164
+ }
126
165
  end
127
- tgt_hash_gfx = tgt_hash_theme[:gfx]
128
- gfx_size = read_gfx( src_path_theme, tgt_hash_gfx )
129
- @theme_sizes[ theme_name ][:gfx] += gfx_size
166
+ ts = @theme_sizes[theme_name]
167
+ ts[:css][0] += theme_size[:css][0]
168
+ ts[:css][1] += theme_size[:css][1]
169
+ ts[:html][0] += theme_size[:html][0]
170
+ ts[:html][1] += theme_size[:html][1]
171
+ ts[:gfx] += theme_size[:gfx]
172
+
130
173
  end
174
+
175
+ @theme_time += (Time.now.to_f - time_start)
131
176
  end
132
177
 
133
178
  def add_bundle( bundle_name, bundle_path, entries, has_js=false, has_coffee=false )
@@ -144,45 +189,74 @@ class ClientPkgBuild
144
189
  return true
145
190
  end
146
191
  if has_coffee and @coffee_supported
147
- begin
148
- coffee_start = Time.new.to_f
149
- coffee_path = File.join( bundle_path, bundle_name+'.coffee' )
150
- coffee_timestamp = File.stat( coffee_path ).mtime.to_i
151
- has_cache_compiled = @coffee_cache[:path_compiled].has_key?( coffee_path )
152
- has_cache_timestamp = @coffee_cache[:path_timestamp].has_key?( coffee_path )
153
- has_cache_entry = has_cache_compiled and has_cache_timestamp
154
- has_cached = ( has_cache_entry and ( @coffee_cache[:path_timestamp][coffee_path] == coffee_timestamp ) )
155
- if has_cached
156
- js_data = @coffee_cache[:path_compiled][coffee_path]
192
+ src_path = File.join( bundle_path, bundle_name+'.coffee' )
193
+ is_coffee = true
194
+ elsif not has_js
195
+ src_path = false
196
+ else
197
+ src_path = File.join( bundle_path, bundle_name+'.js' )
198
+ is_coffee = false
199
+ end
200
+ if src_path
201
+ src_timestamp = File.stat( src_path ).mtime.to_i
202
+ src_cache_compiled = @src_cache[:path_compiled].has_key?( src_path )
203
+ src_cache_timestamp = @src_cache[:path_timestamp].has_key?( src_path )
204
+ src_cache_entry = src_cache_compiled and src_cache_timestamp
205
+ src_cached = ( src_cache_entry and ( @src_cache[:path_timestamp][src_path] == src_timestamp ) )
206
+ if src_cached
207
+ js_data = @src_cache[:path_compiled][src_path]
208
+ js_size = @src_cache[:orig_size][src_path]
209
+ min_size = js_data.bytesize
210
+ else
211
+ process_start = Time.new.to_f
212
+ if is_coffee
213
+ begin
214
+ coffee_src = read_file( src_path )
215
+ js_data = CoffeeScript.compile( coffee_src, :bare => true )
216
+ rescue CoffeeScript::CompilationError
217
+ if has_js
218
+ js_data = %{console.log( "WARNING: CoffeeScript complilation failed for source file #{src_path.to_json}, using the js variant instead." );}
219
+ js_data += read_file( File.join( bundle_path, bundle_name+'.js' ) )
220
+ else
221
+ js_data = %{console.log( "WARNING: CoffeeScript complilation failed for source file #{src_path.to_json}" );}
222
+ end
223
+ end
157
224
  else
158
- coffee_src = read_file( coffee_path )
159
- js_data = CoffeeScript.compile( coffee_src, :bare => true )
160
- @coffee_cache[:path_timestamp][coffee_path] = coffee_timestamp
161
- @coffee_cache[:path_compiled][coffee_path] = js_data
225
+ js_data = read_file( src_path )
162
226
  end
163
- @coffee_time += ( Time.new.to_f - coffee_start )
164
- rescue CoffeeScript::CompilationError
165
- if has_js
166
- js_data = %{console.log( "WARNING: CoffeeScript complilation failed for source file #{coffee_path}, using the js variant instead." );}
167
- js_data += read_file( File.join( bundle_path, bundle_name+'.js' ) )
227
+ js_size = js_data.bytesize
228
+ if @debug
229
+ min_size = js_size
168
230
  else
169
- js_data = %{console.log( "WARNING: CoffeeScript complilation failed for source file #{coffee_path}" );}
231
+ js_data = @jsmin.minimize( js_data ) unless @no_whitespace_removal
232
+ min_size = js_data.bytesize
170
233
  end
234
+ if is_coffee
235
+ @coffee_time += ( Time.new.to_f - process_start )
236
+ else
237
+ @js_time += ( Time.new.to_f - process_start )
238
+ end
239
+ @src_cache[:path_timestamp][src_path] = src_timestamp
240
+ @src_cache[:path_compiled][src_path] = js_data
241
+ @src_cache[:orig_size][src_path] = js_size
171
242
  end
172
- elsif not has_js
173
- js_data = %{console.log( "ERROR: CoffeeScript not suuported and no JS source available for #{bundle_path}" );}
174
243
  else
175
- js_data = read_file( File.join( bundle_path, bundle_name+'.js' ) )
244
+ js_data = %{console.log( "ERROR: CoffeeScript not suuported and no JS source available for #{bundle_path}" );}
245
+ js_size = js_data.bytesize
246
+ min_size = js_size
247
+ src_timestamp = 0
176
248
  end
177
249
  @bundles_found[ bundle_name ] = {
178
250
  :path => bundle_path,
179
251
  :js_data => js_data,
180
- :js_size => js_data.bytesize,
181
- :has_themes => has_themes
252
+ :js_size => min_size,
253
+ :orig_size => js_size,
254
+ :has_themes => has_themes,
255
+ :src_timestamp => src_timestamp
182
256
  }
183
- if has_themes
184
- read_theme( bundle_path, bundle_name )
185
- end
257
+
258
+ read_theme( bundle_path, bundle_name ) if has_themes
259
+
186
260
  return true
187
261
  end
188
262
 
@@ -229,9 +303,10 @@ class ClientPkgBuild
229
303
  @logger.log( '' )
230
304
  @logger.log( "Client package build report.......................#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}" )
231
305
  @logger.log( '' )
232
- @logger.log( "JS Package....................: Original | Minimized | Compressed" )
306
+ @logger.log( "JS Package....................: Source | Minimized | GNUZipped" )
233
307
  @logger.log( " : | |" )
234
308
  end
309
+ @package_origsizes = {}
235
310
  @destination_files.each_key do | package_name |
236
311
  jsc_data = process_js( @destination_files[package_name] )
237
312
  @js[package_name] = jsc_data
@@ -240,7 +315,8 @@ class ClientPkgBuild
240
315
  @gz[package_name] = gz_data
241
316
  end
242
317
  unless @quiet
243
- js_size = @destination_files[ package_name ].bytesize
318
+ js_size = @destination_origsize[package_name] #@destination_files[ package_name ].bytesize
319
+ @package_origsizes[package_name] = js_size
244
320
  jsc_size = jsc_data.bytesize
245
321
  if @no_gzip
246
322
  gz_size = -1
@@ -255,16 +331,22 @@ class ClientPkgBuild
255
331
  def squeeze( js, is_coffee=false )
256
332
  unless @no_whitespace_removal
257
333
  begin
258
- js = @jsmin.minimize( js )#.strip
334
+ js = @jsmin.minimize( js ).strip
335
+ # js = JSMinC.minify( js )
259
336
  rescue IndexError => e
260
337
  warn "js can't get smaller using js; just ignoring jsmin"
261
338
  end
262
339
  end
263
340
  unless @no_obfuscation
264
- @jscompress.build_indexes( js )
265
- js = @jscompress.compress( js )
341
+ begin
342
+ ## Not creating new indexes on the fly, to save some speed
343
+ # @jscompress.build_indexes( js )
344
+ js = @jscompress.compress( js )
345
+ rescue
346
+ warn "jscompress failed squeeze; just ignoring jscompress"
347
+ end
266
348
  end
267
- return js.strip
349
+ return js
268
350
  end
269
351
 
270
352
  def coffee( src )
@@ -289,16 +371,16 @@ class ClientPkgBuild
289
371
  return src_in
290
372
  else
291
373
  src_out = src_in
292
- src_out = @jsmin.minimize( src_out ) unless @no_whitespace_removal
293
374
  src_out = pre_convert( src_out ) unless @no_obfuscation
294
- return src_out.strip
375
+ return src_out
295
376
  end
296
377
  end
297
378
 
298
379
  def build_themes
380
+ time_start = Time.now.to_f
299
381
  unless @quiet
300
382
  @logger.log( '' )
301
- @logger.log( "Theme name and part...........: Original | Minimized | Compressed" )
383
+ @logger.log( "Theme name and part...........: Source | Minimized | GNUZipped" )
302
384
  @logger.log( " : | |" )
303
385
  end
304
386
  # compile "all-in-one" css and html resources
@@ -307,6 +389,7 @@ class ClientPkgBuild
307
389
  css_templates = @css_by_theme[ theme_name ]
308
390
  theme_css_template_data = css_templates.values.join("\n")
309
391
  theme_html_js_arr = []
392
+ theme_html_js_arr.push "(function(){"
310
393
  theme_html_js_arr.push "HThemeManager._tmplCache[#{theme_name.to_json}]=#{html_templates.to_json}; "
311
394
  theme_html_js_arr.push "HNoComponentCSS.push(#{theme_name.to_json});"
312
395
  theme_html_js_arr.push "HNoCommonCSS.push(#{theme_name.to_json});"
@@ -317,7 +400,10 @@ class ClientPkgBuild
317
400
  _this.useCSS(#{theme_css_template_data.to_json});
318
401
  } );
319
402
  }
320
- theme_html_js = process_js( theme_html_js_arr.join('') )
403
+ theme_html_js_arr.push "})();"
404
+ theme_html_js = theme_html_js_arr.join("\n")
405
+ @package_origsizes[theme_name+'_theme'] = theme_html_js.bytesize
406
+ theme_html_js = process_js( theme_html_js )
321
407
  @js[theme_name+'_theme'] = theme_html_js
322
408
  unless @no_gzip
323
409
  theme_html_gz = gzip_string( @js[theme_name+'_theme'] )
@@ -336,47 +422,48 @@ class ClientPkgBuild
336
422
  end
337
423
  unless @quiet
338
424
  print_stat( "#{theme_name}/css", @theme_sizes[theme_name][:css][0], @theme_sizes[theme_name][:css][1], theme_css_template_data_gz.bytesize )
339
- print_stat( "#{theme_name}/gfx", @theme_sizes[theme_name][:gfx], -1, -1 )
425
+ print_stat( "#{theme_name}/gfx", @theme_sizes[theme_name][:gfx], @theme_sizes[theme_name][:gfx], @theme_sizes[theme_name][:gfx] )
340
426
  @logger.log( '' )
341
427
  end
342
428
  end
429
+ @theme_time += (Time.now.to_f - time_start)
343
430
  end
344
431
 
345
432
  def build_compound_packages
433
+ time_start = Time.now.to_f
346
434
  unless @quiet
347
435
  @logger.log( '' )
348
- @logger.log( "Compound package..............: Original | Minimized | Compressed" )
436
+ @logger.log( "Compound package..............: Source | Minimized | GNUZipped" )
349
437
  @logger.log( " : | |" )
350
438
  end
351
439
  @compound_config.each do |pkg_name, js_order|
440
+ js_size = 0
352
441
  pkg_parts = []
353
442
  js_order.each do |js_pkg|
354
443
  pkg_part = @js[ js_pkg ]
355
444
  pkg_parts.push( pkg_part )
445
+ js_size += ( @package_origsizes[ js_pkg ] or @destination_origsize[ js_pkg ] )
356
446
  end
357
- js_src = pkg_parts.join('')
447
+ js_src = pkg_parts.join("\n")
358
448
  @js[ pkg_name ] = js_src
359
449
  unless @no_gzip
360
450
  gz_data = gzip_string( js_src )
361
451
  @gz[ pkg_name ] = gz_data
362
452
  end
363
453
  unless @quiet
364
- js_size = js_src.bytesize
454
+ jsc_size = js_src.bytesize
365
455
  if @no_gzip
366
456
  gz_size = -1
367
457
  else
368
458
  gz_size = gz_data.bytesize
369
459
  end
370
- print_stat( pkg_name, js_size, -1, gz_size )
460
+ print_stat( pkg_name, js_size, jsc_size, gz_size )
371
461
  end
372
462
  end
463
+ @js_time += (Time.now.to_f - time_start)
373
464
  end
374
465
 
375
- def run
376
-
377
- time_start = Time.now.to_f*10000
378
- @coffee_time = 0
379
-
466
+ def reset_structures
380
467
  # hash of bundles per bundle name per theme; @html_by_theme[theme_name][bundle_name] = bundle_data
381
468
  @html_by_theme = {}
382
469
  @css_by_theme = {}
@@ -395,33 +482,60 @@ class ClientPkgBuild
395
482
  end
396
483
  @bundles_found = {} # populated by add_bundle
397
484
  @conversion_stats = {} # populated by add_hints
485
+ end
486
+
487
+ def traverse_bundles
398
488
  src_dirs = @src_dirs.clone
399
489
  src_dirs.each do | src_dir |
400
490
  find_bundles( src_dir )
401
491
  end
492
+ end
493
+
494
+ def compose_destinations
402
495
  @destination_files = {} # rename to package_products
496
+ @destination_origsize = {}
403
497
  @package_names.each do |package_name|
404
498
  @packages[package_name].each do |bundle_name|
405
499
  if @bundles_found.has_key?( bundle_name )
406
500
  @destination_files[ package_name ] = [] unless @destination_files.has_key?( package_name )
407
501
  @destination_files[ package_name ].push( @bundles_found[bundle_name][:js_data] )
502
+ @destination_origsize[ package_name ] = 0 unless @destination_origsize.has_key?( package_name )
503
+ @destination_origsize[ package_name ] += @bundles_found[bundle_name][:orig_size]
408
504
  end
409
505
  end
410
506
  end
411
507
  @destination_files.each do | package_name, package_array |
412
- package_data = package_array.join('')
508
+ package_data = package_array.join("\n")
413
509
  @destination_files[ package_name ] = package_data
414
510
  end
511
+ end
512
+
513
+ def run( last_change=0 )
514
+
515
+ time_start = Time.now.to_f*10000
516
+ @coffee_time = 0
517
+ @js_time = 0
518
+ @theme_time = 0
519
+ @last_change = last_change
520
+
521
+ reset_structures
415
522
 
523
+ traverse_bundles
524
+
525
+ compose_destinations
526
+
416
527
  build_indexes
417
- build_themes
528
+
418
529
  minimize_data
530
+ build_themes
419
531
  build_compound_packages
420
532
 
421
533
  ms_taken = ((Time.now.to_f*10000)-time_start).round/10.0
534
+ js_taken = (@js_time*10000).round/10.0
422
535
  coffee_taken = (@coffee_time*10000).round/10.0
423
- without_coffee = ((ms_taken - coffee_taken)*10).round/10.0
424
- @logger.log( "Time taken:\n .coffee: #{coffee_taken}ms\n other: #{without_coffee}ms\n total: #{ms_taken}ms\n\n" )
536
+ themes_taken = (@theme_time*10000).round/10.0
537
+ other_taken = ((ms_taken - coffee_taken - js_taken - themes_taken)*10).round/10.0
538
+ @logger.log( "\nTime taken:\n js: #{js_taken}ms\n coffee: #{coffee_taken}ms\n themes: #{themes_taken}ms\n other: #{other_taken}ms\n total: #{ms_taken}ms\n\n" )
425
539
 
426
540
  end
427
541
 
@@ -542,9 +656,12 @@ class ClientPkgBuild
542
656
  def initialize( config, logger )
543
657
 
544
658
  @coffee_supported = config[:coffee_supported]
545
- @coffee_cache = {
659
+ @src_cache = {
546
660
  :path_timestamp => {},
547
- :path_compiled => {}
661
+ :path_compiled => {},
662
+ :orig_size => {},
663
+ :theme_timestamp => {},
664
+ :theme_data => {}
548
665
  }
549
666
 
550
667
  @logger = logger
@@ -605,7 +722,7 @@ class ClientPkgBuild
605
722
  @compound_config = config[:compound_packages]
606
723
  end
607
724
 
608
- def find_newer( src_dir, newer_than )
725
+ def find_newer( src_dir, newer_than, quiet=false )
609
726
  if File.exist?( src_dir ) and File.directory?( src_dir )
610
727
  Dir.entries( src_dir ).each do | dir_entry |
611
728
  next if dir_entry[0].chr == '.'
@@ -614,7 +731,7 @@ class ClientPkgBuild
614
731
  return true if find_newer( sub_dir, newer_than )
615
732
  else
616
733
  if newer_than < File.stat( sub_dir ).mtime.to_i
617
- @logger.log( "File changed: #{sub_dir}" )
734
+ @logger.log( "File changed: #{sub_dir}" ) unless quiet
618
735
  return true
619
736
  end
620
737
  end
@@ -633,7 +750,7 @@ class ClientPkgBuild
633
750
  end
634
751
 
635
752
  def print_stat( package_name, dst_size, jsc_size, gz_size )
636
- percent = 'n/a'
753
+ # percent = 'n/a'
637
754
  if dst_size > 0
638
755
  percent1 = (100*(jsc_size/dst_size.to_f)).to_i.to_s + '%'
639
756
  percent2 = (100*(gz_size/dst_size.to_f)).to_i.to_s + '%'
@@ -41,7 +41,7 @@ class ClientPkgCache
41
41
  @gz_cache = gz
42
42
  @theme_cache = themes
43
43
  time_now = Time.now
44
- @client_rev = time_now.to_i.to_s
44
+ @client_rev = time_now.to_i.to_s( 36 )
45
45
  @last_modified = httime( time_now )
46
46
  end
47
47
 
data/plugins/main/main.rb CHANGED
@@ -254,7 +254,11 @@ class MainPlugin < Plugin
254
254
  end
255
255
  end
256
256
  ses[:deps].push( boot_dep )
257
- msg.reply(%{jsLoader.loaded("#{boot_dep}");})
257
+ begin
258
+ msg.reply(%{jsLoader.loaded("#{boot_dep}");})
259
+ rescue => e
260
+ warn %{ses_id: #{msg.ses_id} failed to load boot_dep: "#{boot_dep}", because: #{e.inspect}}
261
+ end
258
262
  if boot_dep == 'rsence'
259
263
  ses[:deps].push( 'std_widgets' )
260
264
  msg.reply(%{jsLoader.loaded("std_widgets");})
@@ -186,7 +186,15 @@ class TicketPlugin < Plugin
186
186
 
187
187
  # @private Removes data used by the session, takes msg
188
188
  def expire_ses( msg )
189
- expire_ses_id( msg.ses_id )
189
+ if msg.class == RSence::Message
190
+ expire_ses_id( msg.ses_id )
191
+ elsif msg.class == Hash
192
+ expire_ses_id( msg[:ses_id] )
193
+ elsif msg.class == Integer
194
+ expire_ses_id( msg )
195
+ else
196
+ warn "ticket: Unknown session class: #{msg.class}"
197
+ end
190
198
  end
191
199
 
192
200
  # Sets a custom favicon for RSence