rsence-pre 2.1.0.1.pre
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.
- data/.yardopts +10 -0
- data/INSTALL.rdoc +330 -0
- data/LICENSE.txt +622 -0
- data/README.rdoc +98 -0
- data/VERSION +1 -0
- data/bin/rsence +25 -0
- data/bin/rsence-pre +25 -0
- data/conf/default_conf.yaml +346 -0
- data/conf/default_strings.yaml +76 -0
- data/conf/rsence_command_strings.yaml +444 -0
- data/docs/ExampleGuiPlugin.rdoc +193 -0
- data/docs/JavascriptBundles.rdoc +0 -0
- data/docs/PluginBundleInfo.rdoc +173 -0
- data/docs/PluginBundles.rdoc +96 -0
- data/docs/Values.rdoc +163 -0
- data/js/comm/autosync/autosync.js +17 -0
- data/js/comm/autosync/js.inc +0 -0
- data/js/comm/comm.js +203 -0
- data/js/comm/js.inc +0 -0
- data/js/comm/jsloader/js.inc +0 -0
- data/js/comm/jsloader/jsloader.js +112 -0
- data/js/comm/queue/js.inc +0 -0
- data/js/comm/queue/queue.js +184 -0
- data/js/comm/session/js.inc +0 -0
- data/js/comm/session/session.js +52 -0
- data/js/comm/sessionwatcher/js.inc +0 -0
- data/js/comm/sessionwatcher/sessionwatcher.js +44 -0
- data/js/comm/transporter/js.inc +0 -0
- data/js/comm/transporter/transporter.js +261 -0
- data/js/comm/urlresponder/js.inc +0 -0
- data/js/comm/urlresponder/urlresponder.js +149 -0
- data/js/comm/values/js.inc +0 -0
- data/js/comm/values/values.js +433 -0
- data/js/controls/button/button.js +72 -0
- data/js/controls/button/js.inc +0 -0
- data/js/controls/button/themes/bright/button.css +89 -0
- data/js/controls/button/themes/bright/button.html +7 -0
- data/js/controls/button/themes/bright/button_parts1-ie6.gif +0 -0
- data/js/controls/button/themes/bright/button_parts1.png +0 -0
- data/js/controls/button/themes/default/button.css +89 -0
- data/js/controls/button/themes/default/button.html +7 -0
- data/js/controls/button/themes/default/button_parts1-ie6.gif +0 -0
- data/js/controls/button/themes/default/button_parts1.png +0 -0
- data/js/controls/checkbox/checkbox.js +49 -0
- data/js/controls/checkbox/js.inc +0 -0
- data/js/controls/checkbox/themes/default/checkbox.css +69 -0
- data/js/controls/checkbox/themes/default/checkbox.html +5 -0
- data/js/controls/checkbox/themes/default/checkbox_parts1-ie6.gif +0 -0
- data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
- data/js/controls/dialogs/alert_sheet/alert_sheet.js +63 -0
- data/js/controls/dialogs/alert_sheet/js.inc +0 -0
- data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +37 -0
- data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
- data/js/controls/dialogs/sheet/js.inc +0 -0
- data/js/controls/dialogs/sheet/sheet.js +84 -0
- data/js/controls/dialogs/sheet/themes/default/sheet.css +64 -0
- data/js/controls/dialogs/sheet/themes/default/sheet.html +14 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_bg-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_dim-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts1-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts2-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_warning-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
- data/js/controls/imageview/imageview.js +109 -0
- data/js/controls/imageview/js.inc +0 -0
- data/js/controls/imageview/themes/default/blank.gif +0 -0
- data/js/controls/passwordcontrol/js.inc +0 -0
- data/js/controls/passwordcontrol/passwordcontrol.js +23 -0
- data/js/controls/passwordcontrol/themes/default/passwordcontrol.css +0 -0
- data/js/controls/passwordcontrol/themes/default/passwordcontrol.html +18 -0
- data/js/controls/progress/progressbar/js.inc +0 -0
- data/js/controls/progress/progressbar/progressbar.js +40 -0
- data/js/controls/progress/progressbar/themes/default/progressbar.css +16 -0
- data/js/controls/progress/progressbar/themes/default/progressbar.html +2 -0
- data/js/controls/progress/progressindicator/js.inc +0 -0
- data/js/controls/progress/progressindicator/progressindicator.js +44 -0
- data/js/controls/radiobutton/js.inc +0 -0
- data/js/controls/radiobutton/radiobutton.js +43 -0
- data/js/controls/radiobutton/themes/default/radiobutton.css +69 -0
- data/js/controls/radiobutton/themes/default/radiobutton.html +5 -0
- data/js/controls/radiobutton/themes/default/radiobutton_parts1-ie6.gif +0 -0
- data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
- data/js/controls/sliders/slider/js.inc +0 -0
- data/js/controls/sliders/slider/slider.js +357 -0
- data/js/controls/sliders/slider/themes/default/hslider_tracks-ie6.gif +0 -0
- data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
- data/js/controls/sliders/slider/themes/default/slider.css +108 -0
- data/js/controls/sliders/slider/themes/default/slider.html +5 -0
- data/js/controls/sliders/slider/themes/default/slider_thumbs-ie6.gif +0 -0
- data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
- data/js/controls/sliders/vslider/js.inc +0 -0
- data/js/controls/sliders/vslider/themes/default/vslider.css +52 -0
- data/js/controls/sliders/vslider/themes/default/vslider.html +5 -0
- data/js/controls/sliders/vslider/themes/default/vslider_tracks-ie6.gif +0 -0
- data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
- data/js/controls/sliders/vslider/vslider.js +41 -0
- data/js/controls/stepper/js.inc +0 -0
- data/js/controls/stepper/stepper.js +213 -0
- data/js/controls/stepper/themes/default/stepper-ie6.gif +0 -0
- data/js/controls/stepper/themes/default/stepper.css +14 -0
- data/js/controls/stepper/themes/default/stepper.html +2 -0
- data/js/controls/stepper/themes/default/stepper.png +0 -0
- data/js/controls/stringview/js.inc +0 -0
- data/js/controls/stringview/stringview.js +49 -0
- data/js/controls/stringview/themes/default/stringview.css +8 -0
- data/js/controls/stringview/themes/default/stringview.html +1 -0
- data/js/controls/tab/js.inc +0 -0
- data/js/controls/tab/tab.js +280 -0
- data/js/controls/tab/themes/bright/tab.css +76 -0
- data/js/controls/tab/themes/bright/tab.html +6 -0
- data/js/controls/tab/themes/bright/tab_bg_color-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
- data/js/controls/tab/themes/bright/tab_border_pattern-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
- data/js/controls/tab/themes/bright/tab_parts1-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
- data/js/controls/tab/themes/default/tab.css +77 -0
- data/js/controls/tab/themes/default/tab.html +6 -0
- data/js/controls/tab/themes/default/tab_bg_color-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
- data/js/controls/tab/themes/default/tab_border_pattern-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
- data/js/controls/tab/themes/default/tab_parts1-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_parts1.png +0 -0
- data/js/controls/textarea/js.inc +0 -0
- data/js/controls/textarea/textarea.js +24 -0
- data/js/controls/textarea/themes/default/textarea.css +21 -0
- data/js/controls/textarea/themes/default/textarea.html +18 -0
- data/js/controls/textcontrol/js.inc +0 -0
- data/js/controls/textcontrol/textcontrol.js +374 -0
- data/js/controls/textcontrol/themes/default/textcontrol.css +107 -0
- data/js/controls/textcontrol/themes/default/textcontrol.html +18 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts1-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts2-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts3-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
- data/js/controls/uploader/js.inc +0 -0
- data/js/controls/uploader/themes/default/upload_progress.gif +0 -0
- data/js/controls/uploader/themes/default/uploader.css +108 -0
- data/js/controls/uploader/themes/default/uploader.html +27 -0
- data/js/controls/uploader/uploader.js +154 -0
- data/js/controls/validatorview/js.inc +0 -0
- data/js/controls/validatorview/themes/default/validator-ie6.gif +0 -0
- data/js/controls/validatorview/themes/default/validator.png +0 -0
- data/js/controls/validatorview/themes/default/validatorview.css +0 -0
- data/js/controls/validatorview/themes/default/validatorview.html +0 -0
- data/js/controls/validatorview/validatorview.js +62 -0
- data/js/controls/window/js.inc +0 -0
- data/js/controls/window/themes/default/window.css +219 -0
- data/js/controls/window/themes/default/window.html +17 -0
- data/js/controls/window/themes/default/window_bg_active-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_bg_active.png +0 -0
- data/js/controls/window/themes/default/window_bg_inactive-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
- data/js/controls/window/themes/default/window_buttons-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_buttons.png +0 -0
- data/js/controls/window/themes/default/window_parts1-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_parts1.png +0 -0
- data/js/controls/window/themes/default/window_parts2-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_parts2.png +0 -0
- data/js/controls/window/window.js +286 -0
- data/js/core/class/class.js +318 -0
- data/js/core/class/js.inc +0 -0
- data/js/core/elem/elem.js +1383 -0
- data/js/core/elem/js.inc +0 -0
- data/js/core/event/event.js +153 -0
- data/js/core/event/js.inc +0 -0
- data/js/core/iefix/ie_css_element.htc +5 -0
- data/js/core/iefix/ie_css_style.htc +5 -0
- data/js/core/iefix/iefix.js +359 -0
- data/js/core/iefix/js.inc +0 -0
- data/js/core/rsence_ns/js.inc +0 -0
- data/js/core/rsence_ns/rsence_ns.js +21 -0
- data/js/datetime/calendar/calendar.js +198 -0
- data/js/datetime/calendar/js.inc +0 -0
- data/js/datetime/calendar/themes/default/calendar.css +108 -0
- data/js/datetime/calendar/themes/default/calendar.html +9 -0
- data/js/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
- data/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
- data/js/datetime/datetimevalue/datetimevalue.js +247 -0
- data/js/datetime/datetimevalue/js.inc +0 -0
- data/js/datetime/timesheet/js.inc +0 -0
- data/js/datetime/timesheet/themes/default/timesheet.css +30 -0
- data/js/datetime/timesheet/themes/default/timesheet.html +2 -0
- data/js/datetime/timesheet/timesheet.js +183 -0
- data/js/datetime/timesheet_item/js.inc +0 -0
- data/js/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
- data/js/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
- data/js/datetime/timesheet_item/timesheet_item.js +248 -0
- data/js/datetime/timesheet_item_edit/js.inc +0 -0
- data/js/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
- data/js/foundation/application/application.js +208 -0
- data/js/foundation/application/js.inc +0 -0
- data/js/foundation/control/control.js +339 -0
- data/js/foundation/control/controldefaults/controldefaults.js +56 -0
- data/js/foundation/control/controldefaults/js.inc +0 -0
- data/js/foundation/control/dummyvalue/dummyvalue.js +51 -0
- data/js/foundation/control/dummyvalue/js.inc +0 -0
- data/js/foundation/control/dyncontrol/dyncontrol.js +500 -0
- data/js/foundation/control/dyncontrol/js.inc +0 -0
- data/js/foundation/control/dyncontrol/themes/default/dyncontrol.css +0 -0
- data/js/foundation/control/dyncontrol/themes/default/dyncontrol.html +0 -0
- data/js/foundation/control/eventresponder/eventresponder.js +750 -0
- data/js/foundation/control/eventresponder/js.inc +0 -0
- data/js/foundation/control/js.inc +0 -0
- data/js/foundation/control/valuematrix/js.inc +0 -0
- data/js/foundation/control/valuematrix/valuematrix.js +135 -0
- data/js/foundation/control/valueresponder/js.inc +0 -0
- data/js/foundation/control/valueresponder/valueresponder.js +79 -0
- data/js/foundation/eventmanager/eventmanager.js +991 -0
- data/js/foundation/eventmanager/js.inc +0 -0
- data/js/foundation/geom/point/js.inc +0 -0
- data/js/foundation/geom/point/point.js +202 -0
- data/js/foundation/geom/rect/js.inc +0 -0
- data/js/foundation/geom/rect/rect.js +651 -0
- data/js/foundation/json_renderer/js.inc +0 -0
- data/js/foundation/json_renderer/json_renderer.js +246 -0
- data/js/foundation/system/js.inc +0 -0
- data/js/foundation/system/system.js +381 -0
- data/js/foundation/thememanager/js.inc +0 -0
- data/js/foundation/thememanager/thememanager.js +393 -0
- data/js/foundation/value/js.inc +0 -0
- data/js/foundation/value/value.js +183 -0
- data/js/foundation/view/js.inc +0 -0
- data/js/foundation/view/markupview/js.inc +0 -0
- data/js/foundation/view/markupview/markupview.js +114 -0
- data/js/foundation/view/morphanimation/js.inc +0 -0
- data/js/foundation/view/morphanimation/morphanimation.js +237 -0
- data/js/foundation/view/view.js +1812 -0
- data/js/foundation/view/viewdefaults/js.inc +0 -0
- data/js/foundation/view/viewdefaults/viewdefaults.js +26 -0
- data/js/lists/checkboxlist/checkboxlist.js +171 -0
- data/js/lists/checkboxlist/js.inc +0 -0
- data/js/lists/listitems/js.inc +0 -0
- data/js/lists/listitems/listitems.js +88 -0
- data/js/lists/propertylist/js.inc +0 -0
- data/js/lists/propertylist/propertylist.js +326 -0
- data/js/lists/radiobuttonlist/js.inc +0 -0
- data/js/lists/radiobuttonlist/radiobuttonlist.js +116 -0
- data/js/util/reloadapp/js.inc +0 -0
- data/js/util/reloadapp/reloadapp.js +152 -0
- data/js/util/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
- data/js/util/reloadapp/themes/default/reloadapp_warning.png +0 -0
- data/js/util/sha/js.inc +0 -0
- data/js/util/sha/sha.js +426 -0
- data/js/views/centerview/centerview.js +75 -0
- data/js/views/centerview/js.inc +0 -0
- data/js/views/inlineview/inlineview.js +15 -0
- data/js/views/inlineview/js.inc +0 -0
- data/js/views/scrollview/js.inc +0 -0
- data/js/views/scrollview/scrollview.js +40 -0
- data/lib/conf/argv.rb +850 -0
- data/lib/conf/default.rb +219 -0
- data/lib/daemon/daemon.rb +387 -0
- data/lib/daemon/sigcomm.rb +64 -0
- data/lib/http/broker.rb +150 -0
- data/lib/http/rackup.rb +91 -0
- data/lib/http/request.rb +66 -0
- data/lib/http/response.rb +65 -0
- data/lib/plugins/dependencies.rb +285 -0
- data/lib/plugins/gui_plugin.rb +160 -0
- data/lib/plugins/guiparser.rb +123 -0
- data/lib/plugins/plugin.rb +438 -0
- data/lib/plugins/plugin_base.rb +162 -0
- data/lib/plugins/plugin_plugins.rb +81 -0
- data/lib/plugins/plugin_sqlite_db.rb +98 -0
- data/lib/plugins/pluginmanager.rb +635 -0
- data/lib/plugins/plugins.rb +169 -0
- data/lib/plugins/servlet.rb +108 -0
- data/lib/rsence.rb +32 -0
- data/lib/session/msg.rb +327 -0
- data/lib/session/sessionmanager.rb +522 -0
- data/lib/session/sessionstorage.rb +340 -0
- data/lib/transporter/transporter.rb +263 -0
- data/lib/util/gzstring.rb +9 -0
- data/lib/util/ruby19_fixes.rb +18 -0
- data/lib/values/hvalue.rb +378 -0
- data/lib/values/valuemanager.rb +172 -0
- data/plugins/client_pkg/client_pkg.rb +157 -0
- data/plugins/client_pkg/info.yaml +25 -0
- data/plugins/client_pkg/lib/client_pkg_build.rb +561 -0
- data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
- data/plugins/client_pkg/lib/client_pkg_serve.rb +218 -0
- data/plugins/index_html/img/loading.gif +0 -0
- data/plugins/index_html/img/riassence.gif +0 -0
- data/plugins/index_html/index_html.rb +120 -0
- data/plugins/index_html/info.yaml +18 -0
- data/plugins/index_html/tmpl/index.html +15 -0
- data/plugins/main/info.yaml +18 -0
- data/plugins/main/js/main.js +84 -0
- data/plugins/main/main.rb +255 -0
- data/plugins/main/values.yaml +8 -0
- data/plugins/ticket/info.yaml +21 -0
- data/plugins/ticket/lib/common.rb +392 -0
- data/plugins/ticket/lib/favicon.rb +39 -0
- data/plugins/ticket/lib/file.rb +58 -0
- data/plugins/ticket/lib/img.rb +50 -0
- data/plugins/ticket/lib/objblob.rb +66 -0
- data/plugins/ticket/lib/rsrc.rb +34 -0
- data/plugins/ticket/lib/upload.rb +236 -0
- data/plugins/ticket/ticket.rb +333 -0
- data/setup/welcome/gui/welcome.yaml +92 -0
- data/setup/welcome/info.yaml +13 -0
- data/setup/welcome/text/welcome.html +9 -0
- data/setup/welcome/values.yaml +9 -0
- data/setup/welcome/welcome.rb +54 -0
- metadata +407 -0
@@ -0,0 +1,169 @@
|
|
1
|
+
## RSence
|
2
|
+
# Copyright 2009 Riassence Inc.
|
3
|
+
# http://riassence.com/
|
4
|
+
#
|
5
|
+
# You should have received a copy of the GNU General Public License along
|
6
|
+
# with this software package. If not, contact licensing@riassence.com
|
7
|
+
##
|
8
|
+
|
9
|
+
|
10
|
+
module RSence
|
11
|
+
|
12
|
+
# Namespace for plugin classes and modules
|
13
|
+
module Plugins
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Contains the PluginBase module which has common methods for the bundle classes
|
18
|
+
require 'plugins/plugin_base'
|
19
|
+
|
20
|
+
# guiparser.rb contains the Yaml serializer for gui trees.
|
21
|
+
# It uses JSONRenderer on the client to build user interfaces.
|
22
|
+
require 'plugins/guiparser'
|
23
|
+
|
24
|
+
# plugin_sqlite_db.rb contains automatic local sqlite database
|
25
|
+
# creation for a plugin that includes it.
|
26
|
+
require 'plugins/plugin_sqlite_db'
|
27
|
+
|
28
|
+
# Interface for plugins in a plugin bundle
|
29
|
+
require 'plugins/plugin_plugins'
|
30
|
+
|
31
|
+
|
32
|
+
# Templates for the main plugin classes.
|
33
|
+
require 'plugins/plugin'
|
34
|
+
require 'plugins/gui_plugin'
|
35
|
+
require 'plugins/servlet'
|
36
|
+
|
37
|
+
|
38
|
+
module RSence
|
39
|
+
|
40
|
+
module Plugins
|
41
|
+
|
42
|
+
# Creates the runtime Plugin class from Plugin__
|
43
|
+
# @return [Plugin__]
|
44
|
+
def self.Plugin
|
45
|
+
lambda do |ns|
|
46
|
+
klass = Class.new( Plugin__ ) do
|
47
|
+
def self.ns=(ns)
|
48
|
+
define_method( :bundle_info ) do
|
49
|
+
ns.bundle_info
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
klass.ns = ns if ns
|
54
|
+
klass
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
# Creates the runtime GUIPlugin class from GUIPlugin__
|
60
|
+
# @return [GUIPlugin__]
|
61
|
+
def self.GUIPlugin
|
62
|
+
lambda do |ns|
|
63
|
+
klass = Class.new( GUIPlugin__ ) do
|
64
|
+
def self.ns=(ns)
|
65
|
+
define_method( :bundle_info ) do
|
66
|
+
ns.bundle_info
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
klass.ns = ns if ns
|
71
|
+
klass
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
# Creates the runtime Servlet class from Servlet__
|
77
|
+
# @return [Servlet__]
|
78
|
+
def self.Servlet
|
79
|
+
lambda do |ns|
|
80
|
+
klass = Class.new( Servlet__ ) do
|
81
|
+
def self.ns=(ns)
|
82
|
+
define_method( :bundle_info ) do
|
83
|
+
ns.bundle_info
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
klass.ns = ns if ns
|
88
|
+
klass
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Loads bundle in an anonymous module with special environment options.
|
93
|
+
# @param [Hash] params
|
94
|
+
# @option params [String] :src_path ('/path/of/the_plugin/the_plugin.rb') The ruby source file to read.
|
95
|
+
# @option params [String] :bundle_path ('/path/of/the_plugin') The plugin bundle directory path.
|
96
|
+
# @option params [String] :bundle_name (:the_plugin) The name of the plugin as it will be registered.
|
97
|
+
# @return [Module] Isolated, anonymous module containing the evaluated source code of +src_path+
|
98
|
+
def self.bundle_loader( params )
|
99
|
+
begin
|
100
|
+
mod = Module.new do |m|
|
101
|
+
if RUBY_VERSION.to_f >= 1.9
|
102
|
+
m.define_singleton_method( :_bundle_path ) do
|
103
|
+
params[ :bundle_path ]
|
104
|
+
end
|
105
|
+
else
|
106
|
+
m.module_eval( <<-END
|
107
|
+
def self._bundle_path; #{params[:bundle_path].inspect}; end
|
108
|
+
END
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Makes a full path using the plugin bundle as the 'local path'.
|
113
|
+
# The (optional) +prefix+ is a subdirectory in the bundle,
|
114
|
+
# the +suffix+ is the file extension.
|
115
|
+
def self.bundle_path( path=false, prefix=false, suffix=false )
|
116
|
+
return _bundle_path if not path
|
117
|
+
if suffix
|
118
|
+
path = "#{path}#{suffix}" unless path.end_with?(suffix)
|
119
|
+
end
|
120
|
+
if prefix
|
121
|
+
path = File.join( prefix, path )
|
122
|
+
end
|
123
|
+
path = File.expand_path( path, _bundle_path )
|
124
|
+
return path
|
125
|
+
end
|
126
|
+
def self.inspect; "#<module BundleWrapper of #{@@bundle_name}}>"; end
|
127
|
+
def self.const_missing( name )
|
128
|
+
if name == :Servlet
|
129
|
+
return Plugins.Servlet.call( self )
|
130
|
+
elsif name == :Plugin
|
131
|
+
return Plugins.Plugin.call( self )
|
132
|
+
elsif name == :GUIPlugin
|
133
|
+
return Plugins.GUIPlugin.call( self )
|
134
|
+
else
|
135
|
+
warn "Known const missing: #{name.inspect}"
|
136
|
+
super
|
137
|
+
end
|
138
|
+
end
|
139
|
+
begin
|
140
|
+
plugin_src = params[:src]
|
141
|
+
unless RUBY_VERSION.to_f >= 1.9
|
142
|
+
plugin_src = "_bundle_path = #{params[:bundle_path].inspect};" + plugin_src
|
143
|
+
end
|
144
|
+
m.module_eval( plugin_src )
|
145
|
+
rescue => e
|
146
|
+
src_path = params[:src_path]
|
147
|
+
src_path = "<undefined src_path>" if src_path == nil
|
148
|
+
params[:plugin_manager].plugin_error(
|
149
|
+
e,
|
150
|
+
'BundleLoaderEvalError',
|
151
|
+
"An error occurred while evaluating the plugin bundle #{params[:bundle_name]}.",
|
152
|
+
src_path
|
153
|
+
)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
return mod
|
157
|
+
rescue => e
|
158
|
+
src_path = params[:src_path]
|
159
|
+
src_path = "<undefined src_path>" if src_path == nil
|
160
|
+
params[:plugin_manager].plugin_error(
|
161
|
+
e,
|
162
|
+
'BundleLoaderError',
|
163
|
+
"An error occurred while loading the plugin bundle #{params[:bundle_name]}.",
|
164
|
+
src_path
|
165
|
+
)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
## RSence
|
2
|
+
# Copyright 2009 Riassence Inc.
|
3
|
+
# http://riassence.com/
|
4
|
+
#
|
5
|
+
# You should have received a copy of the GNU General Public License along
|
6
|
+
# with this software package. If not, contact licensing@riassence.com
|
7
|
+
##
|
8
|
+
|
9
|
+
|
10
|
+
module RSence
|
11
|
+
module Plugins
|
12
|
+
|
13
|
+
# Use the Servlet class to create responders for GET / POST urls.
|
14
|
+
#
|
15
|
+
# A Servlet's public API is accessible like the other plugins directly.
|
16
|
+
#
|
17
|
+
# == Responding to a URL consists of four phases:
|
18
|
+
# 1. PluginManager calls every {Servlet__#match #match} method
|
19
|
+
# 2. The plugins that return true to the {Servlet__#match #match} method are queried by their score -method
|
20
|
+
# 3. The matched plugins are sorted by score, lowest score wins. If it's a draw between equal scores, the choice is randomized.
|
21
|
+
# 4. The {Servlet__#post #post} or {Servlet__#get #get} method is called, depending on the type of HTTP request.
|
22
|
+
#
|
23
|
+
# = Extension hooks for server events
|
24
|
+
# These methods are provided as the basic server event hooks:
|
25
|
+
# * {#init +#init+} -- Use instead of +initialize+
|
26
|
+
# * {#open +#open+} -- Extend to open objects
|
27
|
+
# * {#flush +#flush+} -- Extend to write the state and to flush buffers
|
28
|
+
# * {#close +#close+} -- Extend to close objects
|
29
|
+
#
|
30
|
+
# = Extension hooks for REST events
|
31
|
+
# * {#match +#match+} -- Extend to return true for certain url and request_type conditions.
|
32
|
+
# * {#score +#score+} -- Extend to return a numeric score. Lower scores are "better" than higher ones.
|
33
|
+
# * {#get +#get+} -- Extend to handle a HTTP GET request and response.
|
34
|
+
# * {#post +#post+} -- Extend to handle a HTTP POST request and response.
|
35
|
+
class Servlet__
|
36
|
+
|
37
|
+
include PluginBase
|
38
|
+
|
39
|
+
# @private Class type identifier for the PluginManager.
|
40
|
+
# @return [:Servlet]
|
41
|
+
def self.bundle_type; :Servlet; end
|
42
|
+
|
43
|
+
# @private The constructor should not be accessed from anywhere else than the PluginManager, which does it automatically.
|
44
|
+
def initialize( bundle_name, bundle_info, bundle_path, plugin_manager )
|
45
|
+
@info = bundle_info
|
46
|
+
@name = bundle_name
|
47
|
+
@path = bundle_path
|
48
|
+
@plugins = plugin_manager
|
49
|
+
register
|
50
|
+
@inited = false
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [Symbol] The name of the plugin bundle
|
54
|
+
attr_reader :name
|
55
|
+
|
56
|
+
# @return [String] The absolute path of the plugin bundle.
|
57
|
+
attr_reader :path
|
58
|
+
|
59
|
+
# @return [Hash] The {file:PluginBundleInfo meta-information} of the plugin bundle.
|
60
|
+
attr_reader :info
|
61
|
+
|
62
|
+
# @private State of the plugin.
|
63
|
+
attr_reader :inited
|
64
|
+
|
65
|
+
|
66
|
+
# @private Used by PluginManager to register the plugin
|
67
|
+
def register
|
68
|
+
@plugins.register_bundle( self, @name )
|
69
|
+
@inited = true
|
70
|
+
end
|
71
|
+
|
72
|
+
# Extend to return true for the certain uri and request_type conditions your servlet code handles.
|
73
|
+
#
|
74
|
+
# @example Handles :get requests that begin with /foo
|
75
|
+
# def match( uri, request_type )
|
76
|
+
# request_type == :get and uri.start_with?( '/foo' )
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# @param [String] uri The request uri (full "path" of the request url).
|
80
|
+
# @param [:get, :post] request_type The type of request. Only :get and :post are handled yet.
|
81
|
+
#
|
82
|
+
# @return [true] to match
|
83
|
+
# @return [false] to not match. Returns false to everything, if not extended.
|
84
|
+
def match( uri, request_type=:get ); false; end
|
85
|
+
alias match? match
|
86
|
+
|
87
|
+
# If matched, returns score where lower is better. Score is needed for priority sorting, when several Servlet's {#match} are returning true for the same request.
|
88
|
+
#
|
89
|
+
# @return [Number]
|
90
|
+
def score; 100; end
|
91
|
+
|
92
|
+
# Extend to do any GET request processing. Not doing anything by default.
|
93
|
+
#
|
94
|
+
# @param [Request] req The HTTP Request object.
|
95
|
+
# @param [Response] res The HTTP Response object.
|
96
|
+
# @param [Hash] ses The session object, not implemented yet.
|
97
|
+
def get( req, res, ses ); end
|
98
|
+
|
99
|
+
# Extend to do any POST request processing. Not doing anything by default.
|
100
|
+
#
|
101
|
+
# @param [Request] req The HTTP Request object.
|
102
|
+
# @param [Response] res The HTTP Response object.
|
103
|
+
# @param [Hash] ses The session object, not implemented yet.
|
104
|
+
def post( req, res, ses ); end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
data/lib/rsence.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
## RSence
|
2
|
+
# Copyright 2010 Riassence Inc.
|
3
|
+
# http://riassence.com/
|
4
|
+
#
|
5
|
+
# You should have received a copy of the GNU General Public License along
|
6
|
+
# with this software package. If not, contact licensing@riassence.com
|
7
|
+
##
|
8
|
+
|
9
|
+
# The RSence module contains the server interfaces of RSence.
|
10
|
+
# == The classes that matter from a Plugin developer's point of view are:
|
11
|
+
# - {RSence::Plugins::GUIPlugin__ GUIPlugin}
|
12
|
+
# - Use for user interface plugins. Supports {RSence::Plugins::GUIParser GUITree} handling; the user interface starts automatically.
|
13
|
+
# - No server programming except defining GUITree YAML structures is required to define a user interface when using this class.
|
14
|
+
# - {RSence::Plugins::Plugin__ Plugin}
|
15
|
+
# - Use for supporting plugins and advanced client-server development.
|
16
|
+
# - Great for providing backend functionality and miscellaneous API's for other Plugins.
|
17
|
+
# - {RSence::Plugins::Servlet__ Servlet}
|
18
|
+
# - Use for raw POST / GET handlers to provide external API's, search engine indexes, plain html fallback etc.
|
19
|
+
# - {RSence::HValue HValue}
|
20
|
+
# - Use for syncing data objects between client and server automatically.
|
21
|
+
# - Bind any plugin methods as responders / validators; they will be called whenever a client-server change triggers an data change event.
|
22
|
+
# - {RSence::Message Message (msg)}
|
23
|
+
# - Used extensively to pass around session, data and request/response bindings.
|
24
|
+
# - The standard convention is usage as the first parameter, named +msg+, of any method that includes handling session-related data.
|
25
|
+
#
|
26
|
+
# Most other classes are inner workings of RSence itself and are subject to change without further notice.
|
27
|
+
module RSence
|
28
|
+
end
|
29
|
+
|
30
|
+
# Requires the ARGVParser that functions as the command-line user interface.
|
31
|
+
require 'conf/argv'
|
32
|
+
|
data/lib/session/msg.rb
ADDED
@@ -0,0 +1,327 @@
|
|
1
|
+
## RSence
|
2
|
+
# Copyright 2006 Riassence Inc.
|
3
|
+
# http://riassence.com/
|
4
|
+
#
|
5
|
+
# You should have received a copy of the GNU General Public License along
|
6
|
+
# with this software package. If not, contact licensing@riassence.com
|
7
|
+
##
|
8
|
+
|
9
|
+
|
10
|
+
require 'util/gzstring'
|
11
|
+
|
12
|
+
|
13
|
+
module RSence
|
14
|
+
|
15
|
+
# A Message instance is used as a `messenger class` while processing client-server requests. It's initialized by the system and the convention guideline for its instance is +msg+, pass it on wherever msg might be needed.
|
16
|
+
# In most cases, the use of +msg+ is to just pass the same +msg+ onward from a method to another.
|
17
|
+
#
|
18
|
+
# @example Logs a message in the client javascript console.
|
19
|
+
# msg.console "#{Time.new.to_s} -- Testing.."
|
20
|
+
#
|
21
|
+
# @example Executes a custom Javascript command in the client.
|
22
|
+
# msg.reply "alert('Hello!');"
|
23
|
+
#
|
24
|
+
# @example Invalidates the session.
|
25
|
+
# msg.expire_session
|
26
|
+
#
|
27
|
+
# @example Creating a new {HValue}. Usage like this in any extended {Plugins::Plugin__ Plugin} or {Plugins::GUIPlugin__ GUIPlugin} class. It's recommended to use the +values.yaml+ file to create any initial values.
|
28
|
+
# def create_example_value( msg )
|
29
|
+
# ses = get_ses(msg)
|
30
|
+
# default_data = "Some text"
|
31
|
+
# if ses.has_key?( :example_value )
|
32
|
+
# # Resets the default data, causes it to update in the client too on the next sync.
|
33
|
+
# ses[:example_value].set( msg, default_data )
|
34
|
+
# else
|
35
|
+
# # Creates a new value with default data
|
36
|
+
# ses[:example_value] = HValue.new( msg, default_data )
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
class Message
|
41
|
+
|
42
|
+
# @private Session data placeholder, assigned by SessionManager.
|
43
|
+
attr_accessor :session
|
44
|
+
|
45
|
+
# Flag for a new session's first request.
|
46
|
+
# Check it in your code to decide what to do, when a new session is encountered.
|
47
|
+
# In systems that require authentication, this may be used as a trigger to display a login/register dialog.
|
48
|
+
# @return [Boolean] This flag is true on the first request of a newly created session.
|
49
|
+
attr_accessor :new_session
|
50
|
+
|
51
|
+
# Flag for a restored session's first request.
|
52
|
+
# Check it in your code to decide what to do, when a restored session is encountered.
|
53
|
+
# @return [Boolean] This flag is true on the first request of a newly restored session.
|
54
|
+
attr_accessor :restored_session
|
55
|
+
|
56
|
+
# Contains the source ses on the first request after the active session was cloned from another session.
|
57
|
+
# @return [false, Hash]
|
58
|
+
attr_accessor :cloned_source
|
59
|
+
|
60
|
+
# Contains the target sessions packed in an Array on the first request after another session was cloned from the active session.
|
61
|
+
# @return [false, Array<Hash>]
|
62
|
+
attr_accessor :cloned_targets
|
63
|
+
|
64
|
+
# @private The session is not valid by default, it's set by SessionManager, if everything seems ok.
|
65
|
+
attr_accessor :ses_valid
|
66
|
+
|
67
|
+
# The HTTP Request object of the active request.
|
68
|
+
# @return [Request]
|
69
|
+
attr_accessor :request
|
70
|
+
|
71
|
+
# The HTTP Response object of the active request.
|
72
|
+
# @return [Response]
|
73
|
+
attr_accessor :response
|
74
|
+
|
75
|
+
# @private Response output buffer, Array of Strings; sent to client using to_json
|
76
|
+
attr_accessor :buffer
|
77
|
+
|
78
|
+
# @private Value response output buffer, Array value setters; sent to client using to_json before {:buffer} is sent
|
79
|
+
attr_accessor :value_buffer
|
80
|
+
|
81
|
+
# @private The request success flag; Boolean.
|
82
|
+
attr_accessor :response_success
|
83
|
+
|
84
|
+
# Reference to {Transporter}
|
85
|
+
# @return [Transporter]
|
86
|
+
attr_accessor :transporter
|
87
|
+
|
88
|
+
# Reference to {ValueManager}
|
89
|
+
# @return [ValueManager]
|
90
|
+
attr_accessor :valuemanager
|
91
|
+
|
92
|
+
# Reference to {SessionManager}
|
93
|
+
# @return [SessionManager]
|
94
|
+
attr_accessor :sessions
|
95
|
+
|
96
|
+
# Reference to the main {PluginManager}
|
97
|
+
# @return [PluginManager]
|
98
|
+
attr_accessor :plugins
|
99
|
+
|
100
|
+
# @private Message is initialized with a valid {Transporter}, {Request} and {Response} objects along with options.
|
101
|
+
def initialize( transporter, request, response, options )
|
102
|
+
|
103
|
+
@config = RSence.config
|
104
|
+
|
105
|
+
@request = request
|
106
|
+
@response_success = false
|
107
|
+
@response = response
|
108
|
+
@session = nil
|
109
|
+
@buffer = []
|
110
|
+
|
111
|
+
@options = options
|
112
|
+
|
113
|
+
# Value response output.
|
114
|
+
@value_buffer = []
|
115
|
+
|
116
|
+
# The session key placeholder.
|
117
|
+
@ses_key = false
|
118
|
+
@new_session = false
|
119
|
+
@restored_session = false
|
120
|
+
@cloned_source = false
|
121
|
+
@cloned_targets = false
|
122
|
+
@ses_valid = false
|
123
|
+
@error_js = ''
|
124
|
+
|
125
|
+
# global instances
|
126
|
+
@transporter = transporter
|
127
|
+
@valuemanager = @transporter.valuemanager
|
128
|
+
@sessions = @transporter.sessions
|
129
|
+
@plugins = @transporter.plugins
|
130
|
+
|
131
|
+
if options[:servlet]
|
132
|
+
@do_gzip = false
|
133
|
+
else
|
134
|
+
@response.content_type = 'text/javascript; charset=utf-8'
|
135
|
+
@response['Cache-Control'] = 'no-cache'
|
136
|
+
|
137
|
+
# gnu-zipped responses:
|
138
|
+
if @request.header['accept-encoding'] and @request.header['accept-encoding'].include?('gzip') and not @config[:no_gzip]
|
139
|
+
@response['Content-Encoding'] = 'gzip'
|
140
|
+
@do_gzip = true
|
141
|
+
else
|
142
|
+
@do_gzip = false
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
@response_sent = false
|
147
|
+
end
|
148
|
+
|
149
|
+
# @private Returns true for Internet Explorer 6.0
|
150
|
+
# @return [Boolean]
|
151
|
+
def ie6;
|
152
|
+
(request.header.has_key?('user-agent') and request.header['user-agent'].include?('MSIE 6.0'))
|
153
|
+
end
|
154
|
+
|
155
|
+
# Invalidates the active session.
|
156
|
+
# @return [nil]
|
157
|
+
def expire_session
|
158
|
+
@sessions.expire_session( @session[:ses_id] ) if @session
|
159
|
+
end
|
160
|
+
|
161
|
+
# @private Define the session key.
|
162
|
+
def ses_key=(ses_key)
|
163
|
+
@ses_key = ses_key
|
164
|
+
end
|
165
|
+
|
166
|
+
# @private Getter for session key.
|
167
|
+
# @return [String] The active session key.
|
168
|
+
def ses_key
|
169
|
+
@ses_key
|
170
|
+
end
|
171
|
+
|
172
|
+
# Getter for the user id
|
173
|
+
# @return [Number, String] The current user id. Returns 0 by default.
|
174
|
+
def user_id
|
175
|
+
@session[:user_id]
|
176
|
+
end
|
177
|
+
|
178
|
+
# Setter for the user id
|
179
|
+
# @param [Number, String] user_id The user id to set. Use in login situations to store the user id.
|
180
|
+
# @return [nil]
|
181
|
+
def user_id=(user_id)
|
182
|
+
@session[:user_id] = user_id
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the session id
|
186
|
+
# @return [Number]
|
187
|
+
def ses_id
|
188
|
+
@session[:ses_id]
|
189
|
+
end
|
190
|
+
alias session_id ses_id
|
191
|
+
|
192
|
+
# @private Sets the session id
|
193
|
+
# @param [Number] ses_id The session id to set.
|
194
|
+
# @return [nil]
|
195
|
+
def ses_id=(ses_id)
|
196
|
+
@session[:ses_id] = ses_id
|
197
|
+
end
|
198
|
+
|
199
|
+
# @private Sets the error message
|
200
|
+
# @param [String] error_js The error script to send instead of the regular buffers.
|
201
|
+
def error_msg( error_js )
|
202
|
+
@error_js = error_js
|
203
|
+
# response_done
|
204
|
+
end
|
205
|
+
|
206
|
+
# @private Converts the buffer to JSON
|
207
|
+
def buf_json(buffer)
|
208
|
+
buffer.to_json
|
209
|
+
end
|
210
|
+
|
211
|
+
# @private Called to flush buffer.
|
212
|
+
def response_done
|
213
|
+
return if @response_sent
|
214
|
+
if not @response_success
|
215
|
+
@response.status = 200
|
216
|
+
#@response.status = 503
|
217
|
+
|
218
|
+
buffer = [
|
219
|
+
"" # empty session key will stop the syncing
|
220
|
+
] + @error_js
|
221
|
+
else
|
222
|
+
## The response status should always be 200 (OK)
|
223
|
+
@response.status = 200
|
224
|
+
|
225
|
+
buffer = @value_buffer + @buffer
|
226
|
+
if @ses_key
|
227
|
+
buffer.unshift( @ses_key )
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
# flush the output
|
233
|
+
if @do_gzip
|
234
|
+
outp = GZString.new('')
|
235
|
+
gzwriter = Zlib::GzipWriter.new(outp,Zlib::BEST_SPEED)
|
236
|
+
gzwriter.write( buf_json(buffer) )
|
237
|
+
gzwriter.close
|
238
|
+
else
|
239
|
+
outp = buf_json(buffer)
|
240
|
+
end
|
241
|
+
|
242
|
+
@response['content-length'] = outp.size
|
243
|
+
@response.body = outp
|
244
|
+
|
245
|
+
@response_sent = true
|
246
|
+
end
|
247
|
+
|
248
|
+
# Sends data to the client, usually javascript, but is valid for any data that responds to #to_json
|
249
|
+
# @param [String<js>, #to_json] data Javascript source or object that responds to #to_json
|
250
|
+
# @param [Boolean] dont_squeeze When true, doesn't `squeeze` the contents (jsmin + jscompress)
|
251
|
+
def reply(data,dont_squeeze=false)
|
252
|
+
data.strip!
|
253
|
+
data = @plugins[:client_pkg].squeeze( data ) unless dont_squeeze
|
254
|
+
puts data if @config[:trace]
|
255
|
+
@buffer.push( data )
|
256
|
+
end
|
257
|
+
|
258
|
+
# @private For value manager; insert changed values BEFORE other js.
|
259
|
+
def reply_value(data)
|
260
|
+
puts data if @config[:trace]
|
261
|
+
@value_buffer.push( data )
|
262
|
+
end
|
263
|
+
|
264
|
+
# Sends data to the client's javascript console.
|
265
|
+
# @param [#to_json] data Any data that can be presented in the Javascript console.
|
266
|
+
def console(data)
|
267
|
+
reply( "console.log(#{data.to_json});" )
|
268
|
+
end
|
269
|
+
|
270
|
+
# Serves an image object and returns its disposable URL.
|
271
|
+
# Calls the default `ticket` plugin.
|
272
|
+
# @param [#to_blob] img_obj RMagick image object.
|
273
|
+
# @param [String] img_format The format img_obj#to_blob is encoded as.
|
274
|
+
# @return [String] The URL where the image can be accessed from using a GET request.
|
275
|
+
# @deprecated
|
276
|
+
# Use {TicketPlugin#serve_img ticket.serve_img} directly instead.
|
277
|
+
def serve_img( img_obj, img_format='PNG' )
|
278
|
+
call( :ticket, :serve_img, self, img_obj, img_format )
|
279
|
+
end
|
280
|
+
|
281
|
+
# Binary data to be served once as a downloadable file attachment, returns a disposable URL.
|
282
|
+
# Calls the default `ticket` plugin.
|
283
|
+
# @param [String] file_data The binary data to serve
|
284
|
+
# @param [String] content_type The MIME type to serve the data as
|
285
|
+
# @param [String] filename The name of the downloadable file.
|
286
|
+
# @return [String] The URL where the downloadable file can be accessed from using a GET request.
|
287
|
+
# @deprecated
|
288
|
+
# Use {TicketPlugin#serve_file ticket.serve_file} directly instead.
|
289
|
+
def serve_file( file_data, content_type='text/plain', filename='untitled.txt' )
|
290
|
+
call( :ticket, :serve_file, self, file_data, content_type, filename )
|
291
|
+
end
|
292
|
+
|
293
|
+
# Sends any binary to be served indefinitely, returns a unique, random, static URL.
|
294
|
+
# Calls the default `ticket` plugin.
|
295
|
+
# IMPORTANT: PLEASE call {#release_rsrc} manually, when the resource is no longer needed to free the memory occupied!
|
296
|
+
# HINT: In most cases, it's a better idea to use serve_img or serve_file to expire the resource automatically.
|
297
|
+
# @see {#release_rsrc}
|
298
|
+
# @param [String] rsrc_data The binary data of the resource to serve.
|
299
|
+
# @param [String] content_type The MIME type to serve the data as
|
300
|
+
# @return [String] The URL where the resource can be accessed from using a GET request.
|
301
|
+
# @deprecated
|
302
|
+
# Use {TicketPlugin#serve_rsrc ticket.serve_rsrc} directly instead.
|
303
|
+
def serve_rsrc( rsrc_data, content_type='text/plain' )
|
304
|
+
call(:ticket,:serve_rsrc,self, rsrc_data, content_type )
|
305
|
+
end
|
306
|
+
|
307
|
+
# Removes the URL served, you *must* call this manually when after a served resource is no longer needed!
|
308
|
+
# Calls the default `ticket` plugin.
|
309
|
+
# @see {#serve_rsrc}
|
310
|
+
# @param [String] uri The URL to delete; the return value of {#serve_rsrc}
|
311
|
+
# @deprecated
|
312
|
+
# Use {TicketPlugin#serve_rsrc ticket.serve_rsrc} directly instead.
|
313
|
+
def release_rsrc( uri )
|
314
|
+
call(:ticket,:del_rsrc, uri[3..-1] )
|
315
|
+
end
|
316
|
+
alias unserve_rsrc release_rsrc
|
317
|
+
|
318
|
+
# Calls a method of a registered plugin with optional arguments.
|
319
|
+
# @param [Symbol] plugin_name The plugin to call
|
320
|
+
# @param [Symbol] plugin_method The method of the plugin to call
|
321
|
+
# @param *args Any arguments to pass to the `plugin_method`
|
322
|
+
def call( plugin_name, plugin_method, *args )
|
323
|
+
@plugins.call( plugin_name, plugin_method, *args)
|
324
|
+
end
|
325
|
+
alias run call
|
326
|
+
end
|
327
|
+
end
|