| 1 |
current = File.dirname(__FILE__) |
|---|
| 2 |
require "#{current}/compress_util" |
|---|
| 3 |
|
|---|
| 4 |
#===[Settings begin]================================================================================# |
|---|
| 5 |
flag_rubrikcs = true |
|---|
| 6 |
flag_components = true |
|---|
| 7 |
flag_spinelz = true |
|---|
| 8 |
spinelz_utils = ['prototype', 'builder', 'effects', 'dragdrop', 'controls', 'slider', 'resize', 'json', 'spinelz_util'] |
|---|
| 9 |
spinelz_js = ['ajaxHistory', 'autoKana', 'balloon', 'calendar', 'colorpicker', 'datepicker', 'inplaceEditorEx', 'menubar', 'navPanel', 'selectableTable', 'sideBarBox', 'sideBarBox_effects', 'sortableEx', 'switcher', 'tabBox', 'timepicker', 'treeview', 'window', 'window_resizeEx'] |
|---|
| 10 |
spinelz_css = ['balloon', 'calendar', 'datepicker', 'menubar', 'modal', 'navPanel', 'selectableTable', 'sideBarBox', 'switcher', 'tabBox', 'timepicker', 'treeview', 'window'] |
|---|
| 11 |
#===[Settings end]==================================================================================# |
|---|
| 12 |
|
|---|
| 13 |
status = system('java -version') |
|---|
| 14 |
unless status |
|---|
| 15 |
p "Can't execute 'java'" |
|---|
| 16 |
exit 0 |
|---|
| 17 |
end |
|---|
| 18 |
|
|---|
| 19 |
rubricks_base = File.join(current, '..', 'rubricks_core') |
|---|
| 20 |
spinelz_base = File.join(current, '..', 'spinelz') |
|---|
| 21 |
jar = File.join(current, 'custom_rhino.jar') |
|---|
| 22 |
|
|---|
| 23 |
if File.exists?(jar) |
|---|
| 24 |
CompressUtil.jar = jar |
|---|
| 25 |
else |
|---|
| 26 |
p "Can't find #{jar}" |
|---|
| 27 |
exit 0 |
|---|
| 28 |
end |
|---|
| 29 |
|
|---|
| 30 |
if flag_rubrikcs |
|---|
| 31 |
if File.exists?(rubricks_base) |
|---|
| 32 |
CompressUtil.js_compress(File.join(rubricks_base, 'public', 'javascripts'), {:prefix => 'src_', :join => 'rubricks_common'}) |
|---|
| 33 |
CompressUtil.js_compress(File.join(rubricks_base, 'public', 'javascripts', 'components', 'system'), {:prefix => 'src_', :join => 'system'}) |
|---|
| 34 |
CompressUtil.system_css(File.join(rubricks_base, 'public', 'stylesheets', 'components', 'system')) |
|---|
| 35 |
else |
|---|
| 36 |
p "Can't find #{rubricks_base}" |
|---|
| 37 |
end |
|---|
| 38 |
end |
|---|
| 39 |
|
|---|
| 40 |
if flag_components |
|---|
| 41 |
Dir.glob(File.join(rubricks_base, 'components', '*', '_install', 'javascripts')).collect do |src_dir_path| |
|---|
| 42 |
CompressUtil.js_compress(src_dir_path, {:pattern => /src_/, :prefix => 'src_', :replace => '', :tmp_file => true}) |
|---|
| 43 |
end |
|---|
| 44 |
end |
|---|
| 45 |
|
|---|
| 46 |
if flag_spinelz |
|---|
| 47 |
if File.exists?(spinelz_base) |
|---|
| 48 |
CompressUtil.js_compress(File.join(spinelz_base, 'src', 'javascripts', 'spinelz'), {:pattern => %r|.*/([^/]+)$|, :prefix => '', :replace => File.join(spinelz_base, 'compress', 'javascripts', 'spinelz', '/\\1')}) |
|---|
| 49 |
CompressUtil.js_compress(File.join(spinelz_base, 'src', 'javascripts', 'spinelz_lib'), {:pattern => %r|.*/([^/]+)$|, :prefix => '', :replace => File.join(spinelz_base, 'compress', 'javascripts', 'spinelz_lib', '/\\1')}) |
|---|
| 50 |
CompressUtil.spinelz_js(spinelz_base, spinelz_js, spinelz_utils) |
|---|
| 51 |
CompressUtil.spinelz_img(File.join(spinelz_base, 'src', 'images', 'spinelz'), File.join(spinelz_base, 'compress', 'images', 'spinelz')) |
|---|
| 52 |
CompressUtil.spinelz_css(File.join(spinelz_base, 'src', 'stylesheets', 'spinelz'), File.join(spinelz_base, 'compress', 'stylesheets', 'spinelz'), 'spinelz_', spinelz_css) |
|---|
| 53 |
else |
|---|
| 54 |
p "Can't find #{spinelz_base}" |
|---|
| 55 |
end |
|---|
| 56 |
end |
|---|